Automating the untilities fill tool in Ruby

I would like to automate the fill tool under utilities to add a "loading" boxes to a die and scribe street. I may need an example of Ruby script for the fill utlity.


  • What are the parameters you are using?

  • I have a gds file with the unit cell loading structure. I would like to place it via stepping the unit cell (cross) every 10um in both x and y bounded by a layer gds drawn scribe

  • In this case the unit cell (loading structure) could be a 5um x 5um box

  • BTW can this be done in DRC?

  • Yes, DRC is able to do this. For details see here:

    Here is some sample:

    to_fill = input(1, 0)
    # Create a fill pattern with a single box at 2/0
    # This is a 5x5 µm box 
    pattern = fill_pattern("FILL_CELL").shape(2, 0, box(0.0, 0.0, 5.0, 5.0))
    # place every 10 µm
    to_fill.fill(pattern, hstep(10.0), vstep(10.0))


  • Thanks for the script. I tried to run a bit modified version but it left small gaps in some places. Unfortunately I was not able to attach the .oas file, but it was very simple one: only one donut in layer 1, inner radius 80µm and outer radius 82µm. DRC script was almost the same:

    to_fill = input(1, 0)
    # Create a fill pattern with a 0.025x0.025 µm box at 2/0
    pattern = fill_pattern("FILL_CELL").shape(2, 0, box(0, 0, 0.025, 0.025))
    pattern.origin(0.0125, 0.0125)
    # place every 25 nm
    to_fill.fill(pattern, hstep(0.025), vstep(0.025))
    # find gaps
    input(2, 0).space(,0)

    Is there an error in my code or is it a bug? KLayout-version is 27.8 running on 64-bit Win10.

  • You can attache OAS when you put it into a .zip archive. Or could you paste a screen shot at least?

    And it's always worth trying the latest version.


  • Here you are! :) KLayout 28.5 used this time.

  • edited March 2

    Many thanks. Nicely prepared test case.

    BTW: you can significantly improve the space check speed on 0.28.5 using this space check (note the added "merged"):

    input(2, 0),0)

    I have to debug the issue. A ticket has been created here:

    Kind regards,


Sign In or Register to comment.