 Get Geometry details from guid

Hi,
I wanted to get geometry details(programatically) such as coordinates of a point/object by passing guid of that object. Please help me with solution

Note:
I am using Rhino6 and grasshopper is not used here, also its appreciated if the solution provided doesn’t use grasshopper

Hi @sumuk,

You should indicate, which programming language you are using!

If you’re coding in python, you could achieve this by coercing your GUID to the corresponding geometry type:

import rhinoscriptsyntax as rs
import random

# Add a random point guid
x = random.randint(0, 10) # random integer between 0 and 10
y = random.randint(0, 10) # random integer between 0 and 10
z = random.randint(0, 10) # random integer between 0 and 10

# Coerce guid to point
pt = rs.coerce3dpoint(pt_id)

# Get the point coordinates
x, y, z = pt

Another possibility would be to use rhinocommon, instead of rhinoscriptsyntax, to avoid having to deal with coercions and guids.

An example could look like this:

import Rhino.Geometry as rg
import random

# Construct a random point
x = random.randint(0, 10) # random integer between 0 and 10
y = random.randint(0, 10) # random integer between 0 and 10
z = random.randint(0, 10) # random integer between 0 and 10
pt = rg.Point3d(x, y, z)

# Get the point coordinates
x, y, z = pt

Happy holidays! 2 Likes