Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

timeline.rollTo fails on Extrude feature

1 REPLY 1
SOLVED
Reply
Message 1 of 2
siliconlad
66 Views, 1 Reply

timeline.rollTo fails on Extrude feature

I have an Extrude and I would like to call the `timeline.rollTo(true)` method on it, but it seems to fail with the following error:

 

 

 ===== Error =====
 CommandCreatedEventHandler
Traceback (most recent call last):
  File "C:\Users/angus/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/AddIns/cadify-fusion\lib\fusion360utils\event_utils.py", line 79, in notify
    callback(args)
  File "C:\Users/angus/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/AddIns/cadify-fusion\commands\dim\entry.py", line 119, in command_created
    for f_name, dims in extract_dims(occurrence):
  File "C:\Users/angus/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/AddIns/cadify-fusion\commands\dim\extract.py", line 22, in extract_dims
    feature.timelineObject.rollTo(True)
  File "C:\Users/angus/AppData/Local/Autodesk/webdeploy/production/99249ee497b13684a43f5bacd5f1f09974049c6b/Api/Python/packages\adsk\fusion.py", line 50063, in rollTo
    return _fusion.TimelineObject_rollTo(self, rollBefore)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: 3 : Associated feature is invalid.

 

 

The snippet of code for it is as follows:

 

 

for feature in occ.component.features:
    if not feature.isValid:
        continue

    feature.timelineObject.rollTo(True)

 

 

Any ideas on what could be causing it? Had a look at the `isGroup` and it returns `False`.

This doesn't seem to be specific to Extrude features either.

Labels (1)
1 REPLY 1
Message 2 of 2
siliconlad
in reply to: siliconlad

Turns out, you have to check the parentGroup and ensure it isn't collapsed

 

if parent_timeline := occ.timelineObject.parentGroup:
    parent_timeline.isCollapsed = False

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report