Add persistent sketch-constraint system (ocs_gcs port) and named-parameters handoff docs

Ports FreeCAD's planegcs 2D geometric constraint solver to Rust as a new
crates/ocs_gcs workspace member, and wires it into the document/scene model
as a persistent SketchConstraintSet: Coincident, Horizontal/Vertical,
Parallel/Perpendicular, Equal, Tangent, Distance, Angle and Radius
constraints that re-solve live (including mid-drag, not just on release),
render glyphs and a DOF badge, flag conflicts with a one-click resolver
pill, and round-trip through save/load via an XRecord blob.

Also includes docs/command_reference.md (a statically generated reference
of every registered command and its prompt sequence) and
docs/named_parameters_design.md + docs/backlog.md, which hand off the next
queued feature (a named-parameter/expression table) and consolidate every
deliberate scope-down and open gap found along the way, so a fresh session
has a complete starting point.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Felix RiestraandClaude Sonnet 5 committed 2026-09-08 22:19:23 +02:00
1 parent a39c7b8f71
commit 63a74b19a9
63 files changed
+12193 -49

No files matched your search

+47
View File
@@ -645,6 +645,7 @@ pub fn selection_overlay<'a>(
crosshair_bg: [f32; 4],
crosshair: CrosshairOptions,
selection_visual: SelectionVisualOptions,
constraint_glyphs: Vec<(Point, String, bool)>,
) -> Element<'a, Message> {
canvas(SelectionCanvas {
selection,
@@ -668,6 +669,7 @@ pub fn selection_overlay<'a>(
crosshair_bg,
crosshair,
selection_visual,
constraint_glyphs,
})
.width(Length::Fill)
.height(Length::Fill)
@@ -726,6 +728,13 @@ struct SelectionCanvas {
crosshair_bg: [f32; 4],
crosshair: CrosshairOptions,
selection_visual: SelectionVisualOptions,
/// One glyph per persistent sketch constraint in the current scope
/// (design doc §6.3/§7): screen anchor + label text (its symbol, plus a
/// dimensional kind's driving value — `sketch_constraints::glyph_label`)
/// + whether `solve_scope`'s `classify_redundant` call (stage 10/11)
/// flagged this constraint as redundant/conflicting — the design doc
/// §6.3's recommended "glyph color, not wire recoloring" state cue.
constraint_glyphs: Vec<(Point, String, bool)>,
}
fn draw_grip_marker(
@@ -1618,6 +1627,44 @@ impl canvas::Program<Message> for SelectionCanvas {
frame.stroke(&b1, stroke.clone());
frame.stroke(&b2, stroke);
}
// Persistent sketch-constraint glyphs (design doc §6.3/§7): a small
// pill at each constraint's anchor point, its symbol (plus value for
// a dimensional kind) as text — visual-only for now, no hit-testing.
if !self.constraint_glyphs.is_empty() {
const GLYPH_SIZE: f32 = 11.0;
const GLYPH_PAD_X: f32 = 5.0;
const GLYPH_PAD_Y: f32 = 2.0;
let normal_bg = theme.palette().primary.base.color;
let normal_fg = theme.palette().primary.base.text;
// Design doc §6.3's recommended color cue: a constraint
// `solve_scope` flagged as redundant/conflicting (stage 10/11's
// `classify_redundant`) gets the danger palette instead of the
// ordinary primary one — same information a resolver panel
// would show, surfaced right on the geometry.
let conflict_bg = theme.palette().danger.base.color;
let conflict_fg = theme.palette().danger.base.text;
for (anchor, label, is_conflicting) in &self.constraint_glyphs {
if !anchor.x.is_finite() || !anchor.y.is_finite() {
continue;
}
let (bg, fg) = if *is_conflicting { (conflict_bg, conflict_fg) } else { (normal_bg, normal_fg) };
// Rough width estimate (monospace-ish glyph set, short labels)
// avoids a text-measurement pass just to size the background pill.
let w = label.chars().count() as f32 * GLYPH_SIZE * 0.62 + GLYPH_PAD_X * 2.0;
let h = GLYPH_SIZE + GLYPH_PAD_Y * 2.0;
let top_left = Point::new(anchor.x - w * 0.5, anchor.y - h * 0.5);
let pill = canvas::Path::rounded_rectangle(top_left, iced::Size::new(w, h), (h * 0.5).into());
frame.fill(&pill, bg);
frame.fill_text(canvas::Text {
content: label.clone(),
position: Point::new(top_left.x + GLYPH_PAD_X, top_left.y + GLYPH_PAD_Y),
color: fg,
size: iced::Pixels(GLYPH_SIZE),
shaping: iced::advanced::text::Shaping::Advanced,
..Default::default()
});
}
}
// Small cross at each acquired tracking point.
for ost in &self.ost_points {
let tp = ost.screen;