Message 1 of 5
[Bug] MeasureManager and new component
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I can't use the measure manager between geometries inside a component.
The code below works only if the createNewComponent variable is set to False. If not, it returns this error:
import adsk.core, adsk.fusion, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
doc = app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)
product = app.activeProduct
design = adsk.fusion.Design.cast(product)
createNewComponent = False
if not createNewComponent:
parentComp = design.rootComponent
else:
rootComp = design.rootComponent
occ = rootComp.occurrences.addNewComponent(adsk.core.Matrix3D.create())
parentComp = occ.component
baseFeats = parentComp.features.baseFeatures
baseFeat = baseFeats.add()
baseFeat.startEdit()
pointInput = parentComp.constructionPoints.createInput()
pointInput.setByPoint(adsk.core.Point3D.create(0.0, 0.0, 0.0))
point1 = parentComp.constructionPoints.add(pointInput)
pointInput.setByPoint(adsk.core.Point3D.create(1.0, 0.0, 0.0))
point2 = parentComp.constructionPoints.add(pointInput)
baseFeat.finishEdit()
measure = app.measureManager.measureMinimumDistance(point1, point2)
ui.messageBox('Distance: {} cm'.format(measure.value))
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Thank you.
Jérôme Briot, Freelance engineer - Mechanical design and prototyping
3D Print Plus / Pro | IDF Import | GitHub To Fusion 360 | Tube Bending Data Exchanger | Slice Data Export
Memory Used | Basic Calculator | Check Computer Specifications | Import spline from any CSV file