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: 

CustomFeatureDependencies.itemById throwing RuntimeError when key not found

1 REPLY 1
SOLVED
Reply
Message 1 of 2
mcd8604
183 Views, 1 Reply

CustomFeatureDependencies.itemById throwing RuntimeError when key not found

When I call CustomFeatureDependencies.itemById and pass an id that is not in the collection, I get the following runtime error:

RuntimeError: 3 : Invalid argument id

Based on the documentation, it was my understanding that this should fail gracefully and return null. This is ideal for a CustomFeature that has an optional dependency - i.e. it may or may not have been added and ActivateEdit is loading the dependencies. My current way of dealing with this is (but is not ideal)

try:
    dependency = editedCustomFeature.dependencies.itemById(id)
except:
    pass

 

1 REPLY 1
Message 2 of 2
BrianEkins
in reply to: mcd8604

I'm able to reproduce the problem and will make sure a bug gets filed. Thanks for reporting this.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com

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