It looks like you're new here. If you want to get involved, click one of these buttons!
I am writing some functions which extend the Cell class in the klayout.db Python module. With the Layout class, I can do the following:
class ExtLayout(kl.Layout): """Primitives for layout, based on KLayout database.""" def __init__(self, technology, working_directory=None, layout_directory=None): """Initializes a new layout.""" # Initialize the kl Layout object super().__init__(self) if working_directory is None: self.working_directory = os.path.join(os.getenv('pcp'), 'working_directory', technology.name) else: self.working_directory = working_directory ......
and it works as expected, but I can't do that with the Cell class. I think this is because the only way to initialize it is via the Layout object:
lay = Layout() cell_obj = lay.create_cell('name')
So I didn't find a good way to write an __init__ function for an extended cell class. Do you have any suggestions? (one could write a more complete __init__ class for Cell which has a layout object as an argument, so the cell is placed in a layout).
So what I want to do is to add some new methods and attributes to the Layout() and Cell() classes which works in the Layout() class but not the Cell() class.
By the way, the new klayout.db module works incredibly well with PyCharm !!
Thanks in advance,