Matthias, I have to thank you for this amazing piece of software. You are the man!
I just discovered PCells, and I'm trying to work my way through my first version to speed my workflow. I would like to be able to apply the 'Round Corners' command from the selection edit menu. So here are a few questions that I have, apologies if the answers exist elsewhere, but I didn't see them in the documentation or the forum:
1) Are the commands accessible in the menu all in the Ruby API somewhere, and is there an easy way to figure out how to access them?
2) If not all commands are in the Ruby API, does the corner rounding command happen to be?
and finally, although this is a lower priority to me:
3) It would be beautiful if the round corners command could be applied on a per-corner basis (both through the GUI and through Ruby). In my designs it is nice to have different parts of a single polygon have different corner radii, which seems difficult to achieve as is.
Thanks for any help that Matthias or the community can lend!
Comments
Hallo,
thank you for that feedback :-)
Not all commands in the menu are accessible as Ruby functions, because the Ruby API is on a lower level than the menu functions. The Ruby API provides methods as classes from the database level while menu functions usually provide functionality on a higher level. I gradually try to make the high-level functionality available but that adds a lot of complexity to the API.
For the corner rounding, however there is a Ruby method available in the API (method "round_corners" of the Polygon class, see http://www.klayout.de/doc/code/class_Polygon.html#method45).
Regarding different rounding radii this method allows to specify two radii for inner and outer corners. In most cases that appears to be sufficient. It is probably possible to extend this to allow specification of a per-corner radius but right now there is no such option available.
Regards,
Matthias
I think that I'll implement a simple function to round arbitrary corners of a polygon, given a list of points defining the polygon, points to round and their respective radii. If it turns out nice, I'll post it here, along with an example of an output file.
Thanks Matthias!
-Michael
I am also looking to make circles. I was wondering if there is a function yet to create real circles, or if I need to make a Ruby Script to do this or round the corners of a polygon.
Have any of you been successful with the code?
Thanks, Natalie
Hi Natalie,
there are not circles in GDS, hence there is no support for that kind of shape yet.
One approximation to a circle is a path with round corners and a single point. I don't know however, how portable that solution is. Such an object will be converted to OASIS circles if you save it to OASIS:
Another way is to create polygons with a sufficient number of points which form a circle, i.e. like this:
Matthias
I went and made a promise to post some code, and then once I wrote it I promptly forgot! It may be superseded by now, but I thought that I'd post it here to wrap up my part in this thread.
Here is my silly little code which takes a list of points defining a polygon, two lists which in turn define the points you wish to round, and the radii you wish the curves to have, and finally the number of points per 360 degrees of arc.
Be warned! It's a very amateurish bit of code; the method is simplistic and there is no checking to see if the radii you request result in intersecting curves, leading to awful behavior if the radii is large compared to the distance between unrounded points. It ended up working well enough for me.