gdsfactory.boolean#
- gdsfactory.boolean(A: ComponentOrReference, B: ComponentOrReference, operation: str, layer1: LayerSpec | None = None, layer2: LayerSpec | None = None, layer: LayerSpec = (1, 0)) Component [source]#
Performs boolean operations between 2 Component/Reference/list objects.
operation
should be one of {‘not’, ‘and’, ‘or’, ‘xor’, ‘-’, ‘&’, ‘|’, ‘^’}. Note that ‘|’ is equivalent to ‘or’, ‘-’ is equivalent to ‘not’, ‘&’ is equivalent to ‘and’, and ‘^’ is equivalent to ‘xor’.- Parameters:
A – Component(/Reference) or list of Component(/References).
B – Component(/Reference) or list of Component(/References).
operation – {‘not’, ‘and’, ‘or’, ‘xor’, ‘-’, ‘&’, ‘|’, ‘^’}.
layer1 – Specific layer to get polygons.
layer2 – Specific layer to get polygons.
layer – Specific layer to put polygon geometry on.
- Returns: Component with polygon(s) of the boolean operations between
the 2 input Components performed.
Notes:#
‘|’ is equivalent to ‘or’.
‘-’ is equivalent to ‘not’.
‘&’ is equivalent to ‘and’.
‘^’ is equivalent to ‘not’.
import gdsfactory as gf c = gf.Component() c1 = c << gf.components.circle(radius=10) c2 = c << gf.components.circle(radius=9) c2.dmovex(5) c = gf.boolean(c1, c2, operation="xor") c.plot()
(
Source code
,png
,hires.png
,pdf
)