Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearing gdsLibrary is not simple anymore with new duplicate detection #18

Closed
gyger opened this issue Aug 1, 2019 · 3 comments
Closed

Comments

@gyger
Copy link
Contributor

gyger commented Aug 1, 2019

In the past I used the trick to write the following code somewhere in my Jupyter Notebook to initialize a new GDS library.

gdspy.current_library = gdspy.GdsLibrary()
cell = circle_grating(width=10)
gdspy.write_gds('tmp_test.gds', unit=1.0e-6, precision=1.0e-9)

With the new duplication detection, a cell is not added anymore to the library if it was added before. Somehow Picwriter does not realize that the library has been reset.

@gyger
Copy link
Contributor Author

gyger commented Aug 1, 2019

The solution currently is to also reset the dictionaries in the toolkit

gdspy.current_library = gdspy.GdsLibrary()
tk.CURRENT_CELLS = {}
tk.CURRENT_CELL_NAMES = {}

@gyger
Copy link
Contributor Author

gyger commented Aug 1, 2019

One could e.g. provide a function in the toolkit tk.reset_database().

@DerekK44
Copy link
Owner

Thanks for the bugfix. I've added a reset_database function to the toolkit, as you suggested. If you think of a better way of resetting these attributes let me know. I've had the same problem as you and don't know what the most elegant fix is.

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

No branches or pull requests

2 participants