Object Checksum/Version


#1

Hi All,
within RhinoCommon, is there something like an object-specific “checksum” that I could store and check later if the object has been changed inbetween?
In the Object Description Dialog I found a number (in brackets behind the object ID) that rises when the object is geometrically altered. Is that some kind of version number of the object? Can I get it via RhinoCommon?
Thanks in advance!


(Dale Fugier) #2

Hi @romio82,

For Rhino objects, you can just track their runtime serial number.

RhinoObject rh_obj = ...
uint runtime_serial_number = rh_obj.RuntimeSerialNumber;

// TODO...

if (runtime_serial_number != rh_obj.RuntimeSerialNumber)
{
  // Something has changed...
}

Also, for object that inherit from ModelComponent, you can use ModelComponent.DataCRC.

– Dale


#3

Thanks a lot for the fast answer @dale,
so I finally know what this mysterious number in brackets is for and that it is called RuntimeSerialNumber :slight_smile:
Unfortunately, as it has “runtime” in its name, it restarts from 0 whenever the document is closed and reopened…
So I guess there is no way of keeping track of Rhino object geometry changes across multiple sessions?


(Dale Fugier) #4

Hi @romio82,

When you add an object to a document, it is assigned a permanent id, or guid.

RhinoObject rh_obj = ...
Guid id = rh_obj.Id;

or

Mesh mesh = ...
Guid id = doc.Objects.AddMesh(mesh);

– Dale


#5

Sorry @dale,
my question was very unclear…
In principle, your first answer led in the right direction - but not quite there yet :slight_smile:
I wrote a plugin that calculates intersection curves between multiple breps and performs a Make2D on them. Now I’m trying to make that plugin a little more intelligent by not always recalculating all intersections but only the ones I need to recalculate - which are the ones whose geometries were altered inbetween. Within one session I can keep track of changes now with the RuntimeSerialNumber. But what if I close Rhino and restart a new session? Is there a way to keep track of Rhino object changes across multiple sessions?


(Dale Fugier) #6

Hi @romio82,

Yes, use the object’s Id, as I described above.

– Dale


#7

Thank you @dale,
I think it’ll work with that.
I had a kind of an always rising object version number in mind but probably you’re right and this is not needed here. Sorry for being overly persistent. :slight_smile: