Location of a Box Feature

Location of a Box Feature

Anonymous
Not applicable
615 Views
4 Replies
Message 1 of 5

Location of a Box Feature

Anonymous
Not applicable

I'm trying to find the location of a boxFeature (i.e. the min vertex of the box) so that I can interpret its location relative to the component's origin.

 

This is trivial if its a new box floating in space, just iterate over the vertices or use the BoundingBox3D of the resulting bRep.

 

But what if it was joined onto another body (or cut). I can't seem to find a way to determine the location of a box after it has been created.

I would like to do this with all of the primitive shapes, so I think I will have a similar problme with spheres and cylinders. 

0 Likes
Accepted solutions (1)
616 Views
4 Replies
Replies (4)
Message 2 of 5

goyals
Autodesk
Autodesk

May be you can get the box feature from the timeline object and get the corresponding BRepBody and then use the bounding box of BRepBody to get the minimum point .

 

app= adsk.core.Application.get()

fusionDesign = app.fusion.Design.cast(app.activeProduct)

timeLine = fusionDesign.timeLine

//get the timeline object corresponding to box feature from timeline passing its index

timeLineObject = timeLine.item(index)

entity = timeLineObject.entity

boxFeature = ads.fusion.BoxFeature.cast(entity)

 



Shyam Goyal
Sr. Software Dev. Manager
0 Likes
Message 3 of 5

Anonymous
Not applicable

This only works if the box created a unique body. But if it joined or cut from another body, the bounding box will be for the body it joined or cut from, which is not what I want. 

0 Likes
Message 4 of 5

BrianEkins
Mentor
Mentor
Accepted solution

None of the primitives exist as independent bodies unless you create a new body or component when creating the primitive. Otherwise, they're like creating other features, like a extruded, and modify an existing body.

 

You might be able to get what you want by getting the Box feature and then getting the faces from it. These will be the faces the the Box feature added to the body.  You can get the bounding box of each face and then combine them to get the overall box.  That should work with all the primitive types.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes
Message 5 of 5

Anonymous
Not applicable

This is a clunky fix but it works. I still think its strange that the plane and origin of the box is not accessible from the Box Feature. I would think this is saved somewhere and just not made accessible through the API. Otherwise, how can the dimmensions of the box feature drive changes if they are not relative to an origin point?

0 Likes