I’m trying to rotate an object around it’s own center. So I have found the centroid of its bounding box, but I’m stumped as to how I should use the coordinate information of this centroid to define the rotation center:
import rhinoscriptsyntax as rs
import Rhino
object_ids = rs.NormalObjects()
for id in object_ids:
bbox = rs.BoundingBox(id)
center = rs.PointDivide(rs.PointAdd(bbox[4], bbox[0]), 2.0)
rs.RotateObject(id, center, 45.0, Rhino.Geometry.Vector3d.ZAxis)
For info this is rhinoscriptsyntax in Python, which is different from the VBScript-based RhinoScript. You can label questions with Python and have more chances of getting an answer from someone who knows Python.