Stop custom graphics from being added to Undo

Stop custom graphics from being added to Undo

scottmoyse
Mentor Mentor
1,149 Views
6 Replies
Message 1 of 7

Stop custom graphics from being added to Undo

scottmoyse
Mentor
Mentor

Hi there,

 

I can see a way to group my 8 commands into 1 as per the information on this page:

 

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-3922697A-7BF1-4799-9A5B-C8539DF57051

 

But it's just custom graphics text, so I don't want the commands being registered at all for Undo. 

 

2020-04-13_17-16-45.png

 

Can someone point me to any documentation or sample code which may help please?

 
 
 
 
 
 

Scott Moyse
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature


RevOps Strategy Manager at Toolpath. New Zealand based.

Co-founder of the Grumpy Sloth full aluminium billet mechanical keyboard project

1,150 Views
6 Replies
Replies (6)
Message 2 of 7

goyals
Autodesk
Autodesk

I do not think it is possible.  May I know Why do you want to not have it listed in undo's stack. Thanks.



Shyam Goyal
Sr. Software Dev. Manager
0 Likes
Message 3 of 7

scottmoyse
Mentor
Mentor
Because I'm just displaying some static text based on an attribute value in the document. So everytime the user switches documents by clicking on the tab, the documentActivate event handler triggers the custom graphics command. It's a pointless addition to the undo list... It also seems the event is triggered twice for some reason, so you see the graphics flicker and it creates a double up in the undo list.

Scott Moyse
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature


RevOps Strategy Manager at Toolpath. New Zealand based.

Co-founder of the Grumpy Sloth full aluminium billet mechanical keyboard project

Message 4 of 7

BrianEkins
Mentor
Mentor

Drawing custom graphics is the same as creating anything else that's displayed in that it is transacted and will be added to the undo list.  Everything that's done within the command execute event will be grouped together within a single undo.  As far as the documentActivating event being fired twice, I wrote a little test to watch that event and it's only firing one in my test.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes
Message 5 of 7

scottmoyse
Mentor
Mentor

Thanks Brian... but how can you achieve that without creating a button? It seems like you have to create a button to properly trigger the command execute event.


Scott Moyse
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature


RevOps Strategy Manager at Toolpath. New Zealand based.

Co-founder of the Grumpy Sloth full aluminium billet mechanical keyboard project

0 Likes
Message 6 of 7

scottmoyse
Mentor
Mentor

ok I see you have to create a button but you don't have to add the button to any toolbar. Weird... but ok. This API is kind of odd in my limited experience.... we definitely need access to the transaction manager, so we can stop commands from appearing in the undo list... there are plenty of examples where having useless (to the user) API commands appearing in the undo list is undesirable. 


Scott Moyse
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature


RevOps Strategy Manager at Toolpath. New Zealand based.

Co-founder of the Grumpy Sloth full aluminium billet mechanical keyboard project

0 Likes
Message 7 of 7

BrianEkins
Mentor
Mentor

Having a transaction manager, like Inventor, doesn't stop them from showing up in the undo list.  It lets you group transactions together into one transaction without the requirement of having a command.  In Inventor, there is an option to create a transaction and then combine it with the previous transaction.  This stops it from showing up in the undo list but it still exists and if they undo the previous transaction then that transaction will also be undone.  Hopefully, Fusion will have similar capabilities.

 

In the case of Fusion, you're defining a command definition, not a button.  A button is a way to cause a command definition to be executed, which results and the associated command being created and run.  All action that happens within that command is automatically wrapped in a transaction.

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