Closed joamatab closed 2 weeks ago
import kfactory as kf class LayerInfos(kf.LayerInfos): WG: kf.kdb.LayerInfo = kf.kdb.LayerInfo(1, 0) WGEX: kf.kdb.LayerInfo = kf.kdb.LayerInfo(2, 0) # WG Exclude CLAD: kf.kdb.LayerInfo = kf.kdb.LayerInfo(4, 0) # cladding FLOORPLAN: kf.kdb.LayerInfo = kf.kdb.LayerInfo(10, 0) # Make the layout object aware of the new layers: LAYER = LayerInfos() kf.kcl.infos = LAYER @kf.cell def port_hashable(p1): print(f"port_hashable {p1}") return kf.cells.straight.straight(width=1, length=1, layer=LAYER.WG) if __name__ == "__main__": c = kf.KCell('im_a_parent') c0 = kf.cells.straight.straight(width=1, length=1, layer=LAYER.WG) # c1 = port_hashable(c0["o1"]) ref = c << c0 print('parent_cell', ref.parent_cell.info) print('cell', ref.cell.info)
Yes, because ref.parent_cell references c and not c0 as the klayout doc and kfactory docs mention
ref.parent_cell
c
c0