Import a gds then make into a cell to rotate

Do you have the code for importing a gds file then making that gds a cell. Then I would like to make copies of it and rotate to different orientations.

Comments

  • edited August 2022

    Hi,

    when you have a GDS file, it already has a top cell (usually).

    So you can do that (Python):

    ly = pya.Layout()
    ly.read("path/to/file.gds")
    
    org_top = ly.top_cell()
    
    new_top = ly.create_cell("NEW_TOP")
    for a in [ 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0 ]:
      new_top.insert(pya.DCellInstArray(org_top.cell_index(), pya.DCplxTrans(1.0, a, False, pya.DVector())))
    
    ly.write("path/to/new/file.gds")
    

    Matthias

  • Thanks Matthias

    Is there a way to have this code in Ruby? I tried to modifiy.

  • That's like this (disclaimer: not tested):

    ly = RBY::Layout::new()
    ly.read("path/to/file.gds")
    
    org_top = ly.top_cell()
    
    new_top = ly.create_cell("NEW_TOP")
    [ 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0 ].each do |a|
      new_top.insert(RBY::DCellInstArray::new(org_top.cell_index(), RBA::DCplxTrans::new(1.0, a, false, RBA::DVector::new())))
    end
    
    ly.write("path/to/new/file.gds")
    
Sign In or Register to comment.