Hi
in the same way that it is possible to get the X, Y, Y sizes of a part using rangebox, is it possible to get the same for an Assembly? i dont need to draw a box on screen or anything, i just need to return the overall height, width & depth of the assembly into a numerical format.
Any help appreciated
Thanks
Nigel
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Solved! Go to Solution.
Solved by ekinsb. Go to Solution.
The ComponentOccurrence object which represents a part or subassembly within an assembly supports the RangeBox property. This will allow you to get the range box for various components or an entire subassembly. If you want the range box for the entire assembly you can use the RangeBox property of the AssemblyComponentDefinition object. The sample code below demonstrates getting the range for the entire assembly.
Public Sub GetAssemblyRange() Dim asmDoc As AssemblyDocument Set asmDoc = ThisApplication.ActiveDocument Dim totalRange As Box Set totalRange = asmDoc.ComponentDefinition.RangeBox Dim xSize As String Dim ySize As String Dim zSize As String xSize = asmDoc.UnitsOfMeasure.GetStringFromValue(totalRange.MaxPoint.X - totalRange.MinPoint.X, kDefaultDisplayLengthUnits) ySize = asmDoc.UnitsOfMeasure.GetStringFromValue(totalRange.MaxPoint.Y - totalRange.MinPoint.Y, kDefaultDisplayLengthUnits) zSize = asmDoc.UnitsOfMeasure.GetStringFromValue(totalRange.MaxPoint.Z - totalRange.MinPoint.Z, kDefaultDisplayLengthUnits) MsgBox ("Assembly size: " & xSize & " x " & ySize & " x " & zSize) End Sub
It's important to remember that the range box is always oriented with respect to the world coordinate system and is not guaranteed to tightly fit the model. This is especially true in an assembly where parts can be repositioned and rotated within the assembly. What is guaranteed is that the entire assembly will be within the returned range box.
Can't find what you're looking for? Ask the community or share your knowledge.