Design: Text and SVG draw INTO the open sketch instead of beside it

Mirror of snaporca 1fb7786d9a (DesignPanel.cpp and DesignCanvas.cpp applied as patches;
parity 30 / 16, shared files byte-identical).

With a sketch open, Text/SVG outlines become ordinary Line entities via push_closed_lines()
instead of a separate Sketch feature carrying rigid imported_regions — so the letters can
be constrained, trimmed and extruded like anything drawn by hand. The buttons and offer
actions arm Select first when in Sketch mode, since begin_sketch() does not run until a
tool is armed.

add_imported_regions() calls reset_autoedit(): without it the glyph contours entered the
draw-then-edit queue and opened a Length field on the first segment, which freezes the
canvas. Caught on the rig, not by reading.

No sketch open: unchanged — a new Sketch feature, still dropped on a picked face.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LyRwbuq6fjn3VV9U9UvhBM
This commit is contained in:
Tommaso Bianchi
2026-08-01 17:38:44 +02:00
co-authored by Claude Opus 5
parent 447c71a0d2
commit bc4fb3b680
5 changed files with 68 additions and 4 deletions
+7
View File
@@ -79,6 +79,13 @@ public:
void begin_edit(const std::vector<SketchEntity>& entities,
const std::vector<SketchEntityConstraintDef>& constraints,
const SketchPlane& plane);
// Drop rigid 2D art (Text / SVG outlines) INTO the live sketch as ordinary line entities,
// so it joins the sketch being drawn instead of committing a separate Sketch feature.
// `regions` are loops in PLANE coordinates; every closed loop becomes a closed polyline, so
// the result is editable, constrainable and extrudable like anything else drawn by hand —
// unlike imported_regions, which are rigid and carry no solver entities.
// Returns false when no session is live, so the caller can fall back to a new feature.
bool add_imported_regions(const std::vector<std::vector<std::vector<Vec2d>>>& regions);
void set_tool(Mode mode); // switch tool, keep accumulated entities
void set_plane(const SketchPlane& plane) { m_plane = plane; } // re-plane a live sketch (a reference plane was clicked mid-session); entities are 2D, re-lifted through the new plane
void set_construction(bool c) { m_construction = c; }