How do I call the previsouly built Class in my new class?

I have built several classes in one python script. I am not wondering if I am allwoed to call these built classes from a new class. For example, I have built " class Directional_coupler(pya.PCellDeclarationHelper): ". Now I want to build " class MZ_Interferometer(pya.PCellDeclarationHelper): ", which has the directional coupler as a element. Is there anyone can help me write script that makes me build a class based on another class?
By the way, in " class Directional_coupler(pya.PCellDeclarationHelper): ", I have several parameters such as length, width and etc. So I would need to type in these parameters when I call it.

Comments

  • edited November 17

    For an example how to do that see here: https://www.klayout.de/forum/discussion/comment/5948#Comment_5948

    I cannot stop emphasizing that a PCell is just a very complicated way to call a function which generates layout. Unless you have a good reason to make component cells (like compactness through hierarchy), it will be more efficient and easier to code when you build a library of layout-generating functions and classes rather than PCells.

    Matthias

Sign In or Register to comment.