DigiPara Liftdesigner LDX API
Loading...
Searching...
No Matches
Add user variable

API method: ILDXComponents5.Add

Treename: Components.Global.Storage.UserVariable

 ' from Samples/Src/LDXAPIExamples/Example_LDXDocument.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXApp}, "Components.Global.Storage.UserVariable", "LDXComponents~Add", "Add user variable")>
 Public Shared Sub AddUserVariable(ByRef ldxApplication As DigiPara.LDX.LDXApplication)

     If ldxApplication.ActiveDocument Is Nothing Then
         MsgBox("Active document not found!")
         Exit Sub
     End If

     If ldxApplication.ActiveDocument.GetLDXObject("Components.Global.") Is Nothing Then
         DirectCast(ldxApplication.ActiveDocument.GetLDXObject("Components.").LDXType, DigiPara.LDX.LDXComponents).Add("Global.")
     End If

     With ldxApplication.ActiveDocument.GetLDXObject("Components.Global.")

         .Comp.SX = -1

         If (.GetStorages().Item("UserVariable") Is Nothing) Then
             .GetStorages().AddText("UserVariable", "XX")
         Else
             DirectCast(.GetStorages().Item("UserVariable").Object.LDXType, DigiPara.LDX.LDXObjectStorageText).Text = "XX"
         End If

     End With

 End Sub