Can't select consecutive point sets using CRhinoGetObject


#1

Hello,

If I want to select two different sets of points using a CRhinoGetObject inside a command plugin I am currently finding that I need to insert a “dummy” selection of a non-point object as per below. If I don’t do this there is no prompt to select the destination points and the origin points appear to be automatically selected instead. Is there a way to reset select state or otherwise force the explicit selection of two different sets of points for this type of workflow?

CRhinoGetObject go1;
go1.SetCommandPrompt( L"Select origin points" );
go1.SetGeometryFilter( CRhinoGetObject::point_object );
go1.GetObjects( 1, 1 );

go1.SetCommandPrompt( L"Select a dummy curve (don't want to do this...)" );
go1.SetGeometryFilter( CRhinoGetObject::curve_object );
go1.GetObjects( 1, 1 );

go1.SetCommandPrompt( L"Select destination points" );
go1.SetGeometryFilter( CRhinoGetObject::point_object );
go1.GetObjects( 1, 1 );

Thank you,
Erin


(Dale Fugier) #2

How about this?

CRhinoCommand::result CCommandTest::RunCommand( const CRhinoCommandContext& context )
{
  CRhinoGetObject go1;
  go1.SetCommandPrompt( L"Select first set of point objects" );
  go1.SetGeometryFilter( CRhinoGetObject::point_object );
  go1.EnableSubObjectSelect( FALSE );
  go1.EnablePreSelect( TRUE );
  go1.GetObjects( 1, 0 );
  if( go1.CommandResult() != CRhinoCommand::success )
    return go1.CommandResult();

  CRhinoGetObject go2;
  go2.SetCommandPrompt( L"Select second set of point objects" );
  go2.SetGeometryFilter( CRhinoGetObject::point_object );
  go1.EnableSubObjectSelect( FALSE );
  go2.EnablePreSelect( FALSE );
  go2.EnableDeselectAllBeforePostSelect( FALSE );
  go2.GetObjects( 1, 0 );
  if( go2.CommandResult() != CRhinoCommand::success )
    return go2.CommandResult();

  // TODO...

  return CRhinoCommand::success;
}

#3

That worked like a charm! I am quite new to Rhino Plugin development and still feeling out the SDK. Help with these little things is much appreciated. Thank you.


(Dale Fugier) #4

Here is a link to a lot of good information, including a ton of samples, that can help you: