I’ve developed a class that inherited of MouseCallback and I enable the events. When I do 2-click on a view, i show a message, so the event management works well.
But now, I want to do an action only when I do 2-click on a object. In the event OnMouseDoubleClick of my class I receive the coordinate X,Y in ViewPortPoint class, but the object has other coordinates, so I can’t know if the 2-click is on the object
My question is, how I can determine if the 2-click is doing on the object?
The code of On MouseDoubleClick
protected override void OnMouseDoubleClick(MouseCallbackEventArgs e)
{
Point3d punto = new Point3d(e.ViewportPoint.X, e.ViewportPoint.Y, 10);
RhinoObject object = RhinoDoc.ActiveDoc.Objects.Find(guid);
if ( ventosa != null)
{
if (ventosa.Geometry.GetBoundingBox(true).Contains(punto, true))
{
MessageBox.Show("2-click");
}
}
}
I want do more funtionallity than 2-click, for example rightbutton click to show a context menu, or doing drag&drop and to control if the object is moving over a invalidate zone to change their color, for example.
With your example, only pick is contemplated, no? Furthermore I don’t understand very well this code, and… isn’t made in RhinoCommon?
I’ve trying to use this function (I think that this funcion transform the system spaces)
Yes, the example I referenced only show how to pick objects. But could popup a context menu, form or do whatever else you wanted to do.
For custom picking in RhinoCommon, you would use a Rhino.Input.Custom.PickContext object
This Rhino.NET code transforms a 3-D point in world coordinates to a 2-D view-dependent screen point. With a MouseCallback, you are going to be handed a 2-D screen point, so you wouldn’t need this step.
I think that with the Picking Objects example I could solve my problem, but I like to know how transform a point 2d in the screen (given by mouse events) into point 3d in world coordinates for known over that objects are clicked