Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to upgrade the sub routine below to used the OrientedMinimumRangeBox Method on Each FaceShell of a Multi-FaceShell SurfaceBody:
Function BuildDescription(pDef As PartComponentDefinition, bIndex As Integer) As String
Dim Result As String = Nothing
Dim BoxCollection As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
Dim oSolid As SurfaceBody = pDef.SurfaceBodies.Item(bIndex)
If oSolid.FaceShells.Count > 1
Logger.Trace("Multi body: " & oSolid.FaceShells.Count & " only works with normal rangebox")
For Each fs As FaceShell In oSolid.FaceShells
If fs.IsVoid Then Continue For
Dim DeltaX, DeltaY, DeltaZ As Double
Dim fsBox As Box = fs.RangeBox
DeltaX = fsBox.MaxPoint.X - fsBox.MinPoint.X
DeltaY = fsBox.MaxPoint.Y - fsBox.MinPoint.Y
DeltaZ = fsBox.MaxPoint.Z - fsBox.MinPoint.Z
' Dim AddRoughString As String = FormulateString(DeltaX, DeltaY, DeltaZ)
' Result += AddRoughString
Next
Else If oSolid.FaceShells.Count = 1
Logger.Trace("Single")
BoxCollection.Add(oSolid.OrientedMinimumRangeBox)
End If
Logger.Trace("Collected: " & BoxCollection.Count)
' For Each ItemRangeBox As OrientedBox In BoxCollection
' Dim AddString As String = FormulateString(ItemRangeBox.DirectionOne.Length, ItemRangeBox.DirectionTwo.Length, ItemRangeBox.DirectionThree.Length)
' Result += AddString
' Next
Return Result
End Function
Don't worry about the commented out lines, they work and don't need to be tested. I just want all the FaceShells to put an OrientedMinimumRangeBox Into the BoxCollection to be processed at the bottom.
Current workflow up to this point:
- user selects ComponentOccurrence From Main Assembly
- user selects a SurfaceBody from List
- The above Function is called with ComponentDefinition and Index of SurfaceBody
I have tried several processes that all failed, so I'm reaching out for help.
Solved! Go to Solution.