gdsfactory / kfactory

gdsfactory with a klayout backend
https://gdsfactory.github.io/kfactory/
MIT License
33 stars 12 forks source link

access ports by name #126

Closed joamatab closed 1 year ago

joamatab commented 1 year ago

in gdsfactory you can access ports from cells and instances using

c.ports['o1'] or c['o1']

However in kfactory Kcells, this can be used to access instances (not as frequently accessed compared to ports) How about accessing instances with c.instances['wg1']?

sebastian-goeldi commented 1 year ago

Fixed by #127

Accessing instances by name is already possible

>>> import kfactory as kf
2023-05-29 17:13:59.572 | INFO     | kfactory.conf:__init__:105 - LogLevel: INFO
>>> c = kf.KCell()
>>> d = kf.KCell()
>>> inst = c << d
>>> inst.name = "inst1"
>>> c.insts["inst1"]
Unnamed_0: ports [], Unnamed_1: ports [], 0 instances