Simple Polygon Trouble

edited February 2013 in Ruby Scripting
Hello.
I am struggling with the proper syntax for inserting a polygon into a layout. I keep receiving the error "No overload with matching arguments...". An explanation of this error would be helpful as well as an example of how to insert a Simple Polygon.

Thank you,
Jared

Comments

  • edited November -1

    Hi Jared,

    basically this message means that there is no method variant (of several) which expects the arguments given in the call. You'll get this message for example on this line:

    RBA::SimplePolygon::new("balbla")
    

    because there are two initializers: one expecting a list of points and another expecting a box. If you want to create a simple polygon from a list of points, be sure you provide an array for the argument:

    a = [ RBA::Point::new(0, 0), RBA::Point::new(100, 0), RBA::Point::new(100, 100) ]
    RBA::SimplePolygon::new(a)
    

    Some sample code would be helpful to understand your particular issue.

    Regards,

    Matthias

  • edited November -1
    Hello Matthias,
    Thank you for your continued help. I am posting some example code, but it is for a different issue now. It is the name of the call for inserting a hole in a polygon. I was pretty sure that this would be correct, but it isn't:

    cell.shapes(insignia_layer).insert(RBA::Polygon::insert_hole([dh1,dh2,dh3,dh4]))

    The error says that there is no "insert_hole" method in the Polygon class.
  • edited February 2013

    Hi Jared,

    A hole is actually a feature of a polygon, not an individual shape you can insert. You can insert a hole into a polygon, not a hole into a shapes collection, i.e.

    hull_points = ... # array of RBA::Point
    p = RBA::Polygon::new(hull_points)
    hole_points = ... # array of RBA::Point
    p.insert_hole(hole_points)
    

    There is a description here: http://www.klayout.de/doc/programming/database_api.html#h2-1109. Maybe that is helpful.

    Regards,

    Matthias

Sign In or Register to comment.