When I use a conduit to draw my model, how to select objects by a cursor?(C++)


#1

I drew some models by a display conduit.
These models is ON_mesh, ON_Curve … .
How to know which model is under the cursor ?
I think this need code a picking function.
Does anyone know how to solve it ?
:confounded:


(Dale Fugier) #2

There is no simple way of “picking” objects that are not in the document. But with some work, you can use the CRhinoPickContext to simulate picking of dynamically drawn objects (in your conduit).

Here is a sample of how you might use CRhinoPickContext to pick objects that are in the document.

For objects that are not in the document, you will want to create and setup a CRhinoPickContext and then call CRhinoPickContext::PickMesh, CRhinoPickContext::PickCurve, etc.


#3

::PickCurve() don’t exist, but I found PickNurbsCurve, PickLine and PickBezier.

It confuses me which function is able to handle ON_Curve.

In addition, I have some problems for the example.

active_vp.GetPickXform(point.x, point.y, pick_context.m_pick_region.m_xform) ) 
active_vp.VP().GetFrustumLine( point.x, point.y, pick_context.m_pick_line );

I know a point of cursor(x,y).
A point is able to obtain a ray of pick, so I can set pick_context.m_pick_line.
Therefore, do i need to set pick_context.m_pick_region.m_xform ?
Is it necessary to use pick_context.UpdateClippingPlanes() ?