Transforming objects

1. Rotating objects

1.png
import rhinoscriptsyntax as rs
X=rs.XformRotation2(y,(0,0,1),(0,0,0))
a=rs.TransformObject(x,X)

2.png

2. Translating objects

3.png
import rhinoscriptsyntax as rs
E=rs.PointCoordinates(E)
S=rs.PointCoordinates(S)
V=E-S
X=rs.XformTranslation(V)
a=rs.TransformObject(x,X)

or here is another way to do exactly the same thing,
import rhinoscriptsyntax as rs
V=rs.VectorCreate(E,S)
X=rs.XformTranslation(V)
a=rs.TransformObject(x,X)

4.png

3. Scaling objects

5.png
import rhinoscriptsyntax as rs
X=rs.XformScale(S)
a=rs.TransformObject(x,X)

6.png

4. Plane to plane

7.png
Codes in planeCreator.
import rhinoscriptsyntax as rs
a=rs.PlaneFromFrame((1,2,8),(1,0,0),(0,0,1))

The main code that takes a plane as an input parameter.
import rhinoscriptsyntax as rs
X=rs.XformRotation1(rs.WorldXYPlane(),plane)
a=rs.TransformObject(x,X)

here is another way to do exactly the same thing.
import rhinoscriptsyntax as rs
X=rg.Transform.PlaneToPlane(rs.WorldXYPlane(),plane)
a=rs.TransformObject(x,X)

8.png

5. Distributing objects on a surface

9.png
1st step;
import rhinoscriptsyntax as rs
a=list()
for i in range(0,11):
    for j in range(0,11):
        uv=rs.SurfaceParameter(Srf,(i/10,j/10))
        plane=rs.SurfaceFrame(Srf,uv)
        a.append(plane)

10.png
2nd step;
import rhinoscriptsyntax as rs
a=list()
for i in range(0,11):
    for j in range(0,11):
        uv=rs.SurfaceParameter(Srf,(i/10,j/10))
        plane=rs.SurfaceFrame(Srf,uv)
        X=rs.XformRotation1(rs.WorldXYPlane(),plane)
        a.append(rs.TransformObject(x,X,True))

11.png
finally;
import rhinoscriptsyntax as rs
a=list()
for i in range(0,11):
    for j in range(0,11):
        uv=rs.SurfaceParameter(Srf,(i/10,j/10))
        plane=rs.SurfaceFrame(Srf,uv)
        X=rs.XformRotation1(rs.WorldXYPlane(),plane)
        if i==0 or j==0 or i==10 or j==10:
            Y=rs.XformScale(2)
            X=X*Y
        a.append(rs.TransformObject(x,X,True))

12.png

6. Distributing objects along a curve

13.png
1st step;
import rhinoscriptsyntax as rs
a=list()
for i in range(0,11):
    t=rs.CurveParameter(Crv,i/10)
    plane=rs.CurveFrame(Crv,t)
    X=rs.XformRotation1(rs.WorldXYPlane(),plane)
    a.append(rs.TransformObject(x,X,True))

14.png
2nd step;
import rhinoscriptsyntax as rs
a=list()
for i in range(0,11):
    t=rs.CurveParameter(Crv,i/10)
    plane=rs.CurveFrame(Crv,t)
    X=rs.XformRotation1(rs.WorldXYPlane(),plane)
    if i==0 or i==10:
        Y=rs.XformScale(2)
        X=X*Y
    a.append(rs.TransformObject(x,X,True))

15.png
3rd step;
16.png
import rhinoscriptsyntax as rs
a=list()
for i in range(0,11):
    t=rs.CurveParameter(Crv,i/10)
    plane=rs.CurveFrame(Crv,t)
    X=rs.XformRotation1(rs.WorldXYPlane(),plane)
    Z=rs.XformRotation2(y,(0,1,0),(0,0,0))
    X=X*Z
    if i==0 or i==10:
        Y=rs.XformScale(2)
        X=X*Y
    a.append(rs.TransformObject(x,X,True))

17.png