How to calculate a point on mesh when OnMouseMove event ?(V5/C++)


#1

I meet the problem that the RhinoGetPointOnMesh need press the left button of the mouse to get a point on mesh.

I want to know a point on mesh when MouseMove .

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

A Problem is below:

CRhinoMeshObject* my_mesh_object; //my Mesh;

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


(Dale Fugier) #2

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.


#3

Oh my god !
I can’t believe it let me think too much.
Thanks , Dale.


#4

I meet a problem again.
Using Constrain() is going to show the text when the cursor on the mesh.
I want to hide it. Can it be implemented ?

I found the EnableObjectSnapCursors(false). Right ?


(Dale Fugier) #5

Correct.