Skip to main content

Module external_ref

Module external_ref 

Source
Expand description

Project solid edges into a sketch as fixed construction references.

Projected polylines become lines, circles, arcs, or line-chain fallbacks. Ground constraints pin the generated points. Edge names identify persisted references, so picking an edge again updates its coordinates in place.

Structs§

ExternalRef
A per-session external-reference mapping: the linked scene edge (by name + owning solid) and the sketch entities materialized for it. Persisted to / loaded from persistentData.externalRefs so a linked edge round-trips a commit + re-enter.

Enums§

EdgeLink
The classification of a projected edge polyline, in plane (u, v) coordinates.

Functions§

add_external_ref
Materialize an EdgeLink into the doc: push external-ref points (fixed, construction, externalReference) with a ground each, then the construction geometry referencing them. Returns (point_ids, geom_ids).
classify_uv
Classify a projected polyline (in plane (u, v)) as a straight line, a circle / arc, or a polyline fallback. Tolerances are RELATIVE to the polyline’s extent so the same thresholds work at any sketch scale:
link_or_update
Link (or update) a picked scene edge into the sketch as an external reference.
project_polyline
Project a world-space polyline into the plane’s (u, v) frame (orthogonal projection; the off-plane component is dropped). Mirrors the previous world→UV projection applied per vertex.
prune_dead_refs
Drop every external-reference entry whose materialized entities no longer resolve in doc — i.e. the linked edge’s points / geometry were deleted. A dropped entry frees its edge_name so the SAME edge can be RE-LINKED: without this, the stale entry (keyed by edge_name, holding now-dangling point_ids) makes link_or_update’s dedup take the “structure matches” branch, find every point missing (doc.point_mutNone), and return false — permanently blocking the re-link. Called both after a delete AND on sketch-enter (to heal docs already poisoned by that pre-fix delete). Returns whether any entry was pruned.