Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Copy layers from a gds file to another one

I tried to find a solution in the forum regarding my new request before to sollicit you again.
Sorry in advance if this subject has already been described.

Here below, a short description:

I have to work with 2 gds files:

  • A.gds (one layer: 1/0). This is my main file,
  • B.gds: 4 layers: 1/1, 2/1, 3/1 and 4/1 (superimposed layers)

The topcells names are different.
I need to copy the 4 layers from the B.gds file to the A.gds file.
The content of those 4 layers will be placed to 4 different coordinates (split).
Then, these 4 layers must be moved to the layer 1/0 and delete after the move.

I hope it is clear enough otherwise let me know if you need further information.
Thanks in advance for your reply.



  • Hi Eric,

    there are different solutions to this problem. The main question is whether the hierarchy needs to be maintained (a bit more difficult) or it's allowed to flatten the hierarchy (easy).

    The first method works with "Cell#copy_tree". The second version can be done even with a DRC script. Here is a rough sketch (not tested):

    s2 = source("B.gds")
    # place 1,1 layer to -1000, -1000
    l11 = s2.input(1, 1).moved(-1000, -1000)
    # place 2,1 layer to 1000, -1000
    l21 = s2.input(2, 1).moved(1000, -1000)
    # place 3,1 layer to -1000, 1000
    l31 = s2.input(3, 1).moved(-1000, 1000)
    # place 4,1 layer to 1000, 1000
    l41 = s2.input(3, 1).moved(1000, 1000)
    # join all
    (l11 + l21 + l31 + l41).output(1, 0)


  • Hi Matthias,

    Thank you. I have adapted your example to my need and that works perfectly.
    The next step is to transfert the layer 1/0 to the 'A.gds' file.
    Can I use "copy_tree_shapes" ? If yes, is it possible to get a short example ?

    Thanks again for your help.


  • Hi Eric,

    if you save the result as "A.gds", won't this give the results you want?

    An example for "copy_tree" can be found here: in the final post of mine.


Sign In or Register to comment.