Occurrence Attributes in CommandInputChangedHandler

Occurrence Attributes in CommandInputChangedHandler

Anonymous
Not applicable
604 Views
1 Reply
Message 1 of 2

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
Accepted solutions (1)
605 Views
1 Reply
Reply (1)
Message 2 of 2

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