How to set curve editing triggers in my C++ plugin?

Hi,

In my plugin, there would be several curves created initially. Those curves are really close to the faces of a mesh object.
For some reason, these curves need to be edited by user in my plugin. So I would like to do custom curve snapping function(curves snap to mesh) during user editing those curves.

  1. In this picture, once I do MouseDown on a point on curve, this message shows, 1 curve edit point added to selection.
  2. If I start to drag the point, this message shows as command prompt, Drag objects, tap Alt to make a duplicate, press and hold Alt to temporarily toggle osnaps.
  3. Once I release the point, the message, Drag objects, tap Alt to make a duplicate, press and hold Alt to temporarily toggle osnaps, shows as history message.

Here is my question:
Those 3 actions above seem to be triggered by mouse event, could you tell me where can I find it in C++ SDK? and how to use it to reach my goal?

Thank you so much!

Hi @jamie.lin,

Without thinking too hard about this, you can probably this with a custom CRhinoGetPoint class. To capture the Alt key, you might need a Windows keyboard hook. You could also just call GetKeyState in a CRhinoGetPoint::OnMouseMove override.

– Dale

Hi @dale,

Thanks for your reply.

I found that once I call CRhinoGetPoint class, there is always a Pick a point, waiting for an input.
But I need this function only when user is editing the curve’s edit point.

Here is my further question:
Is it possible to add a toggle to my custom class and the toggle trigger is the curve edit point is selected?

I’m new to Rhino C++ plugin development.
Could you give me simple sample if the answer of my question is Yes?
Thank you for considering my request.

Hi @dale,

I found a way to reach my goal.

I referenced your sample of CRhinoMouseCallback Class and made my custom MouseCallback class.

In my custom OnMouseDown function, I get the selected edit point of the curve by GetGrips() and IsSelected().
In my custom OnMouseMove function, if there is a grip object be selected, that means the edit point is dragged. So I keep doing DragCount += 1; .
In my custom OnMouseUp function, I check if a grip object be selected and DragCount > 5.
If true, I will create my new curve with my new edit point(after custom snapping) and delete the old one.

Just share my solution here. Thanks.