It looks like you're new here. If you want to get involved, click one of these buttons!
Hello, is there a way to get the absolute coordinates of the boxes?
iter = pya.RecursiveShapeIterator.new(layout, cell,layer_index) while not iter.at_end(): Current_Shape=iter.shape() #Get the shape in the layer Current_box=Current_Shape.box #print(Current_box.left) #LOWX_COORD #print(Current_box.bottom) #LOWY #print(Current_box.right) #UPX #print(Current_box.top) #UPY x_coordinates.extend([float(Current_box.left),float(Current_box.right)]) y_coordinates.extend([float(Current_box.bottom),float(Current_box.top)]) iter.next()
I want to store the absolute x and y coordinates (accumulated transformations) of every polygon at a particular cell. This code only gives me relative coordinates.
Is there a way to get the absolute coordinates?
I found the answer as ruby code but having hard times to translate it into python.
I would really appreciate the help.
I answered my own question lol
Very good! A role model user
At the risk of frustrating you: you actually have been very close to the simple solution: the recursive iterator has a method called "trans()" which gives you the transformation from the current to the initial cell (the one from which you started the RecursiveShapeIterator):
There is one detail that needs consideration: if your instantiation path contains instances with arbitrary rotation (e.g. 45 degree), the transformation is one that would turn a box into a different shape (a diamond for example).
This is not achieved by multiplying the transformation with the box. If you need to consider this case in general, use polygons instead of boxes: