offset¶
- photonforge.offset(operand, distance, round_joins=False, trim_x_min=False, trim_x_max=False, trim_y_min=False, trim_y_max=False)¶
Dilate or erode a set of polygons.
- Parameters:
operand (Rectangle | Circle | Polygon | Path | Component | Reference | Iterable[Rectangle | Circle | Polygon | Path | Component | Reference]) – Polygons to be offset. All polygons are joined before the operation.
distance (float) – Amount to dilate (positive) or erode (negative).
round_joins (bool) – If set, substitute convex angles with round joins.
trim_x_min (bool) – Remove the added margin from the lower bound in the x direction. Only effective when
distance > 0.trim_x_max (bool) – Remove the added margin from the upper bound in the x direction. Only effective when
distance > 0.trim_y_min (bool) – Remove the added margin from the lower bound in the y direction. Only effective when
distance > 0.trim_y_max (bool) – Remove the added margin from the upper bound in the y direction. Only effective when
distance > 0.
- Returns:
Resulting polygons.
- Return type:
list[Polygon]
Examples
>>> horizontal = pf.Rectangle(center=(0, 0), size=(11, 2)) >>> vertical = pf.Rectangle(center=(0, 0), size=(2, 11)) >>> outer_cross = pf.offset( ... [horizontal, vertical], 1, round_joins=True ... ) >>> inner_cross = pf.offset([horizontal, vertical], -0.5) >>> len(outer_cross), len(inner_cross) (1, 1)