Do users have the power to re-assign uuids?

I understand that objects when moved are deleted and recreated, and their ID is being copied.

Can I do this from python?

Getting the id before deleting an object and assigning it to another object after deletion?

Please check the documentation at

https://developer.rhino3d.com/api/RhinoCommon/html/P_Rhino_DocObjects_ObjectAttributes_ObjectId.htm

infer from this: set the ID for an object in its attributes. The ID property on the object level is just a getter.

1 Like

You can make a new object and then “replace” it:

import scriptcontext as sc
— do you thang—
sc.doc.Objects.Replace(oldOBJ, newOBJ)

Does that help?

By the way, the new object shall not be an object in the document, just a newly defined object (use rhino commn to make a new one or coerce a mesh, or make a new mesh or coerce something else or something)

Read more here:

1 Like

Interesting, I did not know about this, thanks.

I will try both ways.

Then it is not what I am looking for. I was thinking about assigning the uuid of deleted object to another existing object.

You can also use the uuid module in python to create your own independent set of uuids, probably using uuid.uuid4() would be best.

is this for Cpython3?

it’s in Ironpython (and also in Cpython), though the autocomplete won’t find it for you in Rhino

import uuid
    
print uuid.uuid4()
1 Like

I see that now, thanks for the hint. @Dancergraham :slight_smile:

Is there a reason to do this?

Yes :slight_smile: