How to remove fake error when use 'width' to detect a sloped rectangle?

I want to detect a sloped rectangle's width, so I used the code

report("DRC report")

Drawing layers

ln_wg = input(1, 0)




min_cont_w = 350.nm

A "tolerance" applied to allow for polygon roughness:

delta = 2*2**0.5.dbu

r_cont_w = ln_wg.width(square, min_cont_w - delta)

r_cont_w = ln_wg.raw.width(projection, min_cont_w - delta, angle_limit(89.5))

r_cont_w.output("CONT_W: contact width < #{'%.12g' % min_cont_w} µm")

but the above code cannot detect sloped rectangle, the fake error is that whatever the angle is, there will exist an error in the edge pair, even if the width is satisfied. The output is show in the following figure, Could anyone help me a little bit? Thanks.


  • I have solve it, the error cames from the use of dbu, it should be (220.5).dbu

  • Very good ... but please use Markdown to format your code.

    A single line with triple backticks before and after your code does the job.


Sign In or Register to comment.