How to Open a GDSII file and save a new GDSII file with new top cell?
Open the GDSII file in edit mode (Set_Load_Memory On), then Open_Structure, then use the command Save_GDSII_Structure to save the specified open structure to a GDSII file. e.g. 1. Open the file in edit mode (use more memory and will create a different and bigger load memory map file with .dbload extension). Set_Load_Memory On Open_GDSII /tmp/demo.gds Open_Structure A_CHILD_CELL Save_GDSII_Structure /tmp/outputchild.gds 2. Keep opening the GDSII file the way you are doing it now and do something different ONLY when you want to save to an output file. Open the file in NON edit mode (normal mode, use less memory, what you are doing right now). Then when you want to save, change to edit mode, reload, and save. Open_GDSII /tmp/demo.gds Open_Structure A_CHILD_CELL Set_Load_Memory On Set_Use_Memory_Maps Off Set_Create_Memory_Maps Off Reload_GDSII Save_GDSII_Structure /tmp/outputchild.gds Set_Load_Memory Off Set_Use_Memory_Maps On Set_Create_Memory_Maps On Note that Reload_GDSII might take a while if .dbload memory map is not available and if you want to generate .dbload memory map. If .dbload memory map is not necessary, set memory maps to off before reload. Remember to reset the edit mode (Set_Load_Memory).