You probably already know about DigiPara® Liftdesigner ‘s functionality to let the user add user defined objects to any of the components inside the data tree. This property is called “Additional Child Objects”.
Well, this is nice for people that don’t want to do any kind of programming to just add some non-standard geometry to DigiPara® Liftdesigner . But it also comes with some nice features if you add it programmatically. Here’s a screenshot of the properties for a child object:
As you can see, it gives the user control over e.g. the components x/y/z position or the rotation angle. Might be handy for certain purposes.
Here’s the VB.NET code snippet to do that:
Private Enum LDF_WHAT
LDF_WHAT_CAR_AND_DOORS = &H1 ' Car and Doors
LDF_WHAT_GUIDES = &H2 ' Guide Rails
LDF_WHAT_RAILBRACKETS = &H4 ' Rail Brackets
LDF_WHAT_CARFRAME = &H8 ' Car Frame
LDF_WHAT_MP = &H10 ' Scaffoldings
LDF_WHAT_GL = &H20 ' Gear and Pulleys
LDF_WHAT_CY_AND_BF = &H40 ' Cylinders and Buffers
LDF_WHAT_CAR_INTERIOR = &H80 ' Car interior
LDF_WHAT_AR = &H400 ' Anchor Rails
LDF_WHAT_SHAFT = &H800 ' Shaft
LDF_WHAT_FORCES = &H1000 ' Forces
LDF_WHAT_ROPE = &H20000 ' Ropes
LDF_WHAT_TABLEAU = &H40000 ' Hall Buttons
LDF_WHAT_REFUGE = &H80000 ' Refuge Space
LDF_WHAT_MROOM = &H200000 ' Machine Room
LDF_WHAT_ELECTRICAL = &H400000 ' Lighting, Panels, Traveling Cable, etc.
LDF_WHAT_GOVERNOR = &H800000 ' Governor
LDF_WHAT_DOOR_FIXING = &H1000000 ' Door Fixings
LDF_WHAT_BEAMS = &H2000000 ' Separator Beams, MR-Beams and Sill Support
LDF_WHAT_UNKNOWN = &H40000000 ' unknown: use if nothing else fits
End Enum
Private Sub Calculate_AdditionalChilds(ByRef ldDoc As LDX.LDXDocument, ByVal ldShaft As LDX.LDXShaft)
Dim ldObj As LDX.LDXObject
Dim ldUComp As LDX.LDXUserComp
'Define some display options for the property grid
Dim ldObjDisplOption As LDX.ObjectDisplayOptions = LDX.ObjectDisplayOptions.odoAllowAdditionalChild Or _
LDX.ObjectDisplayOptions.odoAllowAddUserVariable Or LDX.ObjectDisplayOptions.odoCanBeAddedToDatamodel Or _
LDX.ObjectDisplayOptions.odoShowAngle Or LDX.ObjectDisplayOptions.odoShowDesc Or _
LDX.ObjectDisplayOptions.odoShowManufacturer Or LDX.ObjectDisplayOptions.odoShowSubDesc
'Create main component with "Shaft0." as parent
ldObj = ldShaft.Comp.UserChildren("MyMainComp0.")
If ldObj Is Nothing Then
ldObj = ldShaft.Comp.UserChildren.Add("MyMainComp0.")
End If
ldUComp = ldObj.LDXType()
With ldUComp
'From "L_UserCompTab"
If .Comp.GetPartRID() <> 19 Then .Comp.ChangePartRID(19, 0)
'Or directly change PG_GRP
'If .Comp.PG_GRP <> 1 Then .Comp.ChangePGGRP(1)
'Set some display options
.UserDisplayOptions = ldObjDisplOption
'Assign e.g. "Shaft" component group (Properties -> "Assigned component group")
ldDoc.SetValue(.Object.TreeName & "WHAT_BIT", LDF_WHAT.LDF_WHAT_SHAFT)
'Set insertion point relative to parent component
'Only set here if user should not be able to change from within LD
ldDoc.SetValue(.Object.TreeName & "X0", 0)
ldDoc.SetValue(.Object.TreeName & "Y0", 0)
ldDoc.SetValue(.Object.TreeName & "Z0", 0)
'Anything else is just like for normal user components
End With
'Create two child components with "MyMainComp0." as parent
Dim ldUCompChild As LDX.LDXUserComp
For i As Integer = 0 To 1
ldObj = ldUComp.Comp.UserChildren("MyChild" & i & ".")
If ldObj Is Nothing Then
ldObj = ldUComp.Comp.UserChildren.Add("MyChild" & i & ".")
End If
ldUCompChild = ldObj.LDXType()
With ldUCompChild
'From "L_UserCompTab"
If .Comp.GetPartRID() <> 2 Then .Comp.ChangePartRID(2, 0)
'Or directly change PG_GRP
'If .Comp.PG_GRP <> 1 Then .Comp.ChangePGGRP(1)
'Set some display options
.UserDisplayOptions = ldObjDisplOption
'Assign e.g. "Shaft" component group (Properties -> "Assigned component group")
ldDoc.SetValue(.Object.TreeName & "WHAT_BIT", LDF_WHAT.LDF_WHAT_SHAFT)
'Set insertion point relative to parent component
'Only set here if user should not be able to change from within LD
If i = 0 Then
ldDoc.SetValue(.Object.TreeName & "X0", 0)
Else
ldDoc.SetValue(.Object.TreeName & "X0", ldShaft.Room.Width)
End If
ldDoc.SetValue(.Object.TreeName & "Y0", 0)
ldDoc.SetValue(.Object.TreeName & "Z0", 0)
'Anything else is just like for normal user components
End With
Next
End Sub
Enjoy…