I would like to use Python to re-organise in a clock wise order all the nested lists of points within one list.
I have several nested lists of points sorted by level and I was trying to use python to sort points on each level in a clock wise order.
import clr clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import * #The inputs to this node will be stored as a list in the IN variables. dataEnteringNode = IN import math pt = IN newTupla =  for tupla in range (len(pt)): newList =  sortedList =  x = 0 y = 0 # calcs the medium point for i in pt: x += i y += i x = x / len(pt) y = y / len(pt) med = [x,y] #calcs the arc tangent for each point for j in pt[tupla]: rads = math.atan2(-1*(j-med),j-med) rads %= 2*math.pi degs = math.degrees(rads) newPoint = (j,j,j,degs) newList.append(newPoint) #sorts the list using the angle newList = sorted(newList, key = lambda x : x) #removes the angle from the list for j in newList: newPoint = (j,j,j) sortedList.append(newPoint) OUT = sortedList
Does someone have a solution for that?
Thank you for your time !