I would like my add-in to be able to react to changes in the design, for example if a component is added/removed or the geometry or appearance changes - is there an event that I can add a handler for? (I'm using the C++ API).
Solved! Go to Solution.
Solved by kandennti. Go to Solution.
Hi @toby_allsopp .
Fusion360 has commands being called for many operations.
When a command is executed, the UserInterface.commandTerminated event is fired.
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-E381414E-1CFF-4007-B1DF-C413D7E6841A
Thank you, @kandennti!
If I understand correctly, the commandTerminated event will fire whenever the user does pretty much anything in the UI. How can I tell, in my event handler, what was actually changed? It looks like the event args include a command ID and a command definition. Would I need to look at the command ID to figure out what the command did? Is there a list of built-in commands somewhere?
As for the shape, why not check the values of modelParameter and userParameter?
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-d037893e-b36f-448f-b693-d0fe7aaee778
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-ba26f8cd-6136-44a8-81fe-b133198cfa2d
I don't know, but maybe it is enough to check the center of gravity using the getPhysicalProperties method of the root component.
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-3EA1D5C8-B79A-4FC0-A130-DED8D8F45D8A
As for the appearance, I think it would be difficult since all aspects need to be checked.
If you simply need to check the FusionDocument.isModified property, that would be the easiest way.
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-c6a12e58-712b-4a8d-83f5-ad9504744e46
Thank you for the info. It seems like I will need to store the information I depend on and then compare the state of it when a modification is detected.
Can't find what you're looking for? Ask the community or share your knowledge.