Home Forums Nazca Clipping check, distance and length for interconnects Reply To: Clipping check, distance and length for interconnects

#6090
iv_tern
Member

Dear Ronald, thank you very much for your prompt response – this is almost what I’m looking for.

If I run the following code:

import nazca as nd

nd.clear_layers()
nd.clear_layout()

toy_points1=[(0,0), (0,7), (10, 14), (0,25)]
toy_points2=[(0,0), (0,15), (10, 14), (0,20)]

with nd.Cell('toy_poly1') as tp1:
    toy_polygon1=nd.Polygon(points=toy_points1, layer=1).put(0)
    nd.Pin('a0').put(0, 0, 180)
    nd.Pin('b0').put(10, 2.5, 0)

with nd.Cell('toy_poly2') as tp2:
    toy_polygon2=nd.Polygon(points=toy_points2, layer=1).put(0)
    nd.Pin('a0').put(0, 0, 180)
    nd.Pin('b0').put(10, 2.5, 0)

p1 = tp1.put(0,0,0)
p2 = tp2.put(40,40,90)

print("points in original polygon:")
for NT in nd.cell_iter(p1):  # NT is a named tuple object
    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: {pgon.points}, layer: '{pgon.layer}'")

print("points in original polygon:")
for NT in nd.cell_iter(p2):  # NT is a named tuple objec
    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: {pgon.points}, layer: '{pgon.layer}'")

I get this output:

points in original polygon:

cell: 'toy_poly1'
0: points: [(0, 0), (0, 7), (10, 14), (0, 25)], layer: '1/0/None'
points in original polygon:

cell: 'toy_poly2'
0: points: [(0, 0), (0, 15), (10, 14), (0, 20)], layer: '1/0/None'

Whereas I’m looking for the output, that takes into account the fact that p2 has been .put at 40,40 and rotated 90. I.e. I’m interested in the points with the origin of the entire mask, as opposed to the origin of the top cell, if this makes sense.

Regards,
iv_tern