It looks like you're new here. If you want to get involved, click one of these buttons!
Hello, I'm trying to merge gds files together using python or ruby scripting and found the forum super helpful to find bits and pieces of scripting.
Ideally, this is what I'd like to do:
1) I have a master gds with layers 1-50 where I want to import new gds layouts (with layer offset) at specific coordinates
2) I have a csv file that includes a list of gds file names and the center coordinates where they should be placed into the master gds. Some of those gds files are copied multiple times, but at different coordinates. Sometimes, they must be rotated. - I can also add a "layer offset" column (e.g., gds files 1-3 are offset by 100/0, gds files 4-5 are offset by 200/0, ...) Ideally, I'd like a script that can look up the csv file, find the gds files, apply the layer offset, and copy them at the given coordinates listed in CSV into the Master gds.
The files to be imported are unique top cells, which I think simplifies things. I'd like to keep their names as is into the master.
What I've successfully done so far is to import multiple files at given coordinates, but I didn't know how to implement layer offset or the csv lookup table.
In order to do that, you will need to first read the imported layout into it's own Layout object and then copy it over to the destination layout. While you do that you can specify a layer mapping which allows you to implement the offset.
Here is some sample code:
Hope this helps.
@Matthias - Thank you - that helps a lot. and if I want to read those inputs from a table (e.g., csv) and call those out in the script, can I do this too? Instead of manually copy-paste the commands 10 times, can I create a loop that looks into the table ?
@plic_user_1983 The above code was meant as a sketch. It shows how to use KLayout API to merge a layout into another one with a layer offset. I'll leave it to you to combine that with a CSV reader (e.g. using the pangas module) and put that code into a loop.