Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Saving only 1 cell + references to file #16

Closed
Engi4 opened this issue Nov 16, 2016 · 3 comments
Closed

Saving only 1 cell + references to file #16

Engi4 opened this issue Nov 16, 2016 · 3 comments

Comments

@Engi4
Copy link

Engi4 commented Nov 16, 2016

Hay there

I currently have 3 GDSII files that I am combining into one layout. I have managed to get all 3 cells into one cell and transposed and rotated them as necessary. Now I would only like to save one the one cell I have to a new GDS file.

import gdspy

file1 = gdspy.GdsImport('Dcsfq.gds')
file2 = gdspy.GdsImport('Conf2.gds')
file3 = gdspy.GdsImport('Tff4b.gds')

cell1 = file1.extract(file1.top_level()[0])
cell2 = file2.extract(file2.top_level()[0])
cell3 = file3.extract(file3.top_level()[0])

ref_cell = gdspy.Cell('TRANSLATED')
ref_cell.add(gdspy.CellReference(cell2, (150,0)))
ref_cell.add(gdspy.CellReference(cell1, (0,0)))
ref_cell.add(gdspy.CellReference(cell3, (225,-150), rotation=90))

newgds = gdspy.GdsPrint('new_gds.gds', unit=1.0e-6, precision=1.0e-9)
newgds.write_cell(ref_call)
newgds.close()

This however gives me an empty GDSII file. Am I doing the translations/rotation wrong, or is it the way I save the file that is not done properly? If someone could assist me with this I would be very greatful

Thanks

@okianus
Copy link

okianus commented Nov 16, 2016

@Engi4, I haven't used gdspy.GdsPrint(), but have implemented the same functionality with gdspy.gds_print(). Replace the last three lines of your code with:

gdspy.gds_print('new_gds.gds', cells=[ref_cell], unit=1.0e-6, precision=1.0e-9)

@heitzmann
Copy link
Owner

@Engi4, I believe both your code and @okianus's should work. Maybe you should try to check the contents of your cells with LayoutViewer.

@Engi4
Copy link
Author

Engi4 commented Nov 25, 2016

That was exactly what I needed. Thank you very much @okianus!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants