So I have a list of curves in Dynamo Studio that were imported from Civil3D. The Civil3D drawing had a bunch of building pads as lines and arcs. When they were imported into Dynamo Studio, these lines and arcs were disorganized. I want to recreate the building pads in Dynamo Studio by getting the four corner points of each building pads(startpoints/endpoints of the lines/arcs) and creating a polygon from those four points. Everytime I run my code, it says run started and it never finishes. Am I stuck in a loop? HELP PLEASE.
Here is My Code:
def SortLists(BP:var[])
{
Lots = {};
return = [Imperative]
{
cnt = List.Count(BP);
while (cnt > 0)
{
Lot = {};
StartPt = BP[0].StartPoint;
EndPt = BP[0].EndPoint;
Lot = List.AddItemToEnd(StartPt,Lot);
OccupiedPt = StartPt;
BP = List.RemoveItemAtIndex(BP, 0);
cnt = List.Count(BP);
while (OccupiedPt != EndPt)
{
i = 0;
while (i < cnt)
{
sp = BP[i].StartPoint;
ep = BP[i].EndPoint;
if (sp == OccupiedPt)
{
Lot = List.AddItemToEnd(ep, Lot);
OccupiedPt = ep;
BP = List.RemoveItemAtIndex(BP, i);
cnt = List.Count(BP);
i = cnt;
}
elseif (ep == OccupiedPt)
{
Lot = List.AddItemToEnd(sp, Lot);
OccupiedPt = sp;
BP = List.RemoveItemAtIndex(BP, i);
cnt = List.Count(BP);
i = cnt;
}
}
}
pg = Polygon.ByPoints(Lot);
Lots = List.AddItemToEnd(pg, Lots);
}
return = cnt;
}
};
SortLists(curves);