I would like replace exiting cells by importing a gds file via Ruby code.

I would like to replace exiting cells by importing a gds file via Ruby code. I can do this manually by using the replace cell under cell menu. I have ~7 gds files I would like automate to load and replace cells.

Comments

  • Here is some code that substitutes a cell in layout a.gds with the top cell from layout b.gds. Note that this sample does not have error checking - it is assumed that there is a cell with the name of layout b's top cell in a.

    ly1 = RBA::Layout::new
    ly1.read("a.gds")
    
    ly2 = RBA::Layout::new
    ly2.read("b.gds")
    
    # replace the top cell of ly2 in ly1 (by name)
    # clears the original cell before the cell from b.gds is copied over.
    
    source_cell = ly2.top_cell
    target_cell = ly1.cell(source_cell.name)
    
    target_cell.prune_subcells
    
    cm = RBA::CellMapping::new
    cm.for_single_cell_full(ly1, target_cell.cell_index, ly2, source_cell.cell_index)
    ly1.copy_tree_shapes(ly2, cm)
    
    ly1.write("output.gds")
    
Sign In or Register to comment.