I’m trying to create a graph to collect the viewport locations in a given sheet and then renumber the detail view according their location on sheet.
So far I can collect the viewports and their centroid location. However I’m struggling to obtain the left bottom corner of the viewport and I’ve no clue of how to -once the coordinates are sorted- sort the viewports list following the same order as the coordinates list (given 2 lists of the same number of elements make the sort order on one match the other).
The graph currently works fine when renumbering views in the selection order.
What I’m trying to figure out is the upper half of the graph, from the Viewport.LocationData node onwards.
from Autodesk.DesignScript.Geometry import *
Coordinates=[[pt.X, pt.Y,vp] for vp, pt in zip (Viewports,Pts)]
Coordinates.sort(key=lambda x: (-x, x))
OUT=[Viewport for Viewport in Coordinates]