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

referencing cells imported from a GDS file #243

@dczaplewski

Description

@dczaplewski

I have a GDS file (Marks.gds).
Inside this file are cells named: Cell1, Cell2, Cell3
I would like to import all the cells in this file into a new library. I would then like to reference them in the new library and instance them in other cells.

import gdspy
#Clears the current library so that you don't get the error message when you compile that the cell already exists
gdspy.current_library = gdspy.GdsLibrary()

lib = gdspy.GdsLibrary(infile='Marks.gds')
lib2 = gdspy.GdsLibrary()

for i in range(1,4,1)
     temp="Cell"+str(i)
     lib2.add(lib.cells[temp])

lib2.write_gds('test.gds')

When I run this code, it imports all three cells into the second library and they are included in the 'test.gds' file.
However, I would like to reference them and move them around.
When I try to do this, the code won't compile because I did not explicitly define the name of the cells: Cell1, Cell2, and Cell3.

import gdspy
#Clears the current library so that you don't get the error message when you compile that the cell already exists
gdspy.current_library = gdspy.GdsLibrary()

lib = gdspy.GdsLibrary(infile='Marks.gds')
lib2 = gdspy.GdsLibrary()

for i in range(1,4,1)
     temp="Cell"+str(i)
     lib2.add(lib.cells[temp])

x1=-2000;
y1=2000;
ref = gdspy.CellReference(Cell1, (x1,y1))

# define cell named CellA
CellA = lib.new_cell('Some_cool_name_in_the_GDS_file')
cellA.add(ref)

lib2.write_gds('test.gds')

I get this error message:
UserWarning: [GDSPY] Cell ['Cell1'] not found; operations on this CellReference may not work.

So, how do I import cells from a GDS file into a library and then later reference them to move them around or create arrays of them?

Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions