Slice by layers

edited March 2012 in General
Hi Matthias,

We are trying to looking for a way to slice a GDS/OASIS file to several files by layers/types, and we found there is a command utility named "strmclip" in klayout directory, according to the help we try to slice a layer via the following command "strmclip -l 100/0 in.gds out.gds", however the output file still contains all layers.

The most strange result is when we try to slice different layer, the output layers not always the same, but the result is still incorrect. Could you please help to check this issue or kindly let us know a better way to parallel slicing layers in GUI mode ? Thank you so much.

Your help and response would be highly appreciated~
--
chhung

Comments

  • edited March 2012

    Hi chhung,

    strmclip does not extract layers but performs rectangular clips based on a marker layer. The call you mentions uses 100/0 for the specification of the clip regions. This utility does not filter layers as you expected.

    The strmxxx utilities do not cover much functionality yet. They are intended as development utilities and for use in test scripts for example. You can however use them as a basis for custom modifications. For example, adding layer filtering to strm2oas.cc would involve code like that:

    #include "dbLoadLayoutOptions.h"
    #include "dbStreamLayers.h"
    
    ...
    
      //    prepare a sample layer map for filtering
      //  in this sample, layers 10/0 and 5/7 are filtered
      db::LayerMap lmap;
      //  Layer 10, datatype 0 
      db::LayerProperties lp1 (10, 0);
      lmap.map (lp1, layout.insert_layer (lp1));
      //  Layer 5, datatype 7 
      db::LayerProperties lp2 (5, 7);
      lmap.map (lp2, layout.insert_layer (lp2));
      //  ... add more layers here.
    
      tl::InputZLibFile stream (infile);
      db::Reader reader (stream);
      //  Read the file and use the layer map to filter out layers that are included 
      //  in the mapping
      db::LoadLayoutOptions options;
      options.set_layer_map(lmap, false);
      map = reader.read (layout, options);
    
    ...
    

    In that sample, only two layers are read and only those two layers are written to the output. Another possibility is to use a ruby script to load the file with filtering and write the file.

    Best regards,

    Matthias

  • edited March 2012
    Hi Matthias,

    Thanks for your comments, I modified some code as follow and it works fine for our request.

    if (argc != 5) {
    printf ("Syntax: layerclip <infile> <outfile.oas> <layer> <type>\n");
    return 1;
    }

    ...

    int outlayer=atoi((argv[3]));
    int outtype=atoi((argv[4]));

    ...

    db::LayerMap lmap;
    db::LayerProperties lp1 (outlayer, outtype);
    lmap.map (lp1, layout.insert_layer (lp1));

    ...

    db::LoadLayoutOptions loadoptions;
    loadoptions.set_layer_map(lmap, false);
    map = reader.read (layout, loadoptions);

    ...

    db::SaveLayoutOptions saveoptions;
    saveoptions.set_dont_write_empty_cells(true);
    writer.write (layout, stream, saveoptions);

    Best Regards,
    --
    chhung
Sign In or Register to comment.