Dictionary based on line angles

Hi guys,
I have a polygon made up of 6 curves. Visually I see it as if it is made up of 4 sides.
So in the end, I want to make a Dictionary that groups 6 curves into 4 based on their angle difference.
if Angle crv01-02 < 90 then change group
if Angle crv01-02 > 90 then keep in same group

To make things clear for this shape, the dictionary should be :
key - value
a - crv01
b - crv02
c - crv03, 04, 05
d - crv06-07

Another point : I am also not sure how revit measure angles between 2 lines. Ideally, if angle btw 2 lines is measured clockwise ( as in drawing Protector ) , then I would group them so
if angle btw line1 - 2 is 0-135° change group
if angle btw line1 - 2 is 135-225° same group
if angle btw line1 - 2 is 225-360° change group

Any idea how to sort curves into dictionary based on angles? at the moment I have this graph. Any help would be wonderful



1 Like

@hassan.orion ,

thats weard stuff …


do you try to wheel naming by the angles that you get feeded?

KR

Andreas

1 Like

Good evening,
Here is an approach (to be checked)
collection of angles (Node and function solution)
and dictionary formation

Function 1:

def vec_l_lsup(Pt:var[])
{
return [Imperative]
{
Pt_ut=
DSCore.List.Flatten(
DSCore.List.AddItemToEnd(Pt[0..2],Pt));
res=[];
Side=[];
for (i in 0..(DSCore.List.Count(Pt_ut)-4))
{res[i]=
Autodesk.Vector.AngleAboutAxis(
Autodesk.Vector.ByTwoPoints(Pt_ut[i],Pt_ut[i+1]),
Autodesk.Vector.ByTwoPoints(Pt_ut[i+2],Pt_ut[i+1]),
Autodesk.Vector.ByCoordinates(0,0,1));
}
return res;
}
};
//Have fun with DesignScript (Thanks M. EdSonMatt)

Function 2:

def ajout(a:var[],b:var[])
{
return [Imperative]
{
res=[];
for (i in 0..(DSCore.List.Count(a)-1))
{
res[i]=[a[i],b[i]];
}
return res;
}
};

Function 3:

def soustraction(N:var[])
{return [Imperative]
{
k=DSCore.List.Count(N);
res2[0]=N[0];
for (i in 1..(k-1))
{
res2[i]=N[i]-N[i-1];
}
return res2;
}
};

script:
10 aout forum anglais rep2.dyn (67.1 KB)

Cordially
christian.stan

1 Like

Could the Line.Direction Node be of help here?

1 Like