Mouse Events on Guid


I’ve created a class with a Guid for a plugin of Rhino 5 in c#

I can display the guid in Rhino, Rotate, traslade… but i need detect if somebody does click on this guid or does drag&drop for do aditionals operations, so i need catch mouse events, but i dont know how do it.

Can somebody help me?


Ok, I assume you are using RhinoCommon. If not, and you’re using Rhino_DotNet, switch to RhinoCommon while you still can.

A second assumption is that when you say Guid, you mean a geometry object in the document. You display the geometry in Rhin and you can rotate and translate it.

So, how Rhino works is that when you change a geometry, for instance by translating or rotating, that it deletes the old object from the document and it adds a new object to the document at the new position. The object has the same identifier (the Guid accessible by the Id property).

Now, you can monitor this replacement (deleting + adding) by subscribing to events. These events are fired whenever an object is deleted or added. In particular you want to subscribe to


For example, the DeleteObject event must be subscribed to with a delegate of signature

// this is the same as:
void MyEventHanderMethodName(object sender, RhinoObjectEventArgs)

So, you must write a method that has that signature:

void OnDeleteRhinoObject(object sender, RhinoObjectEventArgs args)
  RhinoApp.WriteLine("Object with id {0} removed", args.ObjectId);
  // here you react to the fact that the object has been removed

To subscribe to the event, you can put this for example in the constructor or OnLoad method of your plug-in

RhinoDoc.DeleteRhinoObject += OnDeleteRhinoObject;

Now, each time that the user deletes or replaces an object, your method OnDeleteRhinoObject will be called and executed.


Hi Menno,

Thanks for your reply.

Your assumptions are correct. I’m working with rhinocommon and my references to a Guid mean geometrical object in the document.

Your answer is very good, but i need two specifications more:

  1. When a user double-click on a guid I must change a property of the guid’s class

  2. When a user is moving the guid on a specific area I must change the guid’s color.

I need handle double-click and move events, but i don’t know.

Sorry for my poor specifications in my first post.

Bye and thanks

Hey Manolo,

The first one - I don’t know how to distinguish double clicking using the RhinoCommon. There is a class in Rhino.UI namespace called MouseCallback but I don’t see how to use it in the SDK documentation (which can be found at

The second one - finding if it is moved to a certain area. If you know the area that the object should be in you can define it with a bounding box (target) and check if the geometry is in the target bounding box.

BoundingBox target = new BoundingBox(0,0,0,10,10,10); // this is the boxed area between the origin and (10,10,10)

void OnAddRhinoObject(object sender, RhinoObjectEventArgs args)
    RhinoObject obj = args.TheObject;
    GeometryBase geom = obj.Geometry;
    BoundingBox geomBoundingBox = geom.GetBoundingBox(true);
    if (target.Contains(geomBoundingBox))
         RhinoApp.WriteLine("geom in target area");
         obj.Attributes.ColorSource = ObjectColorSource.FromObject;
         obj.Attributes.ObjectColor = Color.Red;
1 Like

Ok, thank you very much for your answers.

A post was split to a new topic: RUI Menu Handling