Paths not preserved with the DRC engine

Hi,
First of all, thanks for the effort you put in this great software!

Secondly, I have a small issue while using the DRC engine, probably I'm doing something wrong here, but I can't figure out what :blush:

I have a gds file with some paths on a layer, and I wanted to copy that layer (with the paths) into another gds file.
It seems to work, however, when I inspect the file those paths have been converted to polygons?

I have some small examples to demonstrate my issue:

input_gds = "test_path.gds"  # simple file with just 1 path
output_gds = "test_path_copy.gds"  # new file, which should contain the path

source(input_gds)
target(output_gds)

paths = input(1, 0)
paths.output(1, 0)

and

output_gds = "test_path.gds"
target(output_gds)

test_path = path([p(0, -10.um), p(20.um, -10.um)], 2.um)
pl = polygon_layer.insert(test_path)
pl.output(2, 0)

Both examples result in a gds file with polygons instead of paths.
Is there a way to preserve the paths?

Regards

Comments

  • Hi,

    thanks for your nice feedback :-)

    Regarding the path issue: maybe DRC is not the right framework for this purpose. Actually DRC only knows polygons and edges and everything will be converted into these objects when passing through the DRC engine. Currently there is no way to avoid this. As another side effect, layouts will be flattened - that means the hierarchy is removed.

    But you can achieve filtering with a small script:

    # run with 
    #   klayout -rd input_file=your_input.gds -rd output_file=your_output.gds -b -r filter.rb
    
    lmap = RBA::LayerMap::new
    # GDS 1/0 -> logical layer 0 (first)
    lmap.map(RBA::LayerInfo::new(1, 0), 0)
    # GDS 5/0 -> logical layer 1 (second)
    lmap.map(RBA::LayerInfo::new(5, 0), 1)
    
    ly = RBA::Layout::new
    opt = RBA::LoadLayoutOptions::new
    opt.set_layer_map(lmap, false)
    ly.read($input_file, opt)
    
    ly.write($output_file)
    

    This script will not only preserve paths but also hierarchy. And it will be much faster and less memory hungry.

    Matthias

  • Ok, understood. Thanks Matthias!

Sign In or Register to comment.