Creating construction planes from BoundingBox3D

Creating construction planes from BoundingBox3D

DerekZCXVY
Contributor Contributor
484 Views
2 Replies
Message 1 of 3

Creating construction planes from BoundingBox3D

DerekZCXVY
Contributor
Contributor

Hows it going guys,

 

I was wondering if someone could point me in the right direction as to how I would create construction planes around a brep that once was a mesh. I say that last part because the geometry I am dealing with has no flat edges, its almost like a deformed ball that got stepped on. Anyways I want to crate construction planes around this brep for CAM purposes down the line. Setting up planes by hand is time consuming. After looking at the object model I noticed that there is a BoundingBox3D object. This object returns the min and max points of the bounding box. I am not sure I understand what exactly that means. How can two points represent a 3D space?

 

My thought process was to create a bounding box around the brep, then generate a series of construction points representing the corners of the bounding box, then using those points to create construction planes on all six sides of the box. Right now I can target the brep and create a bounding box based off that brep. My next step was to create a construction point of the min and max values of the bounding box just to visualize whats going on. But when I do this I get RuntimeError: 3 : Environment is not supported. Here is my code so far. Let me know if I am on the right track or if there is a better way to go about this conceptually.

 

Thanks again !

 

All the best

 

import adsk.core, adsk.fusion, adsk.cam, traceback

app = adsk.core.Application.get()

ui = app.userInterface

design = app.activeProduct

rootComp = design.rootComponent

sketches = rootComp.sketches

features = rootComp.features


ui.messageBox(str(rootComp.bRepBodies.count))


bRpe_1 = rootComp.bRepBodies.itemByName("R Shell")

ui.messageBox(str(bRpe_1.area))


bb_1 = bRpe_1.boundingBox

bb_1_maxP = bb_1.maxPoint

bb_1_minP = bb_1.minPoint

ui.messageBox(str(bb_1_minP))

constructionPoints = rootComp.constructionPoints

pointInput = constructionPoints.createInput()

pointInput.setByPoint(bb_1_maxP)

constructionPoints.add(pointInput)

 

0 Likes
485 Views
2 Replies
Replies (2)
Message 2 of 3

BrianEkins
Mentor
Mentor

If you read the documentation for the setByPoint method you'll see that you can only use a Point3D object in the case where the design is not parametric.  You can change a design to not be parametric by right-clicking on the top node of the browser and choosing the "do not capture design history" option at the bottom of the context menu.

 

The reason the Box3D object can define a box using two points is the box is assumed to be oriented such that the sides of the box are parallel to the X-Y, X-Z, and Y-Z planes of the model.  Having the min and max points of this box is enough to fully define its size and position.  Fusion also has the OrientedBoundingBox3D that defines a box in any orientation but this is only used in certain cases.

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

DerekZCXVY
Contributor
Contributor

@BrianEkinsIts great to hear from you ! I see what you are saying regarding the bounding box. Thanks for the feedback, Ill work on it some more today. 

0 Likes