Detect if curve has been edited

Hi,

If there is no way to attach user-text to geometry as a means of detecting geometry changes, how can I best find out of a curve has been edited in between script itterations?

Thanks
-Willem

Continuing the discussion from UserText on geometry not discarded when cp editing:

Hi Willem,

You can detect whether or not a Rhino object has changed by tracking its runtime serial number. RhinoScript does not expose any methods to obtain this. But using Python/RhinoCommon, you can do something like this:

import rhinoscriptsyntax as rs
def ObjectSerialNumber(object_id):
    rhobj = rhutil.coercerhinoobject(object_id, True, True)
    return rhobj.RuntimeSerialNumber

Anytime an object changes in any way, this number will change.

Does this help?

1 Like

Hi Dale,
Thanks for pointing to this. It works for my needs:
For future readers: there was one typo in Dale’s snippet (rhutil i.s.o. rs) corrected below:

import rhinoscriptsyntax as rs
def ObjectSerialNumber(object_id):
    rhobj = rs.coercerhinoobject(object_id, True, True)
    return rhobj.RuntimeSerialNumber

Thanks
-Willem