Sketch Palette, docked at the right while sketching: line type of the selected curves (normal, construction, centerline), Look At, and options kept with each sketch (sketch.options: Sketch Grid, Snap, Slice, Show Profile, Show Points, Show Dimensions, Show Constraints, Show Projected Geometries, 3D Sketch), the degrees of freedom, Finish Sketch. Slice cuts the model at the sketch plane; Snap off places points at the cursor

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AS5Tn3xieewUSg3uxrMVdL
This commit is contained in:
bherbruckandClaude Opus 5.5 committed 2026-10-08 07:50:35 +00:00
1 parent 2608ae6761
commit bbd0a19260
10 files changed
+382 -7

No files matched your search

+36
View File
@@ -430,6 +430,34 @@ pub struct Constraint {
pub text: Option<Vec2>,
}
/// How a sketch is shown and drawn in (the Sketch Palette options kept with the sketch). Every
/// flag is off by default, so a sketch shows everything, with grid and snap.
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(default)]
pub struct SketchView {
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub hide_profile: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub hide_points: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub hide_dimensions: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub hide_constraints: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub hide_projected: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub hide_grid: bool,
/// Clicks don't snap to the grid.
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub no_snap: bool,
/// Cut away the model in front of the sketch plane while editing.
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub slice: bool,
/// 3D sketch: drawing may leave the sketch plane.
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub three_d: bool,
}
/// A 2D sketch. Point 0 is always the fixed sketch origin (id `origin`).
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Sketch {
@@ -445,6 +473,13 @@ pub struct Sketch {
/// Next number per id prefix (`l` → l1, l2…).
#[serde(default)]
counters: std::collections::BTreeMap<String, u64>,
/// Display options (Sketch Palette).
#[serde(default, skip_serializing_if = "is_default_view")]
pub view: SketchView,
}
fn is_default_view(v: &SketchView) -> bool {
*v == SketchView::default()
}
impl Default for Sketch {
@@ -462,6 +497,7 @@ impl Sketch {
links: Vec::new(),
wires: Vec::new(),
counters: Default::default(),
view: SketchView::default(),
}
}