- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone.
I'm trying to delete canvases via API and I get quite a weird thing. The script seems to delete the canvases, and they are deleted from the occurrence indeed, but somehow, they remain in the timeline and don't look to be belonging to any component.
The canvases before executing the script:
After the execution:
Is there something I'm doing wrong or is this a bug?
Here I leave the code to reproduce the issue and the .f3d file with the canvases before the execution of the script.
import adsk.core, adsk.fusion, adsk.cam, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
product = app.activeProduct
design = adsk.fusion.Design.cast(product)
rootComp = design.rootComponent
deleteList:list[adsk.fusion.Canvas] = []
for occ in rootComp.allOccurrences:
component = occ.component
for canvas in component.canvases:
deleteList.append(canvas)
for canvas in deleteList:
canvas.deleteMe()
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Solved! Go to Solution.