Query an object location


#1

I’m using Python for Rhino, and I was wondering if there is a way to query a position of an object using its name or GUID. Thanks


#2

Certainly. However, as Rhino objects do not have a defined position point associated with them, you will need to decide what criteria of the object’s geometry is considered its “position”. Generally that’s the center of the bounding box, which you can get in various ways - if you are using rhinoscriptsyntax, you can just use

#bb will be the objects bounding box, which returns 8 corner points
bb=rs.BoundingBox(objID)
#then average two corner points
bb_ctr=(bb[0]+bb[6])/2

HTH, --Mitch


#3

Thank you @Helvetosaur.