Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Assembly X, Y Z rangebox

1 REPLY 1
SOLVED
Reply
Message 1 of 2
NachitoMax
1336 Views, 1 Reply

Assembly X, Y Z rangebox

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

EESignature


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.


1 REPLY 1
Message 2 of 2
ekinsb
in reply to: NachitoMax

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.

 

 

 

 


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report