Message 1 of 2
Reproducible crash when adding attribute to face in direct edit mode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The below script seems like it should be fine, but it causes fusion 360 to hang for a couple of seconds and then crash.
import adsk.core import adsk.fusion import traceback app = adsk.core.Application.get() root = adsk.core.Application.get().activeProduct.rootComponent def _create_component(parent_component, *bodies, name): new_occurrence = parent_component.occurrences.addNewComponent(adsk.core.Matrix3D.create()) new_occurrence.component.name = name for body in bodies: new_occurrence.component.bRepBodies.add(body) return new_occurrence def box(x, y, z, *, name="Box") -> adsk.fusion.Occurrence: box_body = adsk.fusion.TemporaryBRepManager.get().createBox(adsk.core.OrientedBoundingBox3D.create( adsk.core.Point3D.create(x/2, y/2, z/2), adsk.core.Vector3D.create(1, 0, 0), adsk.core.Vector3D.create(0, 1, 0), x, y, z)) occurrence = _create_component(root, box_body, name=name) return occurrence def run(context): try: app.activeProduct.designType = adsk.fusion.DesignTypes.DirectDesignType first = box(1, 1, 1, name="first") first.bRepBodies[0].faces[0].attributes.add("namespace", "name", "value") except: traceback.print_exc()
The crash occurs at the last line of run(), where it tries to add an attribute to a face. The crash doesn't happen in parametric mode (with _create_component using a base feature to add the body to the new component, of course).