|
DigiPara Liftdesigner LDX API
|
API method: ILDXVentilationWindow5.VTW_MODE
Treename: Shaft0.MachineryRoom.VentilationWindow.
5 code examples follow.
' from Samples/Src/LDXAPIExamples/Example_LDXVentilationWindow.vb
<APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "Shaft0.MachineryRoom.VentilationWindow.", "LDXVentilationWindow~VTW_MODE", "Toggle ventilation window cover")>
Public Shared Sub ToggleCover(ByRef ldxDocument As DigiPara.LDX.LDXDocument)
If ldxDocument.GetLDXObject("Shaft0.MachineryRoom.VentilationWindow.") Is Nothing Then
MsgBox("Desired ventilation window not found. Please reload the relevant .ld3 file.")
Exit Sub
End If
Prepare(ldxDocument)
Dim ventilationWindow As DigiPara.LDX.LDXVentilationWindow = ldxDocument.Shafts(0).MachineRoom.Room.VentilationWindow
With ventilationWindow
' turn cover on and off
.VTW_MODE = .VTW_MODE Xor DigiPara.LDX.VentilationWindowModes.vwmHasCover
End With
End Sub
' from Samples/Src/LDXAPIExamples/Example_LDXVentilationWindow.vb
<APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "Shaft0.MachineryRoom.VentilationWindow.", "LDXVentilationWindow~VTW_MODE", "Change ventilation window X position mode")>
Public Shared Sub ToggleXRelative(ByRef ldxDocument As DigiPara.LDX.LDXDocument)
If ldxDocument.GetLDXObject("Shaft0.MachineryRoom.VentilationWindow.") Is Nothing Then
MsgBox("Desired ventilation window not found. Please reload the relevant .ld3 file.")
Exit Sub
End If
Prepare(ldxDocument)
Dim ventilationWindow As DigiPara.LDX.LDXVentilationWindow = ldxDocument.Shafts(0).MachineRoom.Room.VentilationWindow
With ventilationWindow
' store old position, the mode switch already changes X0 to keep the component where it was
Dim X0Before = .X0
' switch wall reference side
.VTW_MODE = .VTW_MODE Xor DigiPara.LDX.VentilationWindowModes.vwmWallOriginIsXMax
' since X logically still goes into the same direction
.X0 = -X0Before
End With
End Sub
' from Samples/Src/LDXAPIExamples/Example_LDXVentilationWindow.vb
<APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "Shaft0.MachineryRoom.VentilationWindow.", "LDXVentilationWindow~VTW_MODE", "Change ventilation window Z position mode")>
Public Shared Sub ToggleZRelative(ByRef ldxDocument As DigiPara.LDX.LDXDocument)
If ldxDocument.GetLDXObject("Shaft0.MachineryRoom.VentilationWindow.") Is Nothing Then
MsgBox("Desired ventilation window not found. Please reload the relevant .ld3 file.")
Exit Sub
End If
Prepare(ldxDocument)
Dim ventilationWindow As DigiPara.LDX.LDXVentilationWindow = ldxDocument.Shafts(0).MachineRoom.Room.VentilationWindow
Dim roomHeight = ldxDocument.Shafts(0).MachineRoom.Room.Height
With ventilationWindow
' store old position, the mode switch already changes X0 to keep the component where it was
Dim Z0Before = .Z0
' switch wall reference side
.VTW_MODE = .VTW_MODE Xor DigiPara.LDX.VentilationWindowModes.vwmWallOriginIsZMax
' since Z logically still goes into the same direction, we need to flip it
.Z0 = -Z0Before
End With
End Sub
' from Samples/Src/LDXAPIExamples/Example_LDXVentilationWindow.vb
<APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "Shaft0.MachineryRoom.VentilationWindow.", "LDXVentilationWindow~VTW_MODE", "Change ventilation window size")>
Public Shared Sub ChangeSize(ByRef ldxDocument As DigiPara.LDX.LDXDocument)
If ldxDocument.GetLDXObject("Shaft0.MachineryRoom.VentilationWindow.") Is Nothing Then
MsgBox("Desired ventilation window not found. Please reload the relevant .ld3 file.")
Exit Sub
End If
Prepare(ldxDocument)
Dim ventilationWindow As DigiPara.LDX.LDXVentilationWindow = ldxDocument.Shafts(0).MachineRoom.Room.VentilationWindow
With ventilationWindow
If .VTW_DX < 400 Then
' make it bigger
.VTW_DX *= 2
.VTW_DY *= 2
' make subcomponents bigger, too
.Comp.Holes(0).DX *= 2
.Comp.Holes(0).DZ *= 2
.VTW_BASE_DX *= 2
.VTW_BASE_DZ *= 2
.VTW_COVER_DX1 *= 2
.VTW_COVER_DX2 *= 2
.VTW_COVER_DZ1 *= 2
.VTW_COVER_DZ2 *= 2
Else
' make it smaller
.VTW_DX *= 0.5
.VTW_DY *= 0.5
' make subcomponents smaller, too
.Comp.Holes(0).DX *= 0.5
.Comp.Holes(0).DZ *= 0.5
.VTW_BASE_DX *= 0.5
.VTW_BASE_DZ *= 0.5
.VTW_COVER_DX1 *= 0.5
.VTW_COVER_DX2 *= 0.5
.VTW_COVER_DZ1 *= 0.5
.VTW_COVER_DZ2 *= 0.5
End If
End With
End Sub
' from Samples/Src/LDXAPIExamples/Example_LDXVentilationWindow.vb
<APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "Shaft0.MachineryRoom.VentilationWindow.", "LDXVentilationWindow~VTW_MODE", "Change ventilation window legacy positioning mode")>
Public Shared Sub LegacyPositioning(ByRef ldxDocument As DigiPara.LDX.LDXDocument)
If ldxDocument.GetLDXObject("Shaft0.MachineryRoom.VentilationWindow.") Is Nothing Then
MsgBox("Desired ventilation window not found. Please reload the relevant .ld3 file.")
Exit Sub
End If
Prepare(ldxDocument)
Dim ventilationWindow As DigiPara.LDX.LDXVentilationWindow = ldxDocument.Shafts(0).MachineRoom.Room.VentilationWindow
With ventilationWindow
If DigiPara.LDX.VentilationWindowModes.vwmNone <> (.VTW_MODE And DigiPara.LDX.VentilationWindowModes.vwmHoleFollowsComponent) Then
' Activate the old behavior that the hole determines the positioning
.VTW_MODE = .VTW_MODE And Not DigiPara.LDX.VentilationWindowModes.vwmHoleFollowsComponent
' like so
With .Comp.Holes(0)
.X0 = 800
End With
'(simply using .X0 would also work here and set Hole0.X0 appropriately)
' rotations are possible, but only make sense in 90 degree increments, because we cannot rotate the hole here
.Comp.AlphaRad = Math.PI * 0.5
Else
' Activate the new behavior that the ventilation window controls its own position
.VTW_MODE = .VTW_MODE Or DigiPara.LDX.VentilationWindowModes.vwmHoleFollowsComponent
' like so
If DigiPara.LDX.VentilationWindowModes.vwmNone <> (.VTW_MODE And DigiPara.LDX.VentilationWindowModes.vwmWallOriginIsXMax) Then
.X0 = -500
Else
.X0 = 500
End If
' in that mode, we can freely rotate the component
.Comp.AlphaRad = Math.PI * 0.25
End If
End With
End Sub