Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Please follow the following steps:
- Create a sphere
- Run the following code
- Select the Sphere created in step 1
import adsk.core, adsk.fusion, traceback def run(context): ui = None try: app = adsk.core.Application.get() ui = app.userInterface des = adsk.fusion.Design.cast(app.activeProduct) bodySelect = ui.selectEntity('Select the body.', 'Bodies') body = adsk.fusion.BRepBody.cast(bodySelect.entity) component = body.parentComponent occurrences = component.occurrences occurrence = occurrences.addNewComponent(adsk.core.Matrix3D.create()) #baseFeatures = occurrence.component.features.baseFeatures baseFeatures = component.features.baseFeatures baseFeature = baseFeatures.add() baseFeature.startEdit() body.copyToComponent(occurrence) baseFeature.finishEdit() body.deleteMe() except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
The result which is shown in the attached picture will be a sphere residing inside a component, but actually the sphere will be inside a base feature of the parent of the component. So the sphere will not be shown in the browser and it will not be selectable as a BRepBody for commands that need a BRepBody (like Split Body command).
My question is: Is it by design or Fusion 360 API should not allow such a situation to occur?
It is obvious that uncommenting line 18 and deleting line 19 will solve the problem.
Website: https://perceptino.com
Solved! Go to Solution.