Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Occurrence Attributes in CommandInputChangedHandler

Anonymous

Occurrence Attributes in CommandInputChangedHandler

Anonymous
Not applicable
The code below changes the occurrence attribute when called from the CommandCreatedHandler, but when I call this function in the CommandInputChangedHandler, it clears the selection input and does not permenantly change the occurrence attribute. Any help would be appreciated, as I am just beginning. def addOccurrenceAttribute(occurenceName, value): try: product = _app.activeProduct design = adsk.fusion.Design.cast(product) design.rootComponent.allOccurrences.itemByName(occurenceName).attributes.add("group","name",value) except: _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
0 Likes
Reply
Accepted solutions (1)
475 Views
1 Reply
Reply (1)

marshaltu
Autodesk
Autodesk
Accepted solution

Hello,

 

The model changes made in InputChanged event handler would be rolled back because they are intermediate. I would recommend to do that in CommandExecuteEvent handler, which is best practice.

 

Thanks,

Marshal



Marshal Tu
Fusion Developer
>
0 Likes