Creating Mesh "Window" in c#/ simple loop problem


#1

Hi,

I am currently trying to scale some polyLines to get a “meshWindow”, my problem is how to set up the loop properly so it generates all faces.


scaleMersh.gh (4.6 KB)

Thanks for any hint!


#2
List<Point3d> ptsSet0 = pLines.ToList();
Point3d center = pLines.CenterPoint();
Transform xform = Transform.Scale(center, factor);

pLines.Transform(xform);


List<Point3d> ptsSet1 = pLines.ToList();

Mesh m = new Mesh();


for (int i = 0; i < 4 ; i++)
{
  var pts = new List<Point3d>();
  pts.Add(ptsSet0[i]);
  pts.Add(ptsSet0[i + 1]);
  pts.Add(ptsSet1[i + 1]);
  pts.Add(ptsSet1[i]);



  m.Vertices.AddVertices(pts);
m.Faces.AddFace(new MeshFace(i*4, i*4+1, i*4+2, i*4+3));

}
m.Vertices.CombineIdentical(true,true);

A = m;

#3

perfect!,
thanks @Petras_Vestartas!