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

pg.boolean returns polygons where properties are the same object in memory #166

Open
basnijholt opened this issue Nov 4, 2022 · 2 comments

Comments

@basnijholt
Copy link
Contributor

See:

import phidl

a = phidl.geometry.bbox(bbox=[(0, 0), (1, 2)])
b = phidl.geometry.bbox(bbox=[(0, 0.5), (1, 1.5)])
d = phidl.geometry.boolean(a, b, operation="not")

phidl.quickplot([a, b])
set(id(p.properties) for p in d.polygons)

image
and prints:

{6076552704}

which means that

d.polygons[0].properties["a"] = 1
print(d.polygons[1].properties)

prints {'a': 1}.

@joamatab, maybe also happens in gdsfactory?

@joamatab
Copy link
Contributor

joamatab commented Nov 7, 2022

yes Bas, and at least in gdsfactory you cannot save the GDS after setting the properties of the polygons

gdsfactory/gdsfactory#821

@amccaugh
Copy link
Owner

amccaugh commented Jan 5, 2023

I'm not really familiar with properties it seems -- what are they generally used for? Some kind of dictionary I see, but are they present in the GDSII spec, or are they custom to gdspy? What is the expected behavior here? I'm a little baffled that any memory is shared between the output of pg.boolean and its inputs, but I can look into it if that would be useful

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

3 participants