Transformed Polyline doesnt display

Sorry I recall this may be answered on the forum previously but believe me Ive searched.

As you can see my PL1 is displayed the same as PL2 ie its been rotated as well .
Ive tried to “Duplicate” PL1 etc etc.

private void RunScript(object x, object y, ref object A, ref object B)
{
Point3d pts = new Point3d[4]; // An array of 4 points (vertices)for each polygon.
Point3d p1 = new Point3d(0, 3, 0); Point3d p2 = new Point3d(-3, 3, 0);
Point3d p3 = new Point3d(-3, 9, 0); Point3d p4 = new Point3d(0, 9, 0);

Polyline PL1 = new Polyline{p1, p2, p3, p4};

Polyline PL2 = PL1;// Maybe a REFERENCE?

Transform trans = Transform.Rotation(-Math.PI / 2, Vector3d.ZAxis, new Point3d(6, 6, 0));
PL2.Transform(trans);

A = PL1;
B = PL2; // Same as PL1!

}

expt.gh (3.9 KB)

Hello,
If you write
PL2=Pl1;
It means PL2 and PL1 are exactly the same thing. (or two references pointing the same object)
Try

Polyline PL2=new Polyline(PL1);

You can do something like this only on primitive variables like int,double, points, lines but other classes like polylines, curves, meshes, must be duplicated, elsewise they point to the same object.

Thanks Polyline PL1 = PL.Duplicate(); Don’t know why I didn’t see it . (Is there an emoji for feeling a bit silly )