Set_attribute and undo operations
-
I'm using attribute dictionaries to manage entities in a tool, but whenever I call
set_attribute
, another operation is pushed on the undo stack creating unnecessary (in my opinion) undo operations. The operations show up as "Undo Properties" on the Undo button Tooltip.Is it possible to make SU not put these changes on the undo stack?
-
Can you not just keep a reference to the dictionary and twiddle key-value pairs without calling set_attribute?
-
Jim,
Consider trying something like this, which will group them into a single undo event...
Sketchup.active_model.start_operation "Modify Attributes" # make multiple attribute changes here. Sketchup.active_model.commit_operation
...and if you're responding to an observer event, you might consider something like this, which will "append" your attribute changes to the previous event. See start_operation for details on the 3rd param...
Smodel.start_operation "Modify Attributes", true, false, true # make multiple attribute changes here. model.commit_operation
Hope that helps!
-
Third param?? Where did that fly in from?
-
...correction four... ...now that might come in handy.
Advertisement