IsModified CRhinoObject?

Does CRhinoObject has something like IsModified or information about previous state?
Thanks in advance!

No, but I think you should be able to track changes as follows:

Between changes to an object its ObjectId does not change, but its runtime serial does change. Each state of an object therefore has a uniqe runtime serial number.

I can imagine the following working: Use CRhinoEventWatcher-subclassed class to see if an object with the object id you’re interested in is being replaced using OnReplaceObject.

Record the runtime serial number of the “old” and “new” state of the object and then use CRhinoDoc::LookupObjectByRuntimeSerialNumber to find the version you want.

1 Like

Any time an object is changed in any way, its runtime serial number will change. To track this, just use CRhinoObject::m_runtime_serial_number. Note, this value will change of an object’s attributes (e.g. layer, color, etc) are modified, or if the object’s geometry has changed. If you really want to know if an object’s geometry has changed, you can track the geometry by it’s CRC value. You can ON_Object-derived object’s CRC value by calling ON_Object::DataCRC.

For example:

CRhinoObject* obj = ...;
if( m_geometry_crc != obj->Geometry().DataCRC(0))
  // Geometry has changed...

Hi Dale, I was looking to use the DataCRC method on a RhinoObject (RhinoCommon) to try to determine if the object geometry had changed in a prior session of Rhino where my plug-in may not have been loaded so I couldn’t use an event to watch for the change

  1. Am I correct that the DataCRC could be used for this? Is a hash of the geometry object data that changes whenever the geometry is changed?
  2. When I call this method with a 0 argument I get zero return value, so I am guessing I may not be using this correctly. I was expecting it to return some unique hash of the geometry data. Could you explain a little more about it’s use?
    Thanks, Larry

Hi @LarryL,

Calling DataCRC on a RhinoObject only calculates the CRC from the manifest (e.g. model serial number, worksession serial number, etc.) and not the geometry.

I’ll expose something on GeometryBase you can access.

– Dale

Thanks @dale . Sounds perfect!

RH-68961 is fixed in Rhino 7 Service Release 20