DigiPara Liftdesigner LDX API
Loading...
Searching...
No Matches
Change selected object

API method: ILDXApplication5.LockEvents

 ' from Samples/Src/LDXAPIExamples/Example_LDXApplication.vb

    <APIHelpAttribute(APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXApp}, "", "LDXApplication~LockEvents", "Change selected object")>
 Public Shared Sub ChangeSelectedObject(ldxApplication As DigiPara.LDX.LDXApplication)

     If ldxApplication.ActiveDocument Is Nothing Or ldxApplication.ActiveDocument.Shafts(0) Is Nothing Then
         MsgBox("Shafts not found!")
         Exit Sub
     End If

     Try
         ' Stop all events from firing for the active LDXDocument
         ldxApplication.LockEvents(ldxApplication.ActiveDocument)

         ' Clear all selected objects
         ldxApplication.ActiveDocument.Sheets.ActiveSheet.ActiveSheetFrame.SelectedObjects.Clear()

         ' Set new selected object
         ldxApplication.ActiveDocument.Sheets.ActiveSheet.ActiveSheetFrame.SelectedObjects.Add("Shaft0.Car.")
         ldxApplication.ActiveDocument.Sheets.ActiveSheet.ActiveSheetFrame.SelectedObjects.Add("Shaft0.CW.Weight.")
         ' Notify frames of selction changes
         ldxApplication.ActiveDocument.Sheets.ActiveSheet.UpdateSelection()

     Finally
         ' Enable firing all events for the active LDXDocument
         ' always call UnlockEvents in a Finally block
         ldxApplication.UnlockEvents(ldxApplication.ActiveDocument)
     End Try

     ldxApplication.ActiveDocument.CalculateModel(DigiPara.LDX.CalculateModelModes.rcmCalcAndReport Or DigiPara.LDX.CalculateModelModes.rcmFireCalculatedEvent)

 End Sub