Home › Forums › Nazca › Clipping check, distance and length for interconnects › Reply To: Clipping check, distance and length for interconnects
Dear iv_tern,
print points
rather than pgon.points
for the polygon coordinates with respect to the first instantiated parent cell, which maximaly goes up to the cell provided to cell_iter(), the “topcell” in this context.
To get the polygon with respect to the topcell, regardless of any cell instantiation, flatten the hierarchy with flat=True
or hierarchy='flat'
.
In your case you are looking for the position with respect to the “nazca” top cell, which is always created as a blank canvas when importing nazca.
– nazca
.. – tp1
…. – polygon1
.. – tp2
…. – polygon2
That “nazca” topcell can be accessed as nd.cfg.defaultcell and you get:
for NT in nd.cell_iter(nd.cfg.defaultcell, flat=True):
if NT.cell_start:
print(f"\ncell: '{NT.cell.cell_name}'")
for i, (pgon, points, bbox) in enumerate(NT.iters['polygon']):
print(f"{i}: points: {points}, layer: '{pgon.layer}'")
output:
cell: 'nazca'
cell: 'toy_poly2'
0: points: [(40.0, 40.0), (25.0, 40.0), (26.0, 50.0), (20.0, 40.0)], layer: '1/0/None'
cell: 'toy_poly1'
0: points: [(0, 0), (0, 7), (10, 14), (0, 25)], layer: '1/0/None'
Alternatively put the design in a custom topcell:
nd.with(name='topcell') as top:
p1 = tp1.put(0, 0, 0)
p2 = tp2.put(40, 40, 90)
and use nd.cell_iter(cell=top, flat=True)
to get the coordinates as before and nd.export_gds(top)
in case you export cell “top” to gds.
Ronald