I want capture when a user does 2-click on a object. For example, in the image on the selected object.

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))

I’m working with rhinocommon and c#

Does this help?

Hi Dale,

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)

view.ActiveViewport().VP().GetXform(IOn.coordinate_system.world_cs, IOn.coordinate_system.screen_cs, ref w2s);

But it doesn’t work.

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

Does this help?

/// <summary>
/// Converts a 2-D screen point to a RhinoCommon 3-D point
/// </summary>
/// <param name="viewport">The viewport</param>
/// <param name="point_2D">The viewport point (2-D)</param>
/// <param name="point_3D">The 3-D point</param>
/// <returns>True if successful, false otherwise</returns>
public static bool ConvertScreenPointToWorldPoint(
  Rhino.Display.RhinoViewport viewport,
  System.Drawing.Point point_2D,
  ref Rhino.Geometry.Point3d point_3D
  bool rc = false;
  if (null != viewport)
    Rhino.Geometry.Transform xform = viewport.GetTransform(

    if (xform.IsValid)
      point_3D.X = point_2D.X;
      point_3D.Y = point_2D.Y;
      point_3D.Z = 0.0;
      rc = point_3D.IsValid;
  return rc;

Thank you very much Dale, the two solutions works well