algorithmic modeling for Rhino
I am writing because I am having a problem I am unable to solve. It might be something silly but I don´t find the solution.
I woul like to rotate a set of rectangles to make an elevation of a façade and I am using the Transform.Rotate function ("set of panels 1" in the image I am attaching). The thing is I try the same code for only one rectangle ("panel 2") to find out what goes wrong and ... it works!, as you can see from the equalty of the centroids. I don´t understand what is going on! Any help?
I am posting both "code 1" and "code 2" and a screenshot.
CODE 1
private void RunScript(DataTree<Rectangle3d> rec, DataTree<Point3d> centr, DataTree<Vector3d> vec, ref object A)
{
DataTree<Rectangle3d> elevation = new DataTree<Rectangle3d>();
double angleRot = Math.PI / 2;
Point3d ptoRot = new Point3d();
for(int pathC = 0; pathC < rec.BranchCount - 1; pathC++)
{
for(int itemC = 0; itemC < rec.Branch(pathC).Count; itemC++)
{
GH_Path ruta = new GH_Path(rec.Path(pathC));
ptoRot = rec.Branch(pathC)[0].Corner(0);
rec.Branch(pathC)[itemC].Transform(Transform.Rotation(angleRot, Vector3d.ZAxis, ptoRot));
elevation.Add(rec.Branch(pathC)[itemC], ruta);
}
}
A = elevation;
}
CODE 2
private void RunScript(Rectangle3d x, ref object A)
{
x.Transform(Transform.Rotation(Math.PI / 2, Vector3d.ZAxis, x.Corner(0)));
A = x;
}
Thanks in advance.
Cheers!
Tags:
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by