|
DigiPara Liftdesigner LDX API
|
API method: ILDXCarFrame5.RATIO
Treename: Shaft0.Car.Frame.
' from Samples/Src/LDXAPIExamples/Example_LDXCarFrame.vb
<APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "Shaft0.Car.Frame.", "LDXCarFrame~RATIO", "[0136] Custom rope course")>
Public Shared Sub RopeCourse(ByRef ldxDocument As DigiPara.LDX.LDXDocument)
If ldxDocument.GetLDXObject("Shaft0.Car.Frame.") Is Nothing Then
MsgBox("Car frame not found!")
Exit Sub
End If
' make ropes visible
For Each ldxSheetFrame As DigiPara.LDX.LDXSheetFrame In ldxDocument.Sheets.ActiveSheet
ldxSheetFrame.VisibleProductGroups = ldxSheetFrame.VisibleProductGroups Or DigiPara.LDX.SheetFrameProductGroups.shfpRopes
Next
Dim ldxShaft As DigiPara.LDX.LDXShaft = ldxDocument.Shafts(0)
Dim ldxCar As DigiPara.LDX.LDXCar = ldxShaft.Car
Dim ldxCarFrame As DigiPara.LDX.LDXCarFrame = ldxCar.CarFrame
' fetch standard rope course components
Dim ldxCarPulleyBeam = ldxCar.CarFrame.MoveFrame.GetPulleyBeam(0)
Dim ldxCounterWeightPulleyBeam = ldxShaft.CWConsole.CWFrame.MoveFrame.GetPulleyBeam(0)
Dim ldxGear = ldxShaft.Gear
With ldxCarFrame
If (.MoveFrame.MOVEFRAME_MODE And DigiPara.LDX.MoveFrameModes.mfmRatioManual) = DigiPara.LDX.MoveFrameModes.mfmRatioManual Then
' already set, undo
.MoveFrame.MOVEFRAME_MODE = .MoveFrame.MOVEFRAME_MODE And Not DigiPara.LDX.MoveFrameModes.mfmRatioManual
ldxShaft.Comp.UserChildren.Clear()
ldxCar.CarRopeType = DigiPara.LDX.CarRopeType.crtNoPulley
' restore rope course
Dim standardRopeCourse = New List(Of DigiPara.LDX.LDXComp)
standardRopeCourse.Add(ldxCarPulleyBeam.Comp)
standardRopeCourse.Add(ldxGear.Comp)
standardRopeCourse.Add(ldxCounterWeightPulleyBeam.Comp)
ldxShaft.RopeCourse(0) = standardRopeCourse.ToArray()
Return
End If
' Enable manual ratio
.MoveFrame.MOVEFRAME_MODE = .MoveFrame.MOVEFRAME_MODE Or DigiPara.LDX.MoveFrameModes.mfmRatioManual
.RATIO = 1.0
End With
' change rope fall to two pulleys; thanks to mfmRatioManual, this does not influence the movement
ldxCar.CarRopeType = DigiPara.LDX.CarRopeType.crtTwoPulleysAbove
' place diversion fake pulleys below the shaft ceiling
Dim ldxUserComp As DigiPara.LDX.LDXUserComp = ldxShaft.Comp.UserChildren.Add("Diversion").LDXType
ldxUserComp.Mode = DigiPara.LDX.UserCompModes.ucmUsePositionAndAngle
ldxUserComp.Z0 = ldxShaft.Room.Height - 300
ldxUserComp.X0 = ldxShaft.Room.Width * 0.5
ldxUserComp.Y0 = ldxShaft.Room.DEPTH * 0.5
Dim ldxStartPoint = ldxUserComp.Comp.ProfilePoints.Add()
ldxStartPoint.SetEquation(DigiPara.LDX.ProfileEquationType.peqtLocalPositionZ, "400")
' IMPORTANT: The orientation of the profiles matters. The X axis determines the rope winding direction (counterclockwise when looking into the positive x direction)
' and the Y direction determines the points other components may align themselves to.
Dim ldxFakePulleyRightTop As DigiPara.LDX.LDXProfile = AddFakePulley(ldxUserComp, -110, 0, 100, -1)
Dim ldxFakePulleyLeftTop As DigiPara.LDX.LDXProfile = AddFakePulley(ldxUserComp, 110, 0, 100, -1)
Dim ldxFakePulleyRightBottom As DigiPara.LDX.LDXProfile = AddFakePulley(ldxUserComp, -500, -500, 100, 1)
Dim ldxFakePulleyLeftBottom As DigiPara.LDX.LDXProfile = AddFakePulley(ldxUserComp, 500, -500, 100, 1)
Dim courseBefore As DigiPara.LDX.LDXComp() = ldxShaft.RopeCourse(0)
Dim courseTreeNames = New List(Of String)
For Each ldxComp In courseBefore
courseTreeNames.Add(ldxComp.Object.TreeName)
Next
' thread rope through fake pulleys
Dim newRopeCourse = New List(Of DigiPara.LDX.LDXComp)
newRopeCourse.Add(ldxStartPoint.Comp)
newRopeCourse.Add(ldxFakePulleyRightTop.Comp)
newRopeCourse.Add(ldxFakePulleyRightBottom.Comp)
' you can add the entire pulley beam as normal...
newRopeCourse.Add(ldxCarPulleyBeam.Comp)
' but for testing winding direction consistency, we could add the pulleys individually
' newRopeCourse.Add(ldxCarPulleyBeam.Pulley0.Comp)
' newRopeCourse.Add(ldxCarPulleyBeam.Pulley1.Comp)
newRopeCourse.Add(ldxFakePulleyLeftBottom.Comp)
newRopeCourse.Add(ldxFakePulleyLeftTop.Comp)
' same as above, normally you just add the gear...
newRopeCourse.Add(ldxGear.Comp)
' but we could add the deflection sheave and driver individually (note, this breaks some of the gear's logic, so don't)
'newRopeCourse.Add(ldxGear.Pulley.Comp)
'newRopeCourse.Add(ldxGear.GetPulleyBeam(0).Pulley0.Comp)
newRopeCourse.Add(ldxCounterWeightPulleyBeam.Comp)
ldxShaft.RopeCourse(0) = newRopeCourse.ToArray()
End Sub