How to rotate a block on the Y axis of the Gumball , with gumball aligned to object?

gumball

#1

Hi,
I can’t find a way to rotate, with python, a block on the Y axis of the Gumball, with Gumball aligned to object.
BlockInstanceInsertPoint doesn’t return a vector…

Any advice?
Thank you


(Willem Derks) #2

Hi,

You can retrieve the Blockinstance Xform and use that to transform a worldXY plane.
From that transformed plane you can than get the Y-Axis.

pseudocode:

xform = rs.BlockInstanceXform(blockinstance)
plane = rs.WorldXYPlane()
plane.Transform(xform)
YAxis = plane.YAxis

does this help?


#3
import rhinoscriptsyntax as rs
blockinstance = rs.SelectedObjects()
xform = rs.BlockInstanceXform(blockinstance)
plane = rs.WorldXYPlane()
plane.Transform(xform)
YAxis = plane.YAxis
rs.RotateObject(blockinstance,plane.Origin,180,plane.YAxis)

thank you! It works!