I need a new way to measure the limits of assembly, because when I use rangebox I find a problem, the Inventor calculates the box for parts, thus creating maximum and minimum values of the different correct.
The limit X=499mm
With Rangebox (similar checkdesign) The limit X = 533,32mm
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.
The component definition object owns the model, sketches, work geometry, etc. So all of those should to be part of the range box returned.
If this is your case then you can get a range box from a SurfaceBody object. If there’s more than one body you may need to get the range from each one and then combine them.
Similar problem was discussed here:
Hi Vladimir,
Follow example attached.
I already use this feature to disable the work features, follow the macro.iLogic.
In my case, is assembly with parts and some parts are positioned in angles creating box.
Dim odoc As AssemblyDocument odoc = ThisApplication.ActiveDocument 'Get the All Workfeatures" command Dim oCtrlDef As ButtonDefinition oCtrlDef = ThisApplication.CommandManager.ControlDefinitions.Item("AppAllWorkfeaturesCmd") If oCtrlDef.PRESSED Then oCtrlDef.Execute End If Dim vX, vXmax, vXmin As Double vXmax = odoc.ComponentDefinition.RangeBox.MaxPoint.X vXmin = odoc.ComponentDefinition.RangeBox.MinPoint.X vX = vXmax - vXmin vX2 = FormatNumber( vX*10, 2,0,-1,0) Dim vY, vYmax, vYmin As Double vYmax = odoc.ComponentDefinition.RangeBox.MaxPoint.Y vYmin = odoc.ComponentDefinition.RangeBox.MinPoint.Y vY = vYmax - vYmin vY2 = FormatNumber( vY*10, 2,0,-1,0) Dim vZ, vZmax, vZmin As Double vZmax = odoc.ComponentDefinition.RangeBox.MaxPoint.Z vZmin = odoc.ComponentDefinition.RangeBox.MinPoint.Z vZ = vZmax - vZmin vZ2 = FormatNumber( vZ*10, 2,0,-1,0) iProperties.Value("Custom", "DIMENSÃO X") = vX2 iProperties.Value("Custom", "DIMENSÃO Y") = vY2 iProperties.Value("Custom", "DIMENSÃO Z") = vZ2
Thanks for all.
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.
Hi Cristiano,
Thank you for the uploaded model, it helped to clarify the problem.
The range box is not always a tight fitting box. It's always axis aligned with the document axes system you're working in. The intent of the range box is to provide an easily calculated box that contains the object in question. This box can then be used as part of a pre-sorting algorithm to find or reject objects that cross a particular boundary. It's not intended to always tightly enclose an object. A reasonably tight fitting bounding box is computed for the part aligned with the part's coordinate system and cached in the part.
An occurrence bounding box takes this part box (not the part geometry), transforms it into the assembly space, and then fits a new box aligned with the assembly coordinates. If there is a non-orthogonal rotation between part and assembly space, the assembly box will be larger than the box in part space to fit around it. This is an optimization in order to avoid re-computing the part geometry bound in arbitrary assembly contexts.
The following picture demonstrates range boxes for the different occurrences of the same part model “10007.ipt”.
Returning the optimal (aligned to principle geometry axis) or necessarily tight fitting bounds, is not a requirement for this API, but to return a reasonable bounding box that is only guaranteed to completely contain the geometry. If you want an assembly’s tight fitting box you may calculate min and max points from existing surface facets. This will always give tight bounding box in assembly and part context irrespective of shape. Method directly works with the surface bodies and does not depend on work geometry visibility, sketches, etc.
Philippe Leefsma published the detailed blog article with the sample code that demonstrates this approach. HIs code uses the client graphics to draw a range box that tightly encloses the part component.
http://adndevblog.typepad.com/manufacturing/2012/06/creating-accurate-rangebox-for-component.html
Here is the "correct" range box for the component “10007.ipt:6” in your model:
Having “correct” range boxes for every component you may combine them to get the overall assembly range box.
Not easy but should work.
Hope this helps.
Cheers,
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.