layer mapping problem : from gds to dxf

edited September 2014 in File Formats
Hi,
I use layer map like: 1:Outline to read my original gds file into Klayout.
I would like to save it as dxf format. Suppose I would see the layer Outline on AutoCad.
But I show me layer name : L1D0_Outline for L1 of gds layer.
Is it possibe to do without the prefix L1D0 after the gds 2 dxf conversion.

By the way, do Klayout got command line for gds2dxf conversion now ?

:)

Comments

  • edited September 2014

    Hi Sunny,

    there is no simple way to remove the "LxDy" prefix currently. KLayout uses that prefix to preserve the information from the GDS file. When you read a DXF file, it will translate that prefix back into layer/datatypes, so you don't need to provide conversion tables for a GDS/DXF round trip. But AutoCAD will of show the layer with the prefix.

    You can force KLayout to forget the layer/datatype by removing that information from the layer info (Edit/Layer/Edit Layer Specification: clear layer and datatype). In that case, the pure layer name is taken.

    If you are looking for a command-line way to do the conversion, you can consider using a script. You can run KLayout in batch mode. The script can also translate the layers and strip the layer/datatype information.

    There is a thread about that here: http://klayout.de/forum/comments.php?DiscussionID=173.

    Matthias

  • edited November -1
    Thank you for your reply. I will try them.
  • edited November -1
    Hi Mattjias,

    I read some API documents about how to read/write layout in a script Already. Could you kindly give some hint or draft about how to strip layer/datatype inform ?

    Best regards,
    Sunny
  • edited October 2014

    Hi Sunny

    Here is some code (not tested):

    # the mapping table
    mapping = { 
      [10, 0] => "METAL1",   # layer 10, dataype 0 -> "METAL1"
      [11, 0] => "VIA",      # etc.
      [12, 0] => "METAL2"
    }
    
    # read file    
    lay = RBA::Layout.new
    lay.read("myfile.gds")
    
    # use the mapping table to get and install the name
    # without layer/datatype info
    lay.layer_indices.each do |li|
      info = lay.get_info(li)
      name = mapping[[info.layer, info.datatype]]
      name && lay.set_info(li, RBA::LayerInfo::new(name))
    end 
    
    # save as DXF
    opt = RBA::SaveLayoutOptions.new
    opt.format="DXF"
    lay.write("myfile.dxf", false, opt)
    

    Matthias

Sign In or Register to comment.