How to Write a dxf file and enable some of layers?

Hi Sir,
I want to save my GDS layout and export to DXF format.
and in the file , we just need layer 51,2 and layer 51,3.
could you please help to check how to do that by code?
I knew that I need a layer Map , but I can't get the layer information base on below code....

LayoutView = RBA::Application::instance.main_window.current_view.active_cellview.cell_name
indexdata =RBA::Application::instance.main_window.current_view.active_cellview.cell_index
layout = RBA::CellView::active.layout
opt = RBA::SaveLayoutOptions::new
opt.format = "GDS2"
opt.select_cell(indexdata)
opt.keep_instances=true
PI1=input(51,2)
PI2=input(51,3)
opt.add_layer(PI1)
opt.add_layer(PI2)
layout.write("D:\\UnitDIE.gds", opt)

Comments

  • I modified your example code to work for me:
    include RBA
    LayoutView = RBA::Application::instance.main_window.current_view.active_cellview.cell_name
    indexdata = RBA::Application::instance.main_window.current_view.active_cellview.cell_index
    layout = RBA::CellView::active.layout
    opt = RBA::SaveLayoutOptions::new
    opt.format = "DXF"
    opt.select_cell(indexdata)
    opt.keep_instances=true
    layer_to_write = RBA::LayerInfo::new(201, 0)
    opt.add_layer(layout.layer(layer_to_write), layer_to_write)
    layer_to_write = RBA::LayerInfo::new(202, 0)
    opt.add_layer(layout.layer(layer_to_write), layer_to_write)
    layout.write("c:/temp/test.dxf", opt)

  • Hi David,
    Thanks very much for your code , it is workable.
    by the way , can that do a cell create and make instance subcell in the code?
    such as...
    create new cell : DIE
    make instance , DIE_CapRD location : 0,0
    make instance , DIE_PI1 location : 0,0

Sign In or Register to comment.