Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Howto get object centers?

$
0
0

I’m trying to get started with Rhino Python and I’m stuck with basics . For a start I’m trying to create a script that would print centers of selected items.
This does not work:

import rhinoscriptsyntax as rs
import Rhino
import scriptcontext as sc

objects = rs.GetObjects("Select objects ",preselect=True)

for object in objects:
    center = item.Geometry.GetBoundingBox(True).Center
    print(center)

What’s the correct way to do it?
I’m trying with this simple thing as it would allow me to loop thorugh things and do repetitive tasks per item using the item center.

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles