As the title says, is there a way to fire a command without it being recorded in the undo-stack?
I use a custom command SetTargetToCursor quite frequently: CommandTracker shows I’ve used it 6.5K times on a file that I’ve been working on since late April.
What bothers me is there are situations where I’m looking around my model a lot before modelling anything or wanting to undo something, so I’ll end up using the command a lot. When I want to undo something, I have to hit Ctrl-Z a bunch of times to go past all my SetTargetToCursor commands before I get to a relevant modelling command.
I tried adding SetTargetToCursor to the ‘Never repeat these commands’ box in Options > General but no luck.
If it helps, the command is a plug-in of a Rhinoscript that I compiled using the built-in script compiler. Could there be a way to add some code to pause and start the undo-stack recording at the beginning and end of the script respectively?
Where does your custom command come from, the SetTargetToCursor one? If you made it, can you share the code, so we can take a look at what is going on?
As long as the document is not modified or an undo record is started from the command code, the command should not get on the undo stack.
You can save this file in the script folder %AppData%\McNeel\Rhinoceros\7.0\scripts and use this macro with a key combination or alias: _NoEcho !_-RunPythonScript SetTargetToCursor.py
From what I can tell a command that does not modify the document will not be recorded in the undo stack.
So that suggests your script is adding something to the document.
I see a Rhino.AddTextDot and then later it looks like the script deletes it.
If you can do without that code then I think the undo problem will go away.
That’s a good point @jim . @vcruzdesigns I just tested the code without add/delete the dot object and in that case the script does not get recorded in the Undo stack, which should solve your original problem. I don’t think the dot is that important anyway.
@Mahdiyar - it’s an interesting idea, but unfortunately you cannot use _-RunPythonScript while running another command. And this particular script is essential to be able to use while working with other commands, which works great with RhinoScript.