Working Planes

## 1. Review of conditions statements

import rhinoscriptsyntax as rs
a=list()
for i in range(20):
if i%4==0:
else:
plane=rs.PlaneFromFrame((i,0,0),(1,0,0),(0,1,0))

"i%4" is the modulo of i with 4. (Modulo is a remainder of i divided by 4)

## 2. Planes

We have several ways to create planes.

import rhinoscriptsyntax as rs
a=list()
a.append(rs.PlaneFromPoints((0,0,0),(1,0,0),(0,1,0)))
a.append(rs.PlaneFromFrame((0,10,0),(1,0,0),(0,1,0)))
a.append(rs.PlaneFromNormal((0,0,10),(0,0,1),(1,0,0)))

## 3. PlaneFromPoints

import rhinoscriptsyntax as rs

a=rs.PlaneFromPoints(O,X,Y)

## 4. PlaneFromFrame

import rhinoscriptsyntax as rs
a=rs.PlaneFromFrame(O,vX,vY)

## 5. PlaneFromNormal

import rhinoscriptsyntax as rs
a=rs.PlaneFromNormal(O,vN,vX)

## 6. Working Planes

import rhinoscriptsyntax as rs
points=list()
points.append((6,1,0))
points.append((11,0,0))
points.append((11,6,0))
points.append((6,6,0))

import rhinoscriptsyntax as rs
plane=rs.WorldXYPlane()
points=list()
points.append(rs.EvaluatePlane(plane,(6,1)))
points.append(rs.EvaluatePlane(plane,(11,0)))
points.append(rs.EvaluatePlane(plane,(11,6)))
points.append(rs.EvaluatePlane(plane,(6,6)))

You will get the same result as the previous one.

Comment out "plane=rs.WorldXYPlane()" and add an input parameter with name "plane".
Connect all the planes to "plane".
You may get

## 7.

import rhinoscriptsyntax as rs

points=rs.PolylineVertices(pL)
N=len(points)-1
a=list()
for i in range(N):
O=(points[i]+points[i+1])/2   #Point+Point=Point
vY=points[i+1]-points[i]      #Point-Point=Vector
vX=rs.VectorCrossProduct(vY,(0,0,1))
plane=rs.PlaneFromFrame(O,vX,vY)

import rhinoscriptsyntax as rs

points=rs.PolylineVertices(pL)
N=len(points)-1
a=list()
for i in range(N):
O=(points[i]+points[i+1])/2   #Point+Point=Point
vY=points[i+1]-points[i]      #Point-Point=Vector
vX=rs.VectorCrossProduct(vY,(0,0,1))
plane=rs.PlaneFromFrame(O,vX,vY)
ps=list()
ps.append(rs.EvaluatePlane(plane,(-0.5,-2.5)))
ps.append(rs.EvaluatePlane(plane,(0.5,-2.5)))
ps.append(rs.EvaluatePlane(plane,(0.5,2.5)))
ps.append(rs.EvaluatePlane(plane,(-0.5,2.5)))
ps.append(rs.EvaluatePlane(plane,(-0.5,-2.5)))