DigiPara Liftdesigner LDX API
Loading...
Searching...
No Matches
Sheet frame building event

API method: _ILDXApplicationEvents5.SheetFrameBuilding

Treename: Shaft0.

2 code examples follow.

Example 1: Frame specific model changes

 ' from Samples/Src/LDXAPIExamples/Example_LDXSheetFrame.vb

 Shared m_previousCarMode As DigiPara.LDX.CarModes
 Shared m_previousCarZ0 As Double
 Shared m_SheetDevNameForCustomCarPosition As String = "CUSTOM_CAR_POSITION"

 Private Shared Sub LDXApp_SheetFrameBuildingForCustomCarPosition(ByVal frame As DigiPara.LDX.ILDXSheetFrame5, ByVal phase As DigiPara.LDX.SheetFrameBuildingPhase)
     ' the sheet frame building event allows us to do arbitrary modifications to the model that affect only specific frames.
     ' first, we test whether this frame is the one we want to change
     If (frame.DeveloperName = m_SheetDevNameForCustomCarPosition) Then
         ' prefetch some objects
         Dim ldDoc As DigiPara.LDX.LDXDocument = frame.Object.Document
         Dim ldCar As DigiPara.LDX.LDXCar = ldDoc.Shaft.Car

         If (phase = DigiPara.LDX.SheetFrameBuildingPhase.sfbpBefore) Then
             ' this phase is called BEFORE the sheet frame is built.
             ' we save the previous state of the variables we want to modify
             m_previousCarMode = ldCar.CarMode
             m_previousCarZ0 = ldCar.Z0
             ' then we do the modifications; here we put the car 1.5 m below the top floor, something not possible with the regular per-frame car position options
             ldCar.CarMode = ldCar.CarMode And Not DigiPara.LDX.CarModes.carmPositionMask
             ldCar.Z0 = ldDoc.Shaft.Room.Height - ldDoc.Shaft.Head - 1500
         ElseIf (phase = DigiPara.LDX.SheetFrameBuildingPhase.sfbpAfter) Then
             ' this phase is called AFTER the sheet frame was built. Here, we undo our changes.
             ldCar.CarMode = m_previousCarMode
             ldCar.Z0 = m_previousCarZ0
         End If

         ' for both phases, we need to call CalculateModel (recursively)
         ' the rcmCalc flag is required, the rcmSuppressVba flag is a generic optimization.
         ' the rcmQuickMode flag only makes changes to the car and counterweight related parts of the model; if you want to do more complex modifications to the model, you need to remove it.
         ldDoc.CalculateModel(DigiPara.LDX.CalculateModelModes.rcmCalc Or DigiPara.LDX.CalculateModelModes.rcmQuickMode Or DigiPara.LDX.CalculateModelModes.rcmSuppressVba)
     End If
 End Sub

 Shared m_sheetFrameBuildingEventHandlerRegistered As Boolean = False

 <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "Shaft0.", "_ILDXApplicationEvents5~SheetFrameBuilding", "Frame specific model changes")>
 Public Shared Sub SheetFrameBuildingEvent(ldxDocument As DigiPara.LDX.LDXDocument)

     ' just (de)register the event handler here
     If Not m_sheetFrameBuildingEventHandlerRegistered Then
         AddHandler ldxDocument.Application.SheetFrameBuilding, AddressOf LDXApp_SheetFrameBuildingForCustomCarPosition
         m_sheetFrameBuildingEventHandlerRegistered = True
     Else
         RemoveHandler ldxDocument.Application.SheetFrameBuilding, AddressOf LDXApp_SheetFrameBuildingForCustomCarPosition
         m_sheetFrameBuildingEventHandlerRegistered = False
     End If
 End Sub

Example 2: Dimensions based on visible objects

 ' from Samples/Src/LDXAPIExamples/Example_LDXSheetFrame.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "Shaft0.", "_ILDXApplicationEvents5~SheetFrameBuilding", "Dimensions based on visible objects")>
 Public Shared Sub SheetFrameBuildingEventForDimensions(ldxDocument As DigiPara.LDX.LDXDocument)

     ' just (de)register the event handler here
     If Not m_sheetFrameBuildingForDimensionsEventHandlerRegistered Then
         AddHandler ldxDocument.Application.SheetFrameBuilding, AddressOf LDXApp_SheetFrameBuildingForDimensions
         m_sheetFrameBuildingForDimensionsEventHandlerRegistered = True
     Else
         ClearDynamicDimensionOverwrites()
         RemoveHandler ldxDocument.Application.SheetFrameBuilding, AddressOf LDXApp_SheetFrameBuildingForDimensions
         m_sheetFrameBuildingForDimensionsEventHandlerRegistered = False
     End If

 End Sub