Moves, scales, or rotates an object given a 4x4 transformation matrix. The matrix acts on the left. The following table demonstrates the translation matrix configuration:
rhinoscriptsyntax.TransformObject (object_id, matrix, copy=False)
rhinoscript.object.TransformObject (object_id, matrix, copy=False)
object_id |
Required. String or Guid. The identifier of the object. |
matrix |
Required. 4x4 list of numbers or Transform. The transformation matrix. |
copy |
Optional. Boolean. Copy the object. If omitted, the object will not be copied (False). |
Guid |
The identifier of the transformed object if successful. |
# Rotate an object by theta degrees about the world Z axis
import math
import rhinoscriptsyntax as rs
degrees = 90.0 # Some angle
radians = math.radians(degrees)
c = math.cos(radians)
s = math.sin(radians)
matrix = []
matrix.append( [c,-s, 0, 0] )
matrix.append( [s, c, 0, 0] )
matrix.append( [0, 0, 1, 0] )
matrix.append( [0, 0, 0, 1] )
obj = rs.GetObject("Select object to rotate")
if obj: rs.TransformObject( obj, matrix )