It looks like you're new here. If you want to get involved, click one of these buttons!
Hello,
I have several PCell classes in one script, and many of them are connected by many parameters.
What I wnat to do is that, as I create one PCell, the next one would be created, and the next , and the next...
For example, if I have A, B, and C PCell classes.
B PCell would be created after A is created, and C PCell would be created after B is created.
I tired to implement this by adding
endInside = EndInside_nJFET::new
endInside.produce_impl
at the end of "produce_impl" method but it did not work.
How can I implement this ?
Thank you very much
Comments
You mean "tried", not "tired"? Those mean quite different things
"produce_impl" is not a regular function that is not called when you expect it. It runs in a kind of sandbox in an entirely different context. If you call it yourself, the effect will be unpredictable.
Instead, you should organize the code in classes or functions which provide the production methods separated from the PCell classes. Then you delegate to these objects or functions.
Here is what I mean:
Matthias
Thank you very much Matthias
I tried this way, but I got errors,
firstly, I followed how you did, but I got an error becuase of "self" in PCellA_produce_impl method.
So, I removed the "self" from the method( now, only context is a parameter), then got another error becuase of "self" in produce_impl.
So, I removed the "self" from the mothod, then another error occurec says, undfined method "PCellA_produce_impl".
I think this is because "PCellA_produce_impl" is outside of class "PCellA".
The final goal of my project is creating a device automatically as you call one PCell class.
detail description below.
I have Unit cells which I currently have.
These Unit cells are implemented in one Module and each single class like class CellA, class CellB ...
Then, as I put many unit cells together, I will make a cluster. So, one cluster consists of many unit cells.
Finally, as I put many clusters together, I will make one device.
Below, there is simplified code of unit cell module.
Basically, there are two unit cells which are "CellA" and "CellB" in a module "UnitCellLibrary"
Firstly, you have to call CellA, because there are global variables, and as you call CellA, global variables will be set.
With those global variables, parameters in CellB will be set when user call CellB.
These are cells I called. Left orange cell is CellA, and the other is CellB
So now, I have two cells, and I want to make a cluster consisting of CellA and CellB like this by calling another class like "clusterA"
Therefore, clusterA calls CellA and CellB, then arrange them like the figure.
Sometimes, when other cluster class arranges unit cells, rotation or flip might be needed. (not in this case but for other cluster class and actual unit cells consist of many boxes, so using only "transposed" might not work for this case)
How can I implement this with Ruby in Klayout or is it possible to implement?
Thank you very much for reading long question.
Hi,
My example was Python, hence the "self".
For a discussion of how to call a PCell inside another one, please see: https://www.klayout.de/forum/discussion/comment/5948#Comment_5948
This problem has been addressed a couple of times here already. I usually say you should not do this as creating a PCell instance inside another PCell is just a very complicated way of calling that other PCell's production code. It may be acceptable if you need to create arrays of PCells because of the compactness of array calls.
Matthias