RangeBox includes WorkPlane, WorkAxis and Center of Gravity

<?xml encoding=”UTF-8″>By Adam Nagy

By design the RangeBox of ComponentDefinition includes everything that the ComponentDefinition has. This also means the WorkPlane/WorkAxis objects, the ones owned by the Center of Gravity object too.

If you are only interested in the solid geometry then you could check the extents of the surface bodies as done by this VBA code:

Sub GetExtents()
Dim doc As Document
Set doc = ThisApplication.ActiveDocument
Dim cd As ComponentDefinition
Set cd = doc.ComponentDefinition
Dim ext As Box
Dim sb As SurfaceBody
For Each sb In cd.SurfaceBodies
If ext Is Nothing Then
Set ext = sb.RangeBox.Copy
Else
ext.Extend sb.RangeBox.MinPoint
ext.Extend sb.RangeBox.MaxPoint
End If
Next
MsgBox "Extensions are: " + vbCr + _
"X " + CStr(ext.MaxPoint.x - ext.MinPoint.x) + vbCr + _
"Y " + CStr(ext.MaxPoint.y - ext.MinPoint.y) + vbCr + _
"Z " + CStr(ext.MaxPoint.Z - ext.MinPoint.Z)
End Sub

Comments

One response to “RangeBox includes WorkPlane, WorkAxis and Center of Gravity”

  1. vilas jadhav Avatar
    vilas jadhav

    Dear sir,
    How to draw the bounding box in Inventor solid part (same as in autocad)using api and generate the 3d part from that bounding box.
    plz help me for this.
    thanks
    vilas jadhav
    9717409993
    jadhav_vilas84@yahoo.com

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading