Closed sebastian-goeldi closed 1 month ago
trying to understand how to set the behavior globally... the KFACTORY_CHECK_INSTANCES
etc. that you mention above, those are meant to be environment variables? or how should they be set to change global behavior when executing a script?
for example, i would have expected that setting this in my script would have configured the setting globally, but i still see the same error
kf.config.check_instances = kf.conf.CHECK_INSTANCES.VINSTANCES
Allows different handling if any instance in the
@cell
decorated cell is off-grid or a non-90° rotation:CHECK_INSTANCES.ERROR
("error"
): Throw an error (default)CHECK_INSTANCES.FLATTEN
("flatten"
): Flatten the cellCHECK_INSTANCES.VINSTANCES
("vinstances"
): Convert any offending instance to a VInstanceCHECK_INSTANCES.NONE
(none
): Do nothing and continueExample usage:
test.py
```python import kfactory as kf @kf.kcl.cell def rotated_bend() -> kf.KCell: c = kf.KCell() bend = c << kf.cells.euler.bend_euler(width=1, radius=10, layer=kf.kcl.layer(1, 0)) bend.drotate(30) straight = c << kf.cells.straight.straight( width=1, length=10, layer=kf.kcl.layer(2, 0) ) straight.connect("o1", bend, "o2") return c rotated_bend().show() ```Run:
Or for single usage:
@cell(check_instances=config.CHECK_INSTANCES.VINSTANCES)
@tvt173