DigiPara Liftdesigner LDX API
Loading...
Searching...
No Matches
Add event hook that listens to CAD file use

API method: _ILDXApplicationEvents5.CADFileUpdating

Treename: Shaft0.CAD File.

 ' from Samples/Src/LDXAPIExamples/Example_LDXInsertedCADFile.vb

 Private Shared ignoreNextEvent As Boolean = False
 Public Shared Sub LDXApplication_CADFileUpdatingEventHandler(a_Document As DigiPara.LDX.LDXDocument, a_CADFile As DigiPara.LDX.LDXInsertedCADFile, a_modes As DigiPara.LDX.CADFileUpdatingModes, a_phase As DigiPara.LDX.CADFileUpdatingPhase, ByRef a_cancellationRequested As Boolean)
     If a_phase = DigiPara.LDX.CADFileUpdatingPhase.cfupBegin Then
         ' this is the beginning of a parameter mapping run; the next loading event should be ignored
         ignoreNextEvent = True
     ElseIf a_phase = DigiPara.LDX.CADFileUpdatingPhase.cfupExecuteReload Then
         ' CAD file is actually loaded
         If ignoreNextEvent Then
             ' but we should ignore it; only once, though.
             ignoreNextEvent = False
         Else
             ' a valid user triggered load!
             Dim cadFileName = a_CADFile.CADF_LOADED_FILE

             ' logging goes here
             System.Windows.Forms.MessageBox.Show("CAD file (re)loaded: " & cadFileName)
         End If
     End If
 End Sub

 <APIHelpAttribute(APIHelpModes.FireCalcModel, {APIHelpModes.InputParaLDXApp}, "Shaft0.CAD File.", "_ILDXApplicationEvents5~CADFileUpdating", "Add event hook that listens to CAD file use")>
 Public Shared Sub ReactToCADFileUse(ByRef ldxApp As DigiPara.LDX.LDXApplication)
     AddHandler ldxApp.CADFileUpdating, AddressOf LDXApplication_CADFileUpdatingEventHandler
 End Sub