Hi Frederick, great I'm glad that does what you were needing.
re:
> I gather the ID of an object is not like a GUID that is unique and unchanging.
>
Actually the ID of an object is a unique GUID that doesn't change.
The issue is that it is tied to that specific version of the object. With any type of editing
(including transforms), the result of the edit will have it's own new unique ID value.
re:
> In your example code you used a command removeUserText.
>
> What other commands are there related to user text?
From:
http://moi3d.com/wiki/V5Beta#Mar-28-2023
Implement document user text for scripts
New document user text values so scripts can add data that is saved and restored from 3DM files.
New methods under moi.geometryDatabase:
.setUserText( Key, Value ); - Set text value for given key.
.getUserText( Key ); - Returns text value for given key, or undefined if not present.
.removeUserText( Key ); - Remove user text value for given key.
.getAllUserText(); - Return list of all user text, each object has .key and .value properties.
.clearAllUserText(); - Clear all document user text.
There is also now object user text available for scripts to store data on an object:
.setUserText( Key, Value ); - Set text value for given key.
.getUserText( Key ); - Returns text value for given key, or undefined if not present.
.removeUserText( Key ); - Remove user text value for given key.
.getAllUserText(); - Return list of all user text, each object has .key and .value properties.
.clearAllUserText(); - Clear all object user text.
Document user text can also be viewed and edited under File > Notes > "Document user text" button and object user text will show on the "Details..." object properties dialog.
- Michael