Bridging parallel curves
Orthogonal Spacing of beams along Parallel two Curves

Spacing based on maximum distance between consecutive beams

Path-20190217.dyn
15KB
Text
1
//Two Parallel Curves
2
3
a1 = Arc.ByCenterPointStartPointSweepAngle
4
(Point.ByCoordinates(0,10000),Point.Origin(),
5
90,Vector.ZAxis());
6
l1 = Line.ByStartPointDirectionLength
7
(a1.EndPoint,Vector.YAxis(),20000);
8
a2 = Arc.ByCenterPointStartPointSweepAngle
9
(Point.ByCoordinates(20000,30000),
10
l1.EndPoint,-90,Vector.ZAxis());
11
a3 = a1.Offset(5000);
12
l2 = l1.Offset(-5000);
13
a4 = a2.Offset(-5000);
14
p1 = PolyCurve.ByJoinedCurves([a1,l1,a2]);
15
p2 = PolyCurve.ByJoinedCurves([a3,l2,a4]);
16
n1 = NurbsCurve.ByPoints(p1.PointAtParameter(0..1..#100));
17
n2 = NurbsCurve.ByPoints(p2.PointAtParameter(0..1..#100));
Copied!
1
//Orthogonal Beams
2
3
max = 1000;
4
pt1 = br2(cr1,cr2,max);
5
pt2 = cr2.ClosestPointTo(pt1);
6
ln1 = Line.ByStartPointEndPoint(pt1,pt2);
7
[cr1,cr2,ln1];
8
9
//Points Spacing - Curve 1
10
d11 = List.DropItems(List.Sublists(pt1,0..1,1),-1);
11
d12 = Math.Round(List.FirstItem(d11<1>).DistanceTo(List.LastItem(d11<1>)));
12
13
14
//Points Spacing - Curve 2
15
d11 = List.DropItems(List.Sublists(pt2,0..1,1),-1);
16
d12 = Math.Round(List.FirstItem(d11<1>).DistanceTo(List.LastItem(d11<1>)));
Copied!
1
def br1(c1,c2,p1,s1)
2
{
3
r1 = c1.ParameterAtPoint(p1);
4
p2 = c2.ClosestPointTo(p1);
5
r2 = c2.ParameterAtPoint(p2);
6
p3 = c2.PointAtChordLength(s1,r2,true);
7
p4 = c1.ClosestPointTo(p3);
8
d1 = p1.DistanceTo(p4);
9
p5 = d1<=s1?p4:c1.PointAtChordLength(s1,r1,true);
10
pr = d1<=s1?c2.ParameterAtPoint(p5):c1.ParameterAtPoint(p5);
11
return = [p5,pr];
12
};
13
14
def br2(c1,c2,s1)
15
{
16
return = [Imperative]
17
{
18
n = 0;
19
ct = 0;
20
q = Math.Ceiling(c1.Length/s1);
21
p1 = c1.StartPoint;
22
p3 = [];
23
while (ct < 1)
24
{
25
p3[n] = List.FirstItem(br1(c1,c2,p1,s1));
26
ct = List.LastItem(br1(c1,c2,p1,s1));
27
p1 = p3[n];
28
n = n + 1;
29
}
30
return = p3;
31
}
32
};
Copied!

Spacing based on maximum area between consecutive beams

Path-Area.dyn
15KB
Text
1
// Orthogonal Beams
2
3
//Max are in sqm
4
max = 10;
5
//Reduce beam spacing increment (mm) for greater accuracy
6
spc = 100;
7
8
pt1 = br2(cr1,cr2,spc);
9
pt2 = cr2.ClosestPointTo(pt1);
10
ln1 = Line.ByStartPointEndPoint(pt1,pt2);
11
ln2 = List.DropItems(List.Sublists(ln1,0..1,1),-1);
12
ar1 = Surface.ByLoft(ln2).Area/1000000;
13
ar2 = Math.Sum(List.TakeItems(ar1,1..List.Count(ar1)));
14
ln3 = List.GroupByKey(List.RestOfItems(ln1),Math.Ceiling(ar2/max))["groups"];
15
16
// Beams spaced with desired area between them
17
ln4 = List.AddItemToFront(List.FirstItem(ln1),List.LastItem(ln3<1>));
18
[cr1,cr2,ln4];
19
20
//Area between two beams
21
ar3 = Math.Round(Surface.ByLoft(List.DropItems(List.Sublists(ln4,0..1,1),-1)).Area/1000000);
Copied!
1
def br1(c1,c2,p1,s1)
2
{
3
r1 = c1.ParameterAtPoint(p1);
4
p2 = c2.ClosestPointTo(p1);
5
r2 = c2.ParameterAtPoint(p2);
6
p3 = c2.PointAtChordLength(s1,r2,true);
7
p4 = c1.ClosestPointTo(p3);
8
d1 = p1.DistanceTo(p4);
9
p5 = d1<=s1?p4:c1.PointAtChordLength(s1,r1,true);
10
pr = d1<=s1?c2.ParameterAtPoint(p5):c1.ParameterAtPoint(p5);
11
return = [p5,pr];
12
};
13
14
def br2(c1,c2,s1)
15
{
16
return = [Imperative]
17
{
18
n = 0;
19
ct = 0;
20
q = Math.Ceiling(c1.Length/s1);
21
p1 = c1.StartPoint;
22
p3 = [];
23
while (ct < 1)
24
{
25
p3[n] = List.FirstItem(br1(c1,c2,p1,s1));
26
ct = List.LastItem(br1(c1,c2,p1,s1));
27
p1 = p3[n];
28
n = n + 1;
29
}
30
return = List.Flatten([c1.StartPoint,p3],-1);
31
}
32
};
Copied!
Last modified 1yr ago
Copy link
Contents