Closed sebastian-goeldi closed 1 year ago
Describe the bug A clear and concise description of what the bug is.
To Reproduce
import kfactory as kf c = kf.KCell() c.create_port( trans=kf.kdb.Trans(2, False, 0, 500), width=1000, layer=kf.kcl.layer(1, 0), ) c.create_port( trans=kf.kdb.Trans(2, False, 0, 0), width=1000, layer=kf.kcl.layer(2, 0), ) c.create_port( trans=kf.kdb.Trans(2, False, 0, 750), width=1000, layer=kf.kcl.layer(1, 0), port_type="electrical", ) c.create_port( trans=kf.kdb.Trans(2, False, 0, 750), width=1000, layer=kf.kcl.layer(1, 0) ) c.create_port( trans=kf.kdb.Trans(0, False, 0, 500), width=1000, layer=kf.kcl.layer(1, 0), ) c.create_port( port_type="electrical", trans=kf.kdb.Trans(0, False, 0, 0), width=1000, layer=kf.kcl.layer(1, 0), ) c.create_port( trans=kf.kdb.Trans(0, False, 0, 750), width=1000, layer=kf.kcl.layer(1, 0), ) c.kcl.rename_function = lambda ports: kf.port.rename_by_direction( ports, layer=kf.kcl.layer(1, 0), port_type="optical" ) c.autorename_ports() print(c.ports)
gives
['Port(, width: 1000, trans: r180 0,500, layer: 0, port_type: optical)', 'Port(, width: 1000, trans: r180 0,0, layer: 1, port_type: optical)', 'Port(, width: 1000, trans: r180 0,750, layer: 0, port_type: electrical)', 'Port(, width: 1000, trans: r180 0,750, layer: 0, port_type: optical)', 'Port(name: E0, width: 1000, trans: r0 0,500, layer: 0, port_type: optical)', 'Port(, width: 1000, trans: r0 0,0, layer: 0, port_type: electrical)', 'Port(name: E1, width: 1000, trans: r0 0,750, layer: 0, port_type: optical)']
Expected behavior
['Port(name: W0, width: 1000, trans: r180 0,500, layer: 0, port_type: optical)', 'Port(, width: 1000, trans: r180 0,0, layer: 1, port_type: optical)', 'Port(, width: 1000, trans: r180 0,750, layer: 0, port_type: electrical)', 'Port(name: W1, width: 1000, trans: r180 0,750, layer: 0, port_type: optical)', 'Port(name: E0, width: 1000, trans: r0 0,500, layer: 0, port_type: optical)', 'Port(, width: 1000, trans: r0 0,0, layer: 0, port_type: electrical)', 'Port(name: E1, width: 1000, trans: r0 0,750, layer: 0, port_type: optical)']
Describe the bug A clear and concise description of what the bug is.
To Reproduce
gives
Expected behavior