DigiPara Liftdesigner LDX API
Loading...
Searching...
No Matches
Left align bank 2 shafts and change their DX and DY offset

API method: ILDXShafts.SHAFTS_MODE

2 code examples follow.

Example 1: Left align bank 2 shafts and change their DX and DY offset

 ' from Samples/Src/LDXAPIExamples/Example_GroupsConfiguration.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "", "LDXShafts~SHAFTS_MODE", "Left align bank 2 shafts and change their DX and DY offset")>
    Public Shared Sub LeftAlignBank2ShaftsAndChangeTheirDXAndDYOffset(ByRef ldxDocument As DigiPara.LDX.LDXDocument)

        If ldxDocument.Shafts Is Nothing Then
            MsgBox("No shafts found")
            Return
        End If

        ' Align left
        ldxDocument.Shafts.SHAFTS_MODE = DigiPara.LDX.ShaftsModes.slmNone
        ldxDocument.Shafts.SHAFTS_MODE = ldxDocument.Shafts.SHAFTS_MODE Or DigiPara.LDX.ShaftsModes.slmBankAlignmentLeft
        ' Sideways offset
        ldxDocument.Shafts.BANK_DX = 400
        ' Distance between the two banks
        ldxDocument.Shafts.BANK_DY = 5500

    End Sub

Example 2: Shared machine room

 ' from Samples/Src/LDXAPIExamples/Example_LDXMachineRoom.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "Shaft0.MachineryRoom.", "LDXShafts~SHAFTS_MODE", "Shared machine room")>
 Public Shared Sub MergeMachineRooms(ByRef ldxDocument As DigiPara.LDX.LDXDocument)

     If ldxDocument.GetLDXObject("Shaft0.MachineryRoom.") Is Nothing Then
         MsgBox("Machine room not found! Please reload the relevant .ld3 file!")
         Exit Sub
     End If

     If ldxDocument.Shafts.Count < 2 Then
         ldxDocument.Shaft.Object.CloneMe()
         ldxDocument.CalculateModel(DigiPara.LDX.CalculateModelModes.rcmCalc)
     End If

     ' make at least one machine room view
     Dim sheet = ldxDocument.Sheets.ActiveSheet
     Dim found As Boolean = False
     Dim toTransform As DigiPara.LDX.LDXSheetFrame = Nothing
     For Each frame As DigiPara.LDX.LDXSheetFrame In sheet
         If frame.ViewType = DigiPara.LDX.SheetFrameViewType.shfvtMachineryRoom Then
             found = True
             frame.Activate()
             Exit For
         ElseIf frame.ViewType = DigiPara.LDX.SheetFrameViewType.shfvtPlan Then
             toTransform = frame
         End If
     Next
     If Not found Then
         If toTransform Is Nothing Then
             toTransform = sheet.Add(DigiPara.LDX.SheetAddOptions.saoCalculateDefaultPlacement)
         End If
         toTransform.Reset(DigiPara.LDX.SheetFrameViewType.shfvtMachineryRoom, DigiPara.LDX.SheetFrameViewDirections.shfvdToFromTop, DigiPara.LDX.SheetFrameResetOptions.shfrrstInitText)
         toTransform.Activate()
     End If

     With ldxDocument.Shafts
         If (.SHAFTS_MODE And DigiPara.LDX.ShaftsModes.slmSharedMachineRoom) <> DigiPara.LDX.ShaftsModes.slmSharedMachineRoom Then
             ' merge machine rooms
             .SHAFTS_MODE = .SHAFTS_MODE Or DigiPara.LDX.ShaftsModes.slmSharedMachineRoom

             ' The UI code also activates the sharing flag on all shafts individually, but that is not really required
             ' For Each shaft As DigiPara.LDX.LDXShaft In ldxDocument.Shafts
             ' shaft.MachineRoom.Merge(shaft.Comp.SX > 0)
             ' Next
         Else
             ' deactivate shared machine rooms
             .SHAFTS_MODE = .SHAFTS_MODE And Not DigiPara.LDX.ShaftsModes.slmSharedMachineRoom
             ' recalculate machine rooms to make them small again (Just for demo purpsoes, result is likely wrong)
             For Each shaft As DigiPara.LDX.LDXShaft In ldxDocument.Shafts
                 ' also from the UI code
                 ' shaft.MachineRoom.Merge(False)
                 shaft.MachineRoom.Room.DEPTH = shaft.Room.DEPTH
                 shaft.MachineRoom.Room.Width = shaft.Room.Width
                 shaft.MachineRoom.Room.X0 = 0
                 shaft.MachineRoom.Room.Y0 = 0
             Next
         End If
     End With

 End Sub