|
DigiPara Liftdesigner LDX API
|
Treename: Shaft0.MachineryRoom.
' from Samples/Src/LDXAPIExamples/Example_LDXMachineRoom.vb
' positions a child hole directly over its parent hole, extending to the left, right, top, bottom and sticking out to the inside of the wall
Private Shared Sub PositionChildHole(parentHole As DigiPara.LDX.LDXHole, childHole As DigiPara.LDX.LDXHole, dx As Double, dy As Double, dz As Double)
With childHole
' position completely relative to parent component
.HoleMode = .HoleMode Or DigiPara.LDX.HoleModes.hmPosiByDim Or DigiPara.LDX.HoleModes.hmAdditionalHole Or DigiPara.LDX.HoleModes.hmNoRoomCheck Or DigiPara.LDX.HoleModes.hmOmitSizeCheck
.PrimaryAxisMode = DigiPara.LDX.MixedAxisModes.mamY Or DigiPara.LDX.MixedAxisModes.mamSourceParent
.SecondaryAxisMode = DigiPara.LDX.MixedAxisModes.mamZ Or DigiPara.LDX.MixedAxisModes.mamSourceParent
.TertiaryAxisMode = DigiPara.LDX.MixedAxisModes.mamX Or DigiPara.LDX.MixedAxisModes.mamSourceParent
' not linked to any wall
.Comp.Wall = 0
' transfer dimensions and set (potentially unused) coordinates
.X0 = 0
.Z0 = 0
If parentHole.HoleMode And DigiPara.LDX.HoleModes.hmRelatedToMachineRoom AndAlso Not parentHole.Object.TreeName.Contains(".MachineryToom.") Then
' for machine room related holes that are not actually in the machine room (so, the shaft ceiling?) we should probably reverse the extrusion direction
.Y0 = -dy / 2
Else
' normally, positive y means inside
.Y0 = dy / 2
End If
.DX = parentHole.DX + dx
.DY = parentHole.DY + dy
.DZ = parentHole.DZ + dz
.Object.Active = True
End With
End Sub
' reinforces a hole with a segment protuding into the inside of its room
Private Shared Function ReinforceHole(hole As DigiPara.LDX.LDXHole) As DigiPara.LDX.LDXWallSegment
Try
' make machine room/shaft hole weak; without that, the hole would eat away all our work
Dim shaft = hole.Object.Document.Shafts(hole.Comp.SX)
If Not shaft Is Nothing Then
If hole.HoleMode And DigiPara.LDX.HoleModes.hmRelatedToMachineRoom OrElse hole.Object.TreeName.Contains(".MachineryRoom.") Then
Dim mrHole As DigiPara.LDX.LDXHole = shaft.MachineRoom.Comp.Holes(0)
mrHole.HoleMode = mrHole.HoleMode Or DigiPara.LDX.HoleModes.hmWeak
Else
Dim shaftHole As DigiPara.LDX.LDXHole = shaft.Comp.Holes(0)
shaftHole.HoleMode = shaftHole.HoleMode Or DigiPara.LDX.HoleModes.hmWeak
End If
End If
' add/find the wall segment adding the concrete block
Dim prefix As String = "REINFORCEMENT_SEGMENT."
Dim parentConcretes As DigiPara.LDX.LDXWallSegments = hole.Comp.WallSegments
Dim segment As DigiPara.LDX.LDXWallSegment = parentConcretes.PeekByObjectPrefix(prefix)
If segment Is Nothing Then
segment = parentConcretes.Add()
segment.Hole.CustomObjectPrefix = prefix
End If
PositionChildHole(hole, segment.Hole, 50, 50, 50)
segment.ALTERNATIVE_MATERIAL = DigiPara.LDX.ShaftMaterial.smConcrete
segment.WallSegmentMode = DigiPara.LDX.WallSegmentModes.wsmHatchX Or DigiPara.LDX.WallSegmentModes.wsmHatchY Or DigiPara.LDX.WallSegmentModes.wsmFill
segment.WallSegmentMode = segment.WallSegmentMode Or DigiPara.LDX.WallSegmentModes.wsmHatchIsFake
' add/find the hole cutting through the wall segment
prefix = "REINFORCEMENT_HOLE."
Dim parentHoles As DigiPara.LDX.LDXHoles = hole.Comp.Holes
Dim extraHole As DigiPara.LDX.LDXHole = parentHoles.PeekByObjectPrefix(prefix)
If extraHole Is Nothing Then
extraHole = parentHoles.Add()
extraHole.CustomObjectPrefix = prefix
End If
PositionChildHole(hole, extraHole, 0, 100, 0)
Return segment
Catch ex As Exception
Debug.Assert(False, ex.Message)
Return Nothing
End Try
End Function
<APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "Shaft0.MachineryRoom.", "LDXHole~Example_Reinforce", "Reinforce a Hole")>
Public Shared Sub HoleSegments(ByRef ldxDocument As DigiPara.LDX.LDXDocument)
' use the selected hole
Dim selection = ldxDocument.Sheets.ActiveSheet?.ActiveSheetFrame?.SelectedObjects
If Not selection Is Nothing AndAlso selection.Count > 0 Then
Dim selObj = selection(0)
If selObj.ObjectId = DigiPara.LDX.ObjectId.idHole Then
Dim hole As DigiPara.LDX.LDXHole = selObj.LDXType
If Not hole Is Nothing Then
ReinforceHole(hole)
Return
End If
End If
End If
' pick a random old hole
Dim shaft As DigiPara.LDX.LDXShaft = ldxDocument.Shafts.ActiveShaft
ReinforceHole(shaft.Gear.Comp.Holes(0))
End Sub