In OnMouseMove to calculate a point on Mesh?

When I call the RhinoGetPointOnMesh function, I can’t to get OnMouseMove event etc. Right ?

I meet the problem that the RhinoGetPointOnMesh need press the left button of the mouse to get a point on mesh, but I need to know a point on mesh when mousemove.

Now, I use the class of CRhinoGetPoint to handle those event, but how to get a point on mesh in OnMouseMove function.

A Problem is below:

CRhinoMeshObject* my_mesh_object; //my Mesh;
OnMouseMove( CRhinoViewport& vp,
UINT nFlags,
const ON_3dPoint& point,
const CPoint* view_wnd_point)
{
//RhinoGetPointOnMesh( my_mesh_object, … ) // I can’t use this function to know a point on mesh right now.
};

Instead of using RhinoGetPointOnMesh, use CRhinoGetPoint.

For example:

ON_Mesh* mesh = ...;

CRhinoGetPoint gp;
gp.Constrain(*mesh);
gp.GetPoint();

If you need, you can derive a class from CRhinoGetPoint and override OnMouseMove.

1 Like