It looks like you're new here. If you want to get involved, click one of these buttons!
Hi, I'm doing some photonics layout, and need to do "manhattanization" of some of the layers that surround waveguides which have to be on a Manhattan grid. I do it with a KLayout Ruby script with the fill_pattern command, but I am seeing horizontal partial missing & extra rows. Here's a self-contained script and its output on one of the layers.
Can you please advise if I need to make a code change, or if somehow the command I'm using doesn't match what I'm trying to do? I'm doing the command on a top cell which does contain hierarchy.
# Read about DRC scripts in the User Manual in "Design Rule Check (DRC)"
cv = RBA::CellView::active
layout = cv.layout
file_in = cv.filename
file_out = file_in
file_out["."] = "_manhattanized."
cell_in = cv.cell_name
cell_out = cell_in + "_manhattanized"
full = input(62,1) null=full-full #Manhattanize specific layer(s) w=0.75 [67, 319].each do |l1| target=input(l1).sized(10.nm).sized(-10.nm)#deal with any waveguide gaps p = fill_pattern("sq1").shape(999,1, box(0, 0, w, w))#999,1 TEMP LAYER. target.fill(p, hstep(w,0), vstep(0,w), auto_origin)#Fills cell with boxes input(999,1).sized(10.nm).output(l1)#merges boxes to be fewer polygons null.output(999,1)#Replaces the target layer layout.prune_cell(layout.cell_by_name("sq1"), -1) end layout.rename_cell(cv.cell_index,File.basename(file_out,".*")) options = RBA::SaveLayoutOptions.new options.no_empty_cells=true options.select_all_layers options.add_cell(cv.cell_index) #top cell should be selected before script starts. options.dbu=1.nm layout.write(file_out,options)
Here is a BEFORE layout, layer 67/0, one of the layers to be manhattanized:
Here is the AFTER layout of the same region/layer:
Overall the errors I have observed using variations of this script is horizontal gaps in fill 1 or 2 squares high, and also sometimes horizontal lines 1 square high that extend to the right from the geometry like this:
Thanks for the help!