It looks like you're new here. If you want to get involved, click one of these buttons!
The DRC needs to find non-45 degree shapes for Metal, so I coded this way :
(M1.edges - M1.edges.with_angle(0) - M1.edges.with_angle(45) - M1.edges.with_angle(90) - M1.edges.with_angle(135) - M1.edges.with_angle(180) - M1.edges.with_angle(225) - M1.edges.with_angle(270) - M1.edges.with_angle(315)).output("M1_angle", "Non 45 degree angle ME1")
If I missed with_angles(225), I missed some errors. But is there a better and simpler way to code it ?
Laurent
Comments
Hi Laurent,
I'd suggest this solution:
You don't need 135, 180 etc. angle checks. Angles are measured in a
]-90..90]
degree range, so -45 and 45 are enough to check for 45 edges with positive and negative slope:The solution with "without_angle" is somewhat more efficient as it avoids boolean operations. I also assume that the first two steps quickly eliminate most of the edges leaving only few for the 45 and -45 degree analysis.
One more remark from my side: when your code is like
"M1.edges" will be executed multiple times. It is not a very expensive operation, yet it can be avoided by computing the edges first:
Still I suggest the "without_angle" solution and the loop above.
Also note the angle rulers above which are a 0.28 feature
Best regards,
Matthias
Thank you Matthias, it more efficient than my command. As I like to have the all DRC check in 1 line I have compacted as follows :
Very good. I agree it could be easier. I have created a ticket for this: https://github.com/KLayout/klayout/issues/1185
Matthias