gdsfactory.geometry.union

Contents

gdsfactory.geometry.union#

gdsfactory.geometry.union(component: Component, by_layer: bool = False, precision: float = 0.0001, join_first: bool = True, layer: Layer = (1, 0), keep_ports: bool = False) Component[source]#

Returns new Component with inverted union of Component polygons.

based on phidl.geometry.union

Parameters:
  • component – Component(/Reference), list of Component(/Reference), or Polygon A containing the polygons to perform union and inversion on.

  • by_layer – performs the union operation layer-wise so each layer can be individually combined.

  • precision – Desired precision for rounding vertex coordinates.

  • join_first – before offsetting to avoid unnecessary joins in adjacent polygons.

  • layer – Specific layer to put polygon geometry on.

  • keep_ports – keep ports from component.

import gdsfactory as gf
c = gf.Component()
c << gf.components.ellipse(radii=(6, 6))
c << gf.components.ellipse(radii=(10, 4))
c2 = gf.geometry.union(c, join_first=False)
c2.plot()

(Source code, png, hires.png, pdf)

../_images/gdsfactory-geometry-union-1.png