Skip to main content

Module trim

Module trim 

Source
Expand description

Trim sketch geometry between sampled-polyline intersections around the click.

Samples carry curve parameters for choosing trim bounds. Lines split into segments, circles become arcs, arcs shorten, and Béziers keep surviving control-point ranges. Without bracketing intersections, the geometry is deleted.

Cut points are pinned onto the crossing line or arc/circle, using coincidence near line endpoints. A surviving arc carries its radius through its endpoints; the trimmed circle’s old radius point need not survive. Unreferenced points are removed after each trim by [cleanup_orphan_points].

Functions§

pick_geometry_id
The id of the geometry whose sampled polyline passes nearest to (u, v) within radius, or None. The geometry-only picker the trim tool uses (points are NOT candidates — a trim click acts on a curve).
trim_geometry
Trim (or delete) the geometry geo_id at the plane click (u, v) — the port of #trimGeometry. Samples the target, collects its intersections with every other geometry, brackets the click, and splits per type; with no bracketing intersections the whole geometry is deleted. Returns whether the doc changed (the caller then re-solves). Does NOT solve or touch selection/undo — the engine wrapper owns that.