heitzmann / gdstk

Gdstk (GDSII Tool Kit) is a C++/Python library for creation and manipulation of GDSII and OASIS files.
https://heitzmann.github.io/gdstk/
Boost Software License 1.0
324 stars 78 forks source link

KLayout doesn't like the OASIS output for this, but the GDSII file seems to be accepted. #247

Open philstopford opened 2 months ago

philstopford commented 2 months ago
def test():
    lib = gdstk.Library("Library")
    cell = lib.new_cell("Base")
    pol = gdstk.rectangle((0, 0), (1, 1))
    pol.repetition = gdstk.Repetition(x_offsets=(1, 3, -2))
    cell.add(pol)
    lib.write_gds("rectangle_rep.gds")
    lib.write_oas("rectangle_rep.oas")

test()

KLayout reports a coordinate value overflow (position=51, cell=#0) for the OASIS file.

philstopford commented 2 months ago

Similarly, this yields a file that KLayout rejects

def testf():
    lib = gdstk.Library("Library")
    cell = lib.new_cell("Base")
    pol = gdstk.Polygon(((0, 0), (0, 1), (0.2, 1), (0.2, 0.8), (0.1, 0.8), (0.1, 0.6), (0.2, 0.6), (0.2, 0.4), (0.1, 0.4), (0.1, 0)))
    pol.repetition = gdstk.Repetition(x_offsets=(1, 3, -2))
    cell.add(pol)
    lib.write_gds("f_rep.gds")
    lib.write_oas("f_rep.oas")

testf()
heitzmann commented 2 months ago

Any repetition object with negative offset will create an invalid OASIS. Thanks for reporting, I'm aware of the cause of this bug. Whenever I have some time, I can work on it.