Updating userdata information after object has been moved

Hi @dale and everyone else.

I am creating a BIM type program on top of rhino. For that I have classes like node line and member which I would like to relate to rhino geometry object like point and line. As an example I would like the node property “Point” to update when I move a point where the node is saved as an userdata. There is “OnDuplicate” event method which I can override but It doesn’t give the new geometry object information when it is triggered when I move the point. I know that I can sign to the event RhinoDoc.AddRhinoObject to get the newly created rhino objects that will be created when I move points and then figure out what userdata belongs where etc. However that seems to me like overly complicated way of doing relatively simple thing that I’m trying to do. Is there a better way for this?

Another question: When is the UserData “OnTransform” method being triggered? It seems that onduplicate triggers for all the moving and copying and scaling etc…

Thanks in advance
Matti Pirinen

Hi @mattipi,

If you just want to know if a Rhino object was modified in some way, then these events are useful:

RhinoDoc.ReplaceRhinoObject
RhinoDoc.DeleteRhinoObject
RhinoDoc.UndeleteRhinoObject
RhinoDoc.ModifyObjectAttributes
RhinoDoc.BeforeTransformObjects

If it is important to know when an object is transformed, so you can know the transformation matrix that was used, then it’s best to attached a UserData inherited class that overrides the UserData.OnTransform virtual method.

Attached an instance of this class object to either a Rhino object’s geometry or object attributes. Your class’s UserData.OnTransform override will then be called with the object it is attached to is transformed (i.e. when either GeometryBase.Transform or ObjectAttributes.Transform is called).

Hope this helps.

– Dale