Add optionline when get object (c++)

Hi;

CRhinoCommandOptionValue list_items[3];
list_items[0] = RHCMDOPTVALUE(L"item0");
list_items[1] = RHCMDOPTVALUE(L"item1");
list_items[2] = RHCMDOPTVALUE(L"item2");
int m_nVal = 8;
int item=0;
CRhinoGetObject go1;
go1.SetCommandPrompt(L"select object");
go1.SetGeometryFilter(CRhinoGetObject::curve_object);
while(true)
{
	go1.ClearCommandOptions();
	int nval_option_index = go1.AddCommandOptionInteger(
		RHCMDOPTNAME(L"index"), &m_nVal, L"index_v", 1, 1000 );
	int list_option_index = go1.AddCommandOptionList( RHCMDOPTNAME(L"item"),
		3, list_items, zx );
	go1.GetObjects( 1, 1 );
	if (go1.CommandResult() != CRhinoCommand::success)
		return;
	if(go1.IsGetOption())  // not run
	{
		const CRhinoCommandOption* option = go1.Option();
		int option_index = option->m_option_index;
		if(option_index == list_option_index)
		{
			zx=option->m_list_option_current;
			continue;
		}
		else if(option_index == nval_option_index)
		{
			continue;
		}
		else
		{
                          break;
		}
	}
        else
        {
               //to do something........
        }
 }

In this core, How can I make difference between select optionline and select object ?

Hi @pythonuser,

CRhinoGetObject::GetObject() returns a CRhinoGet::result enum value which indicates what happened. In a loop, check this value and take the according actions.

There are several samples in the developer samples repo on GitHub that demonstrate this.

– Dale

Think you @dale, I have found the sample, it is helpful.