Block commands from GetOption() options

I have code that looks like this:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
	var gopt = new GetOption(); // from Rhino.Input.Custom
	int disableIdx = gopt.AddOption("Pause");
	int enableIdx = gopt.AddOption("Unpause");
	int toggleIdx = gopt.AddOption("Toggle");
	gopt.SetCommandPrompt("Action");

	gopt.Get();

	// PROBLEM
	// we never get here if we press Pause or type Pause as the option

	Result rc = gopt.CommandResult();

	if (rc == Result.Success && gopt.Result() == Rhino.Input.GetResult.Option)
	{
		CommandLineOption clo = gopt.Option();
		// here some useful code
	} 
	return Result.Nothing;
}

It appears that using the option Pause doesn’t work since there is already a command called Pause. Is there a setting on GetOption() that prevents commands from taking precedence, or how can I ensure I can use option names that look like existing commands?

A similar problem happens when I use the string Lock (for Lock and Unlock as options).

Answering my own question here.

The fix is to use

gopt.EnableTransparentCommands(false);
1 Like

Scratch that. After a full rebuild I still see Pause breaking my command, even with gopt.EnableTransparentCommands(false).