It looks like you're new here. If you want to get involved, click one of these buttons!
Hi!
I am trying to run a DRC script that calculates areas of different polygons with and without sizing.
But I get behaviour I do not understand. Please find below a test case
1. I attached simple layout, with 2 boxes of 100um X 100um with layer 1/0 called testCase.gds.gz.
2. Created the following sctipt that:
a. Calculates the area
b. Calculates the area of each polygon sized up by 1um/side
c. Calculates the area of each polygon sized down by 1um/side
Here is the DRC script:
l=1.0.um #set sizing parameter for test
my_layer=input(1,0)
#Go through each of the 100X100 boxes
my_layer.each do |polygon|
#calculate the area of each box after sizing by +l
ep_plus = RBA::EdgeProcessor::new #Using Edgeprocessor per Klayout documentation reccommendation
sized_plus_L = ep_plus.simple_merge_p2p([polygon.sized(l)], false, true)
#calculate the area of each box after sizing by -l
ep_minus = RBA::EdgeProcessor::new
sized_minus_L = ep_minus.simple_merge_p2p([polygon.sized(-1.0*l)], false, true)
puts("original area=#{polygon.area}. sized +l area= #{sized_plus_L[0].area}.sized -l area=\ #{sized_minus_L[0].area}")
ep_plus._destroy
ep_minus.destroy
end
When running it, I get the following result in the Ruby console window, showing that area of original polygons is fine (10000). But the sized polygons is not
original area=10000.0. sized +l area= 10404.sized -l area= 1
original area=10000.0. sized +l area= 10404.sized -l area= 1
I am using Klayout version 0.26.3
Can you please advise?
Thanks! Allon
Comments
PS: sizing up area seems OK. Issue is sizing down.
There are several bugs in that code.
First of all, you can't use micrometer units in Polygon#sized and second you skipped the last argument to "simple_merge_p2p" which is 1 and it's important here. Please check the documentation.
But basically the features you are using are outdated and provide the low-level API. A DRC script works on a more abstract level.
If you really need to act on a per-polygon level, you should use the Region object which provides an easier interface to use, such as
Matthias
Thanks Matthias. I modified a little bit as Region object uses long integers while Dpolyon is double
This worked
Thanks! Allon