def create_points(self, points): if isinstance(self.path, gdspy.Path): points = clipping.boolean(subj=self.path.polygons, clip_type='or')[0] elif isinstance(self.path, gdspy.FlexPath): points = self.path.get_polygons()[0] return points
def __init__(self, shape, layer, **kwargs): if isinstance(shape, gdspy.Path): shape = clipping.boolean(subj=shape.polygons, clip_type='or')[0] elif isinstance(shape, gdspy.FlexPath): shape = shape.get_polygons()[0] super().__init__(shape=shape, layer=layer, **kwargs)
def union(self): elems = ElementList() if len(self.elements) > 1: points = [] for e in self.elements: shape = e.shape.transform(e.transformation).snap_to_grid() points.append(shape.points) merged_points = clipping.boolean(subj=points, clip_type='or') for uid, pts in enumerate(merged_points): elems += Polygon(shape=pts, layer=self.layer) else: elems = self.elements self.elements = elems return self
def __or__(self, other): return clipping.boolean(subj=[self.points], clip=[other.points], clip_type='or')