ReplaceRhinoObject Inquiry

I am observing an unexpected difference in how the ReplaceRhinoObject event is populated when using the Trim and Extend commands in Rhino.

When an operation triggers this event, I expect the old and new object information to clearly reflect the change.

1. Trim Command Behavior (Expected):

When I use the Trim command, the event is triggered, and I see the following GUID assignment:

  • OldRhinoObject.Id is set to an existing GUID (let’s call it X).

  • NewRhinoObject.Id is set to the same GUID X.

Note: Although the GUID is the same, I understand this event signifies the replacement of the original object with a modified version retaining the same ID. This behavior seems consistent with how a modification-in-place is often handled.

2. Extend Command Behavior (Unexpected):

When I use the Extend command, the event is also triggered, but the GUID assignment is different:

  • OldRhinoObject.Id is set to an existing GUID (Y).

  • NewRhinoObject.Id is set to Guid.Empty (or all zeros).

My Question:

Why does the Extend command set the NewRhinoObject.Id to Guid.Empty, while the Trim command sets it to the same GUID as the old object?

Is this an expected difference in event handling for these two specific commands, and if so, what is the reasoning behind it? Or is this potentially an issue where the new object’s ID is not being properly reported during an Extend operation?

Any insight into the proper interpretation of the ReplaceRhinoObject event for Trim vs. Extend would be greatly appreciated!

Hi @Frusciante,

Just because you don’t understand something doesn’t mean it’s a “bug.”

Did you read the comments for RhinoDoc.ReplaceRhinoObject carefully?

If the “new” object has a GUID, then the command make a copy of the “old” object, thus copying it’s GUID.

If the “new” object does not have a GUID, then the command did not make a copy of the “old” object. Thus, the GUID will not be copied until the new object is added to the document, upon which Rhino will trigger a RhinoDoc.AddRhinoObject event (per the comments I referenced).

Hope this helps.

– Dale

1 Like

Thanks dale, you are right. Thanks for the insight!

@dale,

There is something else. I don’t know if I should make another post about it, but there are three commands that I found out reference the same command ID (1982efaf-e638-4a75-8e09-0ed1f39ae023) called ‘Pause’.

The commands are:

1. Extend by arc: to point
2. Extend by arc: with center
3. Convert curve to polyline

Why is this happening?