phidl icon indicating copy to clipboard operation
phidl copied to clipboard

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

Open basnijholt opened this issue 1 year ago • 2 comments

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?

basnijholt avatar Nov 04 '22 01:11 basnijholt