Suppress "Choose one question" from MRhinoGetObject

Hello,

My plugin creates a number of objects and adds them to the rhino document. At some point the plugin asks the user to create a point by clicking on a point on any of the objects. I do that with the following code (I write in C++/CLI):

 void CreatePointOnObject ( void ) 
 { 
    RMA::Rhino::MRhinoGetObject^ objectSelector = gcnew RMA::Rhino::MRhinoGetObject(); 
    objectSelector->SetCommandPrompt ( "Click on any object to create a point _" ); 	 
    objectSelector->SetGeometryFilter (RMA::Rhino::IRhinoGetObject::GEOMETRY_TYPE_FILTER::any_object); 	 
    objectSelector->EnableSubObjectSelect ( False ); 	 
    objectSelector->EnablePreSelect ( False ); 	
    objectSelector->EnablePostSelect ( True ); 	 
    objectSelector->EnableDeselectAllBeforePostSelect ( True ); 	 
    objectSelector->AcceptNothing ( False ); 	 
    objectSelector->EnableChooseOneQuestion( False ); 

    objectSelector->GetObjects ( 1, 1 ); 
    if ( objectSelector->ObjectCount() > 0 ) 	 
    { 	 
        RMA::Rhino::MRhinoObjRef^ selectedObjRef = objectSelector->Object(0); 

        RMA::OpenNURBS::On3dPoint^ p = gcnew RMA::OpenNURBS::On3dPoint(); 	 
        selectedObjRef->SelectionPoint( p ); 
        RMA::Rhino::RhUtil::RhinoApp()->ActiveDoc()->AddPointObject( p ); 	 
     } 	
 }

My problem is that when two objects coincide or are very close, a pop up appears which asks the user to select one of the candidate objects. This happens despite calling EnableChooseOneQuestion(False).
My question: Is there a way to supress this pop up and just select the first object in the list automatically?

As a work around (assuming I cannot do the above), I tried to group the objects. I noticed that when objects are grouped, they behave as one when you select them and drag them etc. However when I try to select the group with MRhinoGetObject, it treats them as separate objects. Is this a fixed behaviour, or I can make MRhinoGetObject treat them as one by setting a flag?

Many thanks

Odysseas

Hi Odysseas,

By default, if a call to GetObject is permitted to select different parts of the same object, like a polysurface and an edge of that polysurface, then the top-most object is automatically selected. If you want the choose-one-object mechanism to include pop up in these cases, then call EnableChooseOneQuestion(true) before calling GetObjects().

Does this help?

Hi Dale,

thanks for the reply. My situation is a bit different. I don’t have a single object such as a B-Rep, I have two different objects (e.g. two curves) which intersect at some point.

If I click at the intersection point, I will be asked by Rhino (through the pop-up dialog) which of the two objects I want to select. I don’t want this. I would like Rhino to select one of the two without asking the user. What I am interested in, is the 3d point the user clicked, rather than the object.

I tried to achieve this by grouping all objects in the document and then selecting but it doesn’t seem to work.

Is there anything else I could try?

Many thanks,

Odysseas

@mikko any ideas here?

You could try using MRhinoGetPoint and call EnableSnapToCurves() before calling GetPoint(). It doesn’t force you to pick the point on curves/edges though. PointOnCurve() can be used to test afterwards if the point was on a wire.

Thank you for your replies, I ll have a look at it when I am back in the office and let you know if I have success.
Best regards
Odysseas