Python: Simple Command Line Option

Hi and a Happy New Year to the Rhino Community!

I’m playing with the CommandLineOptions.py which demonstrates options like toggles, lists, double and integer types. But how can I add a simple option like for example “Undo”?

I think I can modify the script to really undo the last point input, I really just wonder how to implement such a simple command option.

Thanks and best regards,
Jess

Use AddOption like so:

opUndo = gp.AddOption("Undo")

Then, later in the while loop

elif get_rc==Rhino.Input.GetResult.Option:
            if gp.OptionIndex()==opList:
              listIndex = gp.Option().CurrentListOptionIndex
            if gp.OptionIndex()==opUndo:
               #undo logic comes here
            continue
1 Like

Thanks Menno! Tricky and easy…