Bridging parallel curves

Orthogonal Spacing of beams along Parallel two Curves

Spacing based on maximum distance between consecutive beams

//Two Parallel Curves
a1 = Arc.ByCenterPointStartPointSweepAngle
(Point.ByCoordinates(0,10000),Point.Origin(),
90,Vector.ZAxis());
l1 = Line.ByStartPointDirectionLength
(a1.EndPoint,Vector.YAxis(),20000);
a2 = Arc.ByCenterPointStartPointSweepAngle
(Point.ByCoordinates(20000,30000),
l1.EndPoint,-90,Vector.ZAxis());
a3 = a1.Offset(5000);
l2 = l1.Offset(-5000);
a4 = a2.Offset(-5000);
p1 = PolyCurve.ByJoinedCurves([a1,l1,a2]);
p2 = PolyCurve.ByJoinedCurves([a3,l2,a4]);
n1 = NurbsCurve.ByPoints(p1.PointAtParameter(0..1..#100));
n2 = NurbsCurve.ByPoints(p2.PointAtParameter(0..1..#100));
//Orthogonal Beams
max = 1000;
pt1 = br2(cr1,cr2,max);
pt2 = cr2.ClosestPointTo(pt1);
ln1 = Line.ByStartPointEndPoint(pt1,pt2);
[cr1,cr2,ln1];
//Points Spacing - Curve 1
d11 = List.DropItems(List.Sublists(pt1,0..1,1),-1);
d12 = Math.Round(List.FirstItem(d11<1>).DistanceTo(List.LastItem(d11<1>)));
//Points Spacing - Curve 2
d11 = List.DropItems(List.Sublists(pt2,0..1,1),-1);
d12 = Math.Round(List.FirstItem(d11<1>).DistanceTo(List.LastItem(d11<1>)));
def br1(c1,c2,p1,s1)
{
r1 = c1.ParameterAtPoint(p1);
p2 = c2.ClosestPointTo(p1);
r2 = c2.ParameterAtPoint(p2);
p3 = c2.PointAtChordLength(s1,r2,true);
p4 = c1.ClosestPointTo(p3);
d1 = p1.DistanceTo(p4);
p5 = d1<=s1?p4:c1.PointAtChordLength(s1,r1,true);
pr = d1<=s1?c2.ParameterAtPoint(p5):c1.ParameterAtPoint(p5);
return = [p5,pr];
};
def br2(c1,c2,s1)
{
return = [Imperative]
{
n = 0;
ct = 0;
q = Math.Ceiling(c1.Length/s1);
p1 = c1.StartPoint;
p3 = [];
while (ct < 1)
{
p3[n] = List.FirstItem(br1(c1,c2,p1,s1));
ct = List.LastItem(br1(c1,c2,p1,s1));
p1 = p3[n];
n = n + 1;
}
return = p3;
}
};

Spacing based on maximum area between consecutive beams

// Orthogonal Beams
//Max are in sqm
max = 10;
//Reduce beam spacing increment (mm) for greater accuracy
spc = 100;
pt1 = br2(cr1,cr2,spc);
pt2 = cr2.ClosestPointTo(pt1);
ln1 = Line.ByStartPointEndPoint(pt1,pt2);
ln2 = List.DropItems(List.Sublists(ln1,0..1,1),-1);
ar1 = Surface.ByLoft(ln2).Area/1000000;
ar2 = Math.Sum(List.TakeItems(ar1,1..List.Count(ar1)));
ln3 = List.GroupByKey(List.RestOfItems(ln1),Math.Ceiling(ar2/max))["groups"];
// Beams spaced with desired area between them
ln4 = List.AddItemToFront(List.FirstItem(ln1),List.LastItem(ln3<1>));
[cr1,cr2,ln4];
//Area between two beams
ar3 = Math.Round(Surface.ByLoft(List.DropItems(List.Sublists(ln4,0..1,1),-1)).Area/1000000);
def br1(c1,c2,p1,s1)
{
r1 = c1.ParameterAtPoint(p1);
p2 = c2.ClosestPointTo(p1);
r2 = c2.ParameterAtPoint(p2);
p3 = c2.PointAtChordLength(s1,r2,true);
p4 = c1.ClosestPointTo(p3);
d1 = p1.DistanceTo(p4);
p5 = d1<=s1?p4:c1.PointAtChordLength(s1,r1,true);
pr = d1<=s1?c2.ParameterAtPoint(p5):c1.ParameterAtPoint(p5);
return = [p5,pr];
};
def br2(c1,c2,s1)
{
return = [Imperative]
{
n = 0;
ct = 0;
q = Math.Ceiling(c1.Length/s1);
p1 = c1.StartPoint;
p3 = [];
while (ct < 1)
{
p3[n] = List.FirstItem(br1(c1,c2,p1,s1));
ct = List.LastItem(br1(c1,c2,p1,s1));
p1 = p3[n];
n = n + 1;
}
return = List.Flatten([c1.StartPoint,p3],-1);
}
};