 # Copy geometry by transformation of planes between two planes

Hello Rhino developers,

I am looking at a simple python script of creating an array of Rectangular box on to a list of planes. These list of planes are basically extracted by the transformation between two planes of the rectangular objects. As I am new to python, it would be great if someone can help me out. As you can see planes P1 and P2 are extracted from the centroid planes of Rectangular boxes B1 and B2(both boxes are of the same size) respectively. So how do I create a copy of the same boxes(box b1/b2) and copy them in the planes as per user defined in python? Kindly find the attached image below.

Hello!
Is your curve perpendicular to the planes? Can you share a sample file?

Yes the planes are basically like the perpendicular frames in grasshopper. I am attaching the gh file which has python code and also the rhino file.Transformation_Along curve.gh (5.1 KB)
Transformation along curve.3dm (25.8 KB)

import rhinoscriptsyntax as rs
import rhinoscript.utility as ru
import Rhino
import scriptcontext
import random

#Step1 - Creating list of crossectionplane for 2dRectangular brick placement along Brick laying curve
#Substeps are explained as below
#1A Extracing curvedomain of interpolated brick curve
crvdomain = rs.CurveDomain(brkcurve)
#1B Empty-list for creating vertical cross section of brickplanes
crosssections =
#1C Defining the step size for brk_plane creation
step_size = (crvdomain - crvdomain)/segments
t = crvdomain
#For loop for accessing crvdomain with step_size
#frange is a function in module rhinoscript.utility:
#frange needs(start,stop,step) as inputs for the file
for t in rs.frange(crvdomain,crvdomain,step_size):
#crvcurvature returns the curvature of interpolated brick curve
#at parameter t
crvcurvature = rs.CurveCurvature(brkcurve,t)
crvTangent = rs.CurveTangent(brkcurve,t)
crvPoint = rs.EvaluateCurve(brkcurve ,t)
crvPerp = (0,0,1)
crvNormal = rs.VectorCrossProduct(crvTangent,crvPerp)
E = rs.CreateVector(crvNormal)
crosssectionplane = rs.CreatePlane(crvPoint,crvNormal,crvTangent)
crosssections.append(crosssectionplane)

#Step7 - Creating 3DRectangular Brick placement along the crosssection[i] using forloop and Rhino.Geometry.Box method
for i in range(len(crosssections)):
#x = rs.GetInteger(‘Enter the length dimension of the brick’)
#y = rs.GetInteger(‘Enter the width dimension of the brick’)
#z = rs.GetInteger(‘Enter the height dimension of the brick’)
x = 1.6
y = 4.8
z = 1.2

``````plnAB = crosssections
#Interval is like a range in Grasshopper
interval_x = Rhino.Geometry.Interval(-0.5*x,0.5*x)
interval_y = Rhino.Geometry.Interval(-0.5*y,0.5*y)
interval_z = Rhino.Geometry.Interval(-0.5*z,0.5*z)

#Look at Box Constructor methods in RhinoCommon  API\
``````

boxAB = Rhino.Geometry.Box(crosssections[i],interval_x,interval_y,interval_z)

This is how the code looks like , but i am not understanding how do i make the planes extracted from the start and the end boxes

I got it sorted .Thanks everyone

1 Like