Skip to content

Cell.read doesn't read LayoutMetaInfo #1609

Closed
@sebastian-goeldi

Description

@sebastian-goeldi

Hello Matthias,

Hope you are doing great. I noticed that Cell.read LayoutMetaInfo of the cell. I didn't check for child cells, so this might also be intended behavior.

Currently, Layout.read will read LayoutMetaInfo for the cells. Cell.read on the other hand will not load the meta infos. Is this intended behavior? If I look at the example equivalent code in the docs, it would be clear to me that it is in fact not reading meta infos. But what isn't clear to me is:

Would this also apply to child cells and how would LoadLayoutOptions.CellConflictResolution play into this?

Also, how is that handled in the general case (Layout and Cell read)?

I would assume AddToCell and OverwriteCell would read them if a cell exists (but e.g. how would AddToCell handle existing meta info?), whereas Skip would not write any.

If this is intended behavior, can we add a few sentences about this either into the LoadLayoutOptions or the read functions?

here's my test case which will fail on Cell.read

import klayout.db as kdb

ly = kdb.Layout()
c = ly.create_cell("test_cell")
mi = kdb.LayoutMetaInfo("test", 42, "test_value", True)
c.add_meta_info(mi)

ly.write("test_ly.oas")

ly_read = kdb.Layout()
ly_read.read("test_ly.oas")

c_read = ly_read.cell("test_cell")
mi_read = c_read.meta_info(mi.name)
assert mi_read.name == mi.name
assert mi_read.value == mi.value
assert mi_read.description == mi.description
assert mi_read.persisted == mi.persisted

ly_read_cell = kdb.Layout()
llo = kdb.LoadLayoutOptions()
llo.cell_conflict_resolution = kdb.LoadLayoutOptions.CellConflictResolution.AddToCell
llo.properties_enabled = True

c_read_cell = ly_read_cell.create_cell("test_cell")
c_read_cell.read("test_ly.oas", llo)
mi_read_cell = c_read_cell.meta_info(mi.name)
assert mi_read_cell.name == mi.name # will fail because the meta is never created
assert mi_read_cell.value == mi.value
assert mi_read_cell.description == mi.description
assert mi_read_cell.persisted == mi.persisted

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions