Sorting Multiple curves

I have a list of curves imported from a DWG. These curves used to be lines and arcs in Civil3D for building pads. I want to organize the points on these curves so that they can enclose. here is my code:

def SortList(c:var[])
{
SortedList = {};
i = 0;
cnt = List.Count©;
return = [Imperative]
{
while (i<cnt)
{
sp = c[0].StartPoint();
ep = c[0].EndPoint();
sp1 = c[i].StartPoint();
if(sp1==sp)
{
c=List.DropItems(c,1);
SortedList[i] = sp1;
i=i+1;
}
elseif(sp1==ep)
{
c=List.DropItems(c,1);
SortedList[i] = sp1;
i=i+1;
}
else
{
c=List.DropItems(c,1);
i=i+1;
}
}
return = SortedList;
}

};
SortList(curves);

***cnt = List.Count©;

******cnt = List.Count ( c );

Archi-lab has a node Group Curves that should do just that.

1 Like

How do I access that?

Install the Archi-lab package from the package manager.
Check out the Dynamo Primer or search the forums for help if you get stuck.