Skip to content

Add lock to Cell #1963

@sebastian-goeldi

Description

@sebastian-goeldi

Hi Matthias,

Would it be possible to add a "lock" to the Cell class?

This might sound like a weird request, so let me explain the background a bit first. In gdsfactory/kfactory when we create cells, we usually do that with cached functions. Now, sometimes we want to modify cells in a certain way, e.g. add some cladding or exclude layers. This often happens with helper functions. When the caching has been done, it is (almost always) a bad idea to further alter the cell. Therefore, kfactory implemented a "locked" state on its implementation of the Cell, KCell. This lock prevents some stuff that is accessible to the user such as creation of ports (essentially pins with a width and angle) or transform (there is a slight modification to the function in order to transform to transform the ports as well). What of course doesn't (easily) work is to lock the addition of shapes, as those are completely managed by klayout. Ideally, we can enhance this lock to cover most bases (as always, there will be ways to get to the gun and shoot your foot, just want to avoid the non-obvious cases).

I understand if this would go too far into the core of db and would require lots of engineering or hog too much resources. But I thought it's still worth asking ;)

P.S. I am not sure what it is related to, but recently I have seen some weird behavior of the layout changes state. I couldn't determine yet where exactly it's coming from, but I am getting some of the "layout state is not writable - forcing update" (sorry forgot exact error message) on write. I think it either comes from the TilingProcessor or from dangling references to shape/instance iterators is my guess (I usually only see this message with slightly faulty code or in failing tests). Will the latter cause the layout to be in the state equivalent to Layout.start_changes()? If not , did any of the TilingProcessor code change recently? I haven't seen anything in the patch notes. (Sorry, was not sure where to add this, so I added it here, but I can make a new issue of course if desired, or forum post).

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions