Hi,
as in the title described the problem is strange.
I copy the code from the c# component and compile it and it outputs invalid polylines when the division number is uneven:
private void RunScript(Surface S, int U, int V, ref object A)
{
var pLines = new List<Polyline>();
double uStep = 1.0 / U;
double vStep = 1.0 / V;
Point3d ptA;
Point3d ptB;
Point3d ptC;
Point3d ptD;
S.SetDomain(0, new Interval(0, 1));
S.SetDomain(1, new Interval(0, 1));
for (int i = 0; i < U + 1; i++)
{
for (int j = 0; j < V + 1; j++)
{
if ((i + j) % 2 == 1)
{
var pts = new List<Point3d>();
if (i > 0)
{
ptA = S.PointAt((i - 1) * uStep, j * vStep);
pts.Add(ptA);
}
else
{
ptA = S.PointAt(i * uStep, j * vStep);
pts.Add(ptA);
}
if (j > 0)
{
ptB = S.PointAt(i * uStep, (j - 1) * vStep);
pts.Add(ptB);
}
else
{
ptB = S.PointAt(i * uStep, j * vStep);
pts.Add(ptB);
}
if (i < U)
{
ptC = S.PointAt((i + 1) * uStep, j * vStep);
pts.Add(ptC);
}
else
{
ptC = S.PointAt(i * uStep, j * vStep);
pts.Add(ptC);
}
if (j <= V - 1)
{
ptD = S.PointAt(i * uStep, (j + 1) * vStep);
pts.Add(ptD);
}
else
{
ptD = S.PointAt(i * uStep, j * vStep);
pts.Add(ptD);
}
pts.Add(ptA);
pLines.Add(new Polyline(pts));
}
}
}
A = pLines;
}
here the vs file:CrvDiamondComponent.cs (5.5 KB)
Thanks for aclaration!