Hy all,
I just wanted to build a DPolygon out of several DPoints and insert it into my layout. The code looks something like this:
p1=RBA::DPoint.new(x1,y1)
p2=RBA::DPoint.new(x2,y2)
.
.
.
points=[p1,p2,...]
element=RBA::DPolygon::new(points)
cell.shape(layer).insert(element)
The error message says: "No overload with matching arguments in Shapes::insert"
With the non-double methods "Point" and "Polygon" everything works fine.
Has anyone an idea what I'm wrong?
Thanks for your help!
Comments
Same problem and answer here: http://klayout.de/forum/comments.php?DiscussionID=584&page=1#Item_4
Basically, there is no insert method that takes that argument. Use Point and Polygon, and divide all x and y coords by layout.dbu.
p1=RBA::DPoint.new(x1,y1)
p2=RBA::DPoint.new(x2,y2)
.
.
.
points=[p1,p2,...]
element=RBA::DPolygon::new(points)
dbu=layout.dbu
element=RBA::Polygon::from_dpoly(element*(1.0/dbu))
cell.shape(layer).insert(element)
A brief comment of mine: I'd like to discourage the use of the D-shape types because they inherit the numerical issues involved with floating-point values. Plus you should be aware of potential overflow issues when transforming the double types to integer types.
If possible I'd use the integer types and work with dimensions expressed in terms if database units.
Matthias