Zum Hauptinhalt springen

raygeo.ops.assembly.shrinkwrap

ShrinkwrapSpec

Parameters for the shrinkwrap assembler.

Construct with ShrinkwrapSpec(gravity, offset_mm, ...). Wrap in an ~raygeo.ops.assembly.Assembler instance to drive the Assembler trait.

allow_arcs

allow_arcs: bool

arc_tolerance

arc_tolerance: float

cut_side

cut_side: str

gravity

gravity: float

offset_mm

offset_mm: float

supports_curves

supports_curves: bool

Functions

shrinkwrap()

shrinkwrap(
part: ops.part.Part,
gravity: float = 0.1,
offset_mm: float = 0,
cut_side: str = 'centerline',
arc_tolerance: float = 0,
allow_arcs: bool = True,
supports_curves: bool = False,
) -> ops.assembly.AssemblyResult

Generate a shrink-wrapped (concave hull) contour around image content.

Reads the pixel image from part.image (a 2-D uint8 numpy array), computes a concave hull using Bézier gravity attraction, transforms pixel coordinates to millimetre space via the part's size_mm and image dimensions, computes the total offset from offset / cut-side, applies it, optionally fits arcs/curves when arc_tolerance > 0, and returns the result as an AssemblyResult.

Raises: ValueError — If the image is empty, part has no size,

or `part.image` is None.
ParameterTypeDescription
partops.part.PartPart providing physical size metadata and the image buffer (part.image).
gravityfloat = 0.1Shrink-wrap factor 0.0–1.0 (0 = convex hull, default 0.1).
offset_mmfloat = 0Total path offset distance in mm (default 0.0).
cut_sidestr = 'centerline'"centerline", "outside", or "inside" (default "centerline").
arc_tolerancefloat = 0Curve fitting tolerance in mm (default 0.0).
allow_arcsbool = TrueFit arcs when arc_tolerance > 0 (default True).
supports_curvesbool = FalseKeep Bézier curves when arc_tolerance > 0 (default False).
Returnsops.assembly.AssemblyResultAn AssemblyResult with the shrinkwrap path.