I have been trying to figure out a way to add a command to the never-repeat list via script, and because of the way they are remembered in Options, I am having hard time with this one.
With a great help from this forum I was able to figure out how to get/set most of the Advanced Options in Rhino via Python code. And to some degree can do the same with this one, but the list is remembered as two parameters: 1) count of never-repeat commands; 2) individual commands, numbered, as their own options items.
Here is my code to check for the number of commands and to list them:
import scriptcontext as sc import Rhino import Rhino.ApplicationSettings as appsettings settings = Rhino.PlugIns.PlugIn.GetPluginSettings(Rhino.RhinoApp.CurrentRhinoId, False) dontrepeat = settings.GetChild("Options").GetChild("DontRepeatCommand") count=dontrepeat.GetInteger("DontRepeatCount") commands="" for i in range(0, count-1): prefix="" if i < 10: prefix="0" commands += dontrepeat.GetString("DontRepeat_" + prefix + str(i))+" " print "don't repeat count:" + str(count) print "don't repeat commands: " + commands
But how would I go about adding another one to the list? Is there a way to add a key to this list using similar code to the above? Would I need to manually change the commands count then? Or maybe should I look into editing the settings xml file directly?
This is how they look in Advanced Options, and the code above uses same names to read the settings:
A secondary question that may affect the code above - in a very unlikely scenario with less than 10 commands, would the entry still keep the 0 prefix before the single digit? And what if we are more than 100 (doubt it would ever happen) - would they change to 001, 002… etc.?
My main goal for now is to add a command to that list from code.
@stevebaer, @nathanletwory - since you helped a lot with figuring out accessing the Advanced Options maybe you could with this one too ?