import pya class PSAW(pya.PCellDeclarationHelper): def __init__(self): # Important: initialize the super class super(PSAW, self).__init__() gapL= 100 busBarW= 150000 busBarL= 1500000 padHotW= 200000 padHotL= 200000 padGndW= 200000 padGndL= 200000 padGndUConnL= 2*200000+2*10000 padGndUConnW = 150000 padClrncHotGnd = 100 # declare the parameters self.param("lyr", self.TypeLayer, "Layer", default = pya.LayerInfo(1,0)) self.param("shp", self.TypeShape, "", default = pya.DPoint(0, 0)) self.param("gapL", self.TypeDouble, "Gap Length", default = busBarW) self.param("busBarW", self.TypeDouble, "Busbar Width", default = busBarW) self.param("busBarL", self.TypeDouble, "Busbar Length", default = busBarL) self.param("padHotW", self.TypeDouble, "Hot Pad Width", default = padHotW) self.param("padHotL", self.TypeDouble, "Hot Pad Length", default = padHotL) self.param("padGndW", self.TypeDouble, "Gnd Pad Width", default = padGndW) self.param("padGndL", self.TypeDouble, "Gnd Pad Length", default = padGndL) self.param("padGndUConnW", self.TypeDouble, "Pad Gnd U-Shaped Width", default = padGndUConnW) self.param("padGndUConnL", self.TypeDouble, "Pad Gnd U-Shaped Length", default = padGndUConnL) def display_text_impl(self): return "PSAW - SAWD (Lyr=" + str(self.lyr) + ",gapL=" + ('%.3f' % (self.gapL)) + ")" def coerce_parameters_impl(self): pass def produce_impl(self): self.cell.clear(self.lyr_layer) # Clear shapes already on the layer shps = [ s for s in self.cell.each_shape(self.lyr_layer) ] print("# of shapes in layer (at the start of produce_impl()): " + str(len(shps))) # finding the PCell declaration object ... lib = pya.Library.library_by_name("MyLibT2") if lib == None: raise Exception("Unknown lib 'MyLibT2'") pcell_decl = lib.layout().pcell_declaration("ParrTnPatch"); if pcell_decl == None: raise Exception("Unknown PCell 'ParrTnPatch'") param = {"lyr": self.layer, "digitW": 1500, "digitL": 70000} pcell_var = self.layout.add_pcell_variant(lib, pcell_decl.id(), param) self.cell.insert(pya.CellInstArray(pcell_var, pya.Trans.R0)) class MyPCellLib(pya.Library): def __init__(self): self.description = "My PCell library" self.layout().register_pcell("PSAW", PSAW()) self.register("MyPCellLib") MyPCellLib()