DigiPara Liftdesigner LDX API
Loading...
Searching...
No Matches
Create multiple ghosts

API method: ILDXSheetFrame5.CarGhostMode

Treename: Shaft0.Car.

 ' from Samples/Src/LDXAPIExamples/Example_LDXCar.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "Shaft0.Car.", "LDXSheetFrame~CarGhostMode", "Create multiple ghosts")>
 Public Shared Sub ChangeGhostVisiblePortion(ldxDocument As DigiPara.LDX.LDXDocument)

     If ldxDocument.GetLDXObject("Shaft0.Car.") Is Nothing Then
         MsgBox("Car console not found!")
         Exit Sub
     End If

     Dim ldxFrame As DigiPara.LDX.LDXSheetFrame = ldxDocument.Sheets.ActiveSheet?.ActiveSheetFrame
     If ldxFrame Is Nothing Then
         MsgBox("No active sheet frame!")
         Exit Sub
     End If


     Dim ldxCar As DigiPara.LDX.LDXCar = ldxDocument.Shafts(0).Car

     ' gererate ghost in top position
     ldxFrame.CarGhostMode = DigiPara.LDX.SheetFrameCarModes.shfrcmPositionTop
     ldxFrame.CalculateModelBarrierRelease()
     ldxFrame.CalculateModelBarrierAcquire()

     ' fetch current ghost
     Dim ghostObject As DigiPara.LDX.LDXObject = ldxCar.Object.GetObjectByRelativeName("Components.Symbol5.")
     If ghostObject IsNot Nothing Then
         ' clear old saved ghost
         ldxCar.Object.GetObjectByRelativeName("Components.Symbol25.")?.RemoveMe()

         Dim ghostSymbol As DigiPara.LDX.LDXSymbol = DirectCast(ghostObject.LDXType, DigiPara.LDX.LDXSymbol)

         ' give ghost a new ID, this saves it from manipulation
         ghostSymbol.Type = 25

         ' exclude the saved car ghost from getting rendered into the new car ghost
         ldxCar.CarFrame.MoveFrame.AdditionalExclude = ghostObject.TreeName

         ' sadly, we cannot MOVE the saved ghost over the .NET API

         ' make the saved ghost dashed
         ldxFrame.SheetFrameOverwrites.Add(ghostObject.TreeName, DigiPara.LDX.SheetFrameOverwriteType.sfoDash).Value = 1
     End If

     ' generate new ghost at the bottom position
     ldxFrame.CarGhostMode = DigiPara.LDX.SheetFrameCarModes.shfrcmPositionBottom
     ldxFrame.CalculateModelBarrierRelease()
     ldxFrame.CalculateModelBarrierAcquire()

 End Sub