def add_keepout(component, target_layers, keepout_layers, margin=2.0) -> Component: """Adds keepout after Looking up all polygons in a cell. You can also use add_padding Args: component target_layers: list of layers to read keepout_layers: list of layers to add keepout margin: offset from tareget to keepout_layers """ c = Component(f"{component.name}_ko") c << component for layer in target_layers: polygons = component.get_polygons(by_spec=layer) if polygons: for ko_layer in keepout_layers: ko_layer = _parse_layer(ko_layer) polygon_keepout = [ polygon_grow(polygon, margin) for polygon in polygons ] c.add_polygon(polygon_keepout, ko_layer) return c
def add_keepout(c, target_layers, keepout_layers, margin=2.0): """ Lookup all polygons in this cell """ all_cells = list(c.get_dependencies(True)) + [c] for _c in all_cells: for _layer in target_layers: polys_by_layer = _c.get_polygons(by_spec=True) layer = _parse_layer(_layer) for ko_layer in keepout_layers: ko_layer = _parse_layer(ko_layer) polys = polys_by_layer[ layer] if layer in polys_by_layer else [] if not polys: continue ko_polys_pts = [polygon_grow(poly, margin) for poly in polys] _c.add_polygon(ko_polys_pts, ko_layer)
def gen_op_blocking(pts, snap_res=0.05, margin=0.3): return polygon_grow(pts, margin)
def gen_pixels_op_blocking(pts, snap_res=0.05, margin=1.0, min_pixel_size=0.4): op_block_pts = polygon_grow(pts, margin) return pixelate(op_block_pts, min_pixel_size=min_pixel_size, N=100, snap_res=snap_res)