gdsfactory / kfactory

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

enable non-manhattan grid snapping issues #134

Closed joamatab closed 1 year ago

joamatab commented 1 year ago
import kfactory as kf

c = kf.KCell()
bend = kf.cells.circular.bend_circular(
    width=1, radius=10, layer=kf.kcl.layer(1, 0), theta=30
)
b1 = c << bend
b2 = c << bend
b2.connect("o1", b1.ports["o2"])

c.draw_ports()
c.show()

creates less than 1nm gaps

image

How could we fix this?

@sebastian-goeldi

joamatab commented 1 year ago

the solution is to just flatten the instance

image

sebastian-goeldi commented 1 year ago

btw there is a test for this too. But you aren´t always guaranteed that this fixes the problem. It does in most cases, but non-theless it's not without danger, esp if you intentionally create floating points that land exactly between two grid points. One will be rounding towards and one away

I believe the tests for this are in test_ports