I’m trying to create a command where you can select multiple objects and be able to have an option that can be changed in the commandline. But when I first select an object and then decide to enter the value in the commandline, it doesn’t show which objects were preselected in yellow. However it does remember which objects I had preselected. What am I doing wrong?
var go = new GetObject();
go.SetCommandPrompt("Select objects to be moved");
var plane = doc.Views.ActiveView.ActiveViewport.ConstructionPlane();
var number = 22;
OptionInteger nr = new OptionInteger(number);
var go_get = go.GetMultiple(1, 0);
if (go.CommandResult() != Result.Success)
if (go_get == Rhino.Input.GetResult.Option)
go.AlreadySelectedObjectSelect = true;
go.DeselectAllBeforePostSelect = false;
number = nr.CurrentValue;
If you allow for pre-selection and the user pre-selects, then your options will never be displayed. In this case, check the GetObject.ObjectsWerePreselected property to see if this was the case and, if so, display your options using a GetOption object after the fact.
Hi @dale ,
I don’t mean preselecting before the command starts. I mean: I start the command, I select a few objects and then I realize I need to adjust an option in the commandline. So I click on that option and change the value and then I can continue selecting objects. But after changing the option, the objects I preselected are not selected anymore (at least they’re not yellow). I would like to have them selected so I avoid selecting objects that were already part of my first selection.
This looks like it works but this only allows me to select objects 1 by 1, which is too tedious in certain situations. How would I implement the possibility to use window selection in your example?
Ah, that’s a shame. I’m kind of looking to recreate the same selection behavior like in OffsetMultiple (for example, I’m sure there are a lot of other commands with the same behavor).
Just out of curiosity: Is the reason I cannot implement the same selection behavior because it is written in C/C++?
@dale Would it be possible to enter a loop and allow for multiple objects and keeping doing that when I change a command line option, (and then also reselecting the objects after I’m done changing the command line option) until I press enter when it goes out of the loop and continues the rest of the command. Or until I press esc and then it returns failure without doing anything else?