Message 1 of 5
Non-minimum Profile.boundingBox. Is it a bug?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
My assumption in using Profile.boundingBox has always been that it returns a minimum bounding box. But in practice I have encountered some cases that Profile.boundingBox returns a non-minimum bounding box. Is it a bug or it is by design?
For example as shown in the following sample for two intersecting circles, Profile.boundingBox returns a minimum bounding box for the middle profile (shared area of the circles), but returns a non-minimum bounding box for the other two profiles.
import adsk.core, adsk.fusion, traceback
ui = None
def run(context):
try:
global ui
app = adsk.core.Application.get()
ui = app.userInterface
design = adsk.fusion.Design.cast(app.activeProduct)
rootComp = design.rootComponent
sketches = rootComp.sketches
sketch = sketches.add(rootComp.xZConstructionPlane)
sketchCircles = sketch.sketchCurves.sketchCircles
centerPoint = adsk.core.Point3D.create(0, 0, 0)
sketchCircles.addByCenterRadius(centerPoint, 10.0)
centerPoint = adsk.core.Point3D.create(10, 0, 0)
sketchCircles.addByCenterRadius(centerPoint, 10.0)
boundingBoxesSketch = sketches.add(rootComp.xZConstructionPlane)
for profile in sketch.profiles:
boundingBoxesSketch.sketchCurves.sketchLines.addTwoPointRectangle(profile.boundingBox.minPoint, profile.boundingBox.maxPoint)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Website: https://perceptino.com