Code for making a polygon in DRC

I cant figure out the code for making a polygon in DRC? Currently creating a box I understand. If I wanted to make a cross in DRC then tile it I cant figure out the syntex. Examle code would be awesome.

Thanks

Comments

  • edited November 2022

    Easy:

    my_layer = polygons   # creates an empty polygon layer
    polygon = RBA::Polygon::new(...)  # NOTE: in database units
    my_layer.data.insert(polygon)   # adds the polygon
    

    If you have micrometer-unit polygons, use this code (EDITED):

    my_layer = polygons   # creates an empty polygon layer
    # inserts a triangle (1 µm high, 1 µm wide)
    my_layer.insert(polygon([ p(0, 0), p(0, 1), p(1, 1) ]))
    

    You can add any the other shapes the same way (path, box).

    Matthias

  • Thanks Matthias. What I would really need is to update the following code with the polygon to make a cross from the current code which is Box.

    to_fill = input(205, 0)
    pattern = fill_pattern("FILL_CELL").shape(207, 0, Box(0.0, 0.0, 6.0, 6.0))
    to_fill.fill(pattern, hstep(10.0), vstep(10.0))

  • That's a different thing ...

    BTW: you should use "box" instead of "Box". "Box" works too, but creates an integer-unit box object and you will be able to specify full-µm coordinates only.

    For Polygons use that notation:

    to_fill = input(1, 0)
    points = [ 
      p(-3, -1), p(-3, 1), p(-1, 1), p(-1, 3), 
      p(1, 3), p(1, 1), p(3, 1), p(3, -1),
      p(1, -1), p(1, -3), p(-1, -3), p(-1, -1)
    ]
    pattern = fill_pattern("FILL_CELL").shape(100, 0, polygon(points))
    to_fill.fill(pattern, hstep(10.0), vstep(10.0))
    

    This gives you this:

    Matthias

Sign In or Register to comment.