|
DigiPara Liftdesigner LDX API
|
API method: ILDXUserComp5.UserCompTab
Treename: Shaft0.LD API Example.
' from Samples/Src/LDXAPIExamples/Example_LDXUserComp.vb
<APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "Shaft0.LD API Example.", "LDXUserComp~UserCompTab", "Add user component")>
Public Shared Sub AddUserComponent(ByRef ldxDocument As DigiPara.LDX.LDXDocument)
If ldxDocument.GetLDXObject("Shaft0.") Is Nothing Then
MsgBox("Shafts not found! Please reload the relevent .ld3 object.")
Exit Sub
End If
Dim shaft As DigiPara.LDX.LDXComp = ldxDocument.GetLDXComp("Shaft0.")
shaft.UserChildren.Clear() ' delete previous user comps to get to a defined state
Dim userComp As DigiPara.LDX.LDXUserComp = shaft.UserChildren.Add("LD API Example.").GetLDXType(DigiPara.LDX.ObjectId.idUserComp)
With userComp
' Change the component to a flat steel beam
.Comp.ChangePartRID64(1, 0)
' Change inward displacement
.Object.SetValue("Y0", 2350)
' Change dimensions
.UserCompTab.SetValue("USERC_USER_PG_50", 0)
.UserCompTab.SetValue("USERC_USER_PG_51", 1800)
.UserCompTab.SetValue("USERC_USER_PG_52", 300)
.UserCompTab.SetValue("USERC_USER_PG_53", 300)
End With
' user comps can be retrieved from the UserChildren list by name or by index
System.Diagnostics.Debug.Assert(shaft.UserChildren.Item("LD API Example.") Is userComp.Object)
System.Diagnostics.Debug.Assert(shaft.UserChildren.Item(0) Is userComp.Object)
System.Diagnostics.Debug.Assert(shaft.UserChildren.Item("Should not be there.") Is Nothing)
End Sub