How do I get an object from GUID?

I’m creating 3D text using the TextObject command, then I want to move it.
I use LastCreatedObjects and I have the GUID.

Now what? How do I get an object based on that GUID, or alternatively, how do I find the current position of an object based on GUID?

Thanks.

1 Like

You might use one of the coerce… functions:

rs.coercecurve
rs.coercebrep
rs.coercesurface
rs.coercemesh
rs.coercerhinoobject
...

Unless your object is a block, rhino objects do not maintain a readable position value (or some kind of origin). But you could get the bounding box center or an area centroid.

c.

3 Likes

Can you elaborate or link to documentation? I can’t really find anything about these “Coerce” functions. Where are they? Why are the called that ?

@Vice,

those functions are not listed in the python helpfile yet, but you can read about their required arguments and description if you just start typing them in the Rhino Python editor like rs.coerce… (Under Windows).

Alternatively you might take a look what each of the functions does in the utility.py file which should be located here:

C:\Users\UserName\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript

Also note my reply to your other post here. Maybe you can just create the TextObject at the right position to prevent that it has to be moved at all ?

c.

Why do you need the object? Most rhinoscriptsyntax methods work directly with the object’s GUID. For most of those methods, the GUID IS the object for all intents and purposes.

As Rhino objects do not have a built-in reference point, the “current position” is some chosen point on the object, its bounding box center or some other critera that you have to define and extract.

–Mitch

I was trying to find the object.location , but now I understand that what I need is the BoundingBox.

Thanks!

7 posts were split to a new topic: Automatically bake to a layer and coerce

Hi, then how cani get object’s GUID say from a 3d point?
don’t want to use rs.GetObject(“Select object”) as you have to literally pick up a point…
Thanks!

Hi @lishiqi,

Only Rhino objects that you have added to the document have UUIDs. The points you pick on the screen using GetPoint do not have UUIDS, as they are just points.

– Dale