It looks like you're new here. If you want to get involved, click one of these buttons!
I'd like to get a cell, which contain only contact (1:0), diffusion (2:0), metal1 (3:0). If the cell contain other layer(s), then don't get the cell.
e.g. other layer(s): (4:0), (5:0), (6:0)
I got the below code for find the specific cell I want, is there any easy way to check this stuff? Cause other layer(s) is much more than 3.
import pya
ly = pya.CellView.active().layout()
l1= ly.layer(1, 0)
l2= ly.layer(2, 0)
l3= ly.layer(3, 0)
l4= ly.layer(4, 0)
l5= ly.layer(5, 0)
l6= ly.layer(6, 0)
for c in ly.each_cell():
l1_exi = c.shapes(l1).size() > 0
l2_exi = c.shapes(l2).size() > 0
l3_exi = c.shapes(l3).size() > 0
l4_exi = c.shapes(l4).size() < 0
l5_exi = c.shapes(l5).size() < 0
l6_exi = c.shapes(l6).size() < 0
l123 = ((l1_exi and l2_exi) and l3_exi )
c1 = l123 and l4_exi
c2 = l123 and l5_exi
c3 = l123 and l6_exi
if ( c1 or c2 or c3 == True):
print(c.name)
BG,
KM
Comments
Hi,
first of all there isn't a much better alternative.
But you can code the search in a loop and end the loop as soon as the condition isn't satisfied. With a loop you can check as many layers as you like.
In your code "size() < 0" does not make sense. size() cannot be less than zero.
Here is a working example for a more generic code:
Please note the comment about subcells.
Matthias