Constrain GetPoint() to construction points


#1

Hi,

Is there a way to constrain CRhinoGetPoint to a set of construction points? I do not only want to have the snapping to the construction points, but to constrain the selection to these ones.

Many thanks!
Pablo


(Dale Fugier) #2

Hi Pablo,

Apparently you know about CRhinoGetPoint::AddSnapPoints, and this is not what you want.

The alternative is to derived you own class from CRhinoGetPoint and overrride CRhinoGetPoint::OnMouseMove. During mouse movement, find the closest polyline point on the curve, or vertex on the mesh, to the current 3d mouse point. When found, draw the point location in CRhinoGetPoint::DynamicDraw and don’t draw the current 3d mouse location (basically don’t call the base class CRhinoGetPoint::DynamicDraw function.

Does this help?

– Dale


#3

Hi Dale,

I like your idea as for the display.

Though at a functional level I’d want something like this: imagine for example that (x1,y1)=(1,0) is the only construction point in the scene, and the user clicks over the point (0.56,1.43). Then either
a) the command finishes and there’s a prompt saying "you didn’t select any of the construction points!"
b) the command doesn’t do anything but keeps still until the user ends up clicking on (1,0).

I’m happy with any of those. The only idea I have for it is to loop over the construction points and compare the selected point with them.

Pablo


#4

@dale, i am facing a similar task where i have to use Rhino.Input.Custom.GetPoint while checking if the args.CurrentPoint is inside various closed curve shapes. The testing happens in the DynamicDraw function but the point should not be displayed at all unless the user places the mouse over one of the shapes.

Is there an (preferrably python based) example how to “override” the GetPoint class ?

thanks,
c.


(Dale Fugier) #5

https://github.com/dalefugier/SamplePy/blob/master/SampleMove.py

– Dale


#6

@dale, thanks just found that after i’ve sent above. It helps.

c.