Automate copy and replace

how would automate copy cell and replace. I can do by hand but I would like to automate the copy from other window (full copy) then go to different window and replace the cell with the copied cells. I do this for multiple cells


  • That is not difficult but you need:

    • The path to the first file (target)
    • The path to the second file (source)
    • A list of source and target cell names (where to copy from, where to copy to)
    • The name of the output file

    The script is:

    # target a = "target.gds" # source b = "source.gds" # output file out = "out.gds" # cell names ( in_a, in_b ) # in_a cell from a is replaced by in_b cell from b table = [ ( "TO", "FROM" ), # more ... ] ly_a = pya.Layout() ly_b = pya.Layout() for in_a, in_b in table: cell_a = ly_a.cell(in_a) cell_b = ly_b.cell(in_b) # remove everything from the target cell cell_a.prune_subcells() cell_a.clear() # copy the source cell into the target cell cell_a.copy_tree(cell_b) ly_a.write(out)


Sign In or Register to comment.