Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

Shaded with hidden edges: optionally select edges through faces (#11841)

cronosde9a2bc8469a
diff --git a/assets/locales/pending/hidden-edge-selection.json b/assets/locales/pending/hidden-edge-selection.json
new file mode 100644
index 0000000000..c793369654
--- /dev/null
+++ b/assets/locales/pending/hidden-edge-selection.json
@@ -0,0 +1,37 @@
+{
+ "ar": {
+ "prefs.select_hidden_edges": "تحديد الحواف المخفية في العرض المظلل مع الحواف المخفية",
+ "prefs.select_hidden_edges_help": "يتيح تحديد الحواف عبر الأسطح عند تفعيل العرض المظلل مع الحواف المخفية، بما في ذلك استخدام أداة Fillet. يحافظ إيقافه على سلوك التحديد في v0.30.1. تظل الأجسام المخفية غير قابلة للتحديد."
+ },
+ "de": {
+ "prefs.select_hidden_edges": "Verdeckte Kanten in der schattierten Ansicht mit verdeckten Kanten auswählen",
+ "prefs.select_hidden_edges_help": "Kanten durch Flächen auswählen, wenn die schattierte Ansicht mit verdeckten Kanten aktiv ist, auch zum Verrunden. Aus behält das Auswahlverhalten von v0.30.1 bei. Ausgeblendete Körper bleiben ausgeschlossen."
+ },
+ "en": {
+ "prefs.select_hidden_edges": "Select hidden edges in Shaded with hidden edges",
+ "prefs.select_hidden_edges_help": "Select edges through faces when Shaded with hidden edges is active, including for Fillet. Off keeps v0.30.1 selection behavior. Hidden bodies stay unselectable."
+ },
+ "en-GB": {
+ "prefs.select_hidden_edges_help": "Select edges through faces when Shaded with hidden edges is active, including for Fillet. Off keeps v0.30.1 selection behaviour. Hidden bodies stay unselectable."
+ },
+ "he": {
+ "prefs.select_hidden_edges": "בחירת קצוות מוסתרים בתצוגה מוצללת עם קצוות מוסתרים",
+ "prefs.select_hidden_edges_help": "מאפשר לבחור קצוות דרך פאות בתצוגה מוצללת עם קצוות מוסתרים, גם עבור Fillet. כיבוי שומר על אופן הבחירה של v0.30.1. גופים שהוסתרו עדיין אינם ניתנים לבחירה."
+ },
+ "ja": {
+ "prefs.select_hidden_edges": "隠線表示で隠れた辺を選択する",
+ "prefs.select_hidden_edges_help": "「Shaded with hidden edges」で面の向こうの辺を選択し、Filletにも使用できます。オフではv0.30.1相当の選択動作になります。非表示のボディは選択対象になりません。"
+ },
+ "ko": {
+ "prefs.select_hidden_edges": "숨은 모서리가 표시된 음영 뷰에서 숨은 모서리 선택",
+ "prefs.select_hidden_edges_help": "숨은 모서리가 표시된 음영 뷰에서 면 뒤의 모서리를 선택하여 필렛에 사용할 수 있습니다. 끄면 v0.30.1의 선택 동작을 유지합니다. 숨긴 바디는 선택되지 않습니다."
+ },
+ "vi": {
+ "prefs.select_hidden_edges": "Chọn cạnh bị che trong chế độ tô bóng có cạnh ẩn",
+ "prefs.select_hidden_edges_help": "Cho phép chọn cạnh xuyên qua bề mặt khi dùng chế độ tô bóng có cạnh ẩn, kể cả cho lệnh Fillet. Tắt để giữ cách chọn của v0.30.1. Các khối đã ẩn vẫn không thể chọn."
+ },
+ "zh": {
+ "prefs.select_hidden_edges": "在带隐藏边线的着色视图中选择隐藏边",
+ "prefs.select_hidden_edges_help": "在带隐藏边线的着色视图中,可穿过面选择边并用于圆角。关闭时保留v0.30.1的选择行为。隐藏的实体仍不可选择。"
+ }
+}
diff --git a/crates/ui-egui/src/prefs.rs b/crates/ui-egui/src/prefs.rs
index 1934cab4d8..2f89b26002 100644
--- a/crates/ui-egui/src/prefs.rs
+++ b/crates/ui-egui/src/prefs.rs
@@ -1602,6 +1602,9 @@ preference_settings! {
/// tangent arc, and the same again back to lines (#9489). Off (the default): resting there
/// does nothing, and tangent arcs are the Arc tool's.
line_hover_tangent_arc: bool = false, PAGE_SKETCH;
+ /// Allow ordinary edge picks through faces in Shaded with hidden edges.
+ /// Off preserves the visible-only picking used in v0.30.1.
+ select_hidden_edges: bool = false, PAGE_SKETCH;
/// Include hidden geometry and a small pointer neighbourhood in Select Other.
select_other_hidden: bool = true, PAGE_SKETCH;
/// Where a dimension's value is typed: in a box on the dimension (the default), or in a small
@@ -6093,6 +6096,7 @@ mod tests {
("look_at_anim", json!(false), PAGE_NAVIGATION),
("selection_shift_add_only", json!(true), PAGE_SKETCH),
("select_other_hidden", json!(false), PAGE_SKETCH),
+ ("select_hidden_edges", json!(true), PAGE_SKETCH),
("sketch_conflict_colour", json!(false), PAGE_SKETCH),
("hide_constraint_glyphs_zoomed_out", json!(false), PAGE_SKETCH),
("suppress_sketch_snap", json!(ModifierCombo::NONE), PAGE_SKETCH),
@@ -9744,6 +9748,27 @@ mod tests {
assert!(h.app.session.undo.is_empty());
}
+ #[test]
+ fn hidden_edge_preference_defaults_persists_and_uses_real_checkbox() {
+ let mut h = crate::scenario::Harness::new();
+ assert!(!Prefs::default().select_hidden_edges);
+ assert!(!serde_json::from_value::<Prefs>(json!({})).unwrap().select_hidden_edges);
+ h.call("ui.prefs", json!({"open":"Sketch"}));
+ super::reveal_preference(&mut h, "prefs:select_hidden_edges");
+ h.step(&json!({"click":{"handle":"prefs:select_hidden_edges"}})).unwrap();
+ assert!(h.app.preferences.select_hidden_edges);
+ h.call("ui.prefs", json!({"button":"cancel"}));
+ assert!(!h.app.preferences.select_hidden_edges);
+ h.call("ui.prefs", json!({"open":"Sketch","select_hidden_edges":true,"button":"apply"}));
+ let mut restored = SolveApp::new(solidcraft_engine::Session::default(), Default::default());
+ restored.load_prefs(&h.app.prefs());
+ assert!(restored.preferences.select_hidden_edges);
+ h.call("ui.prefs", json!({"button":"defaults"}));
+ assert!(!h.app.preferences.select_hidden_edges);
+ h.call("ui.prefs", json!({"button":"cancel"}));
+ assert!(h.app.preferences.select_hidden_edges);
+ }
+
#[test]
fn tool_modifier_prefs_default_classic_and_persist() {
let d = Prefs::default();
diff --git a/crates/ui-egui/src/prefs/sketch.rs b/crates/ui-egui/src/prefs/sketch.rs
index 7f1c1c52b0..e29936b05e 100644
--- a/crates/ui-egui/src/prefs/sketch.rs
+++ b/crates/ui-egui/src/prefs/sketch.rs
@@ -391,6 +391,13 @@ fn selecting(app: &mut SolveApp, ui: &mut egui::Ui) {
],
);
check(ui, "prefer_free_sketch_points", "prefs.sketch.prefer_free_points", None, &mut app.preferences.prefer_free_sketch_points);
+ check(
+ ui,
+ "select_hidden_edges",
+ "prefs.select_hidden_edges",
+ Some("prefs.select_hidden_edges_help"),
+ &mut app.preferences.select_hidden_edges,
+ );
check(
ui,
"select_other_hidden",
diff --git a/crates/ui-egui/src/select_other_tests.rs b/crates/ui-egui/src/select_other_tests.rs
index 502bc4d988..1783c01fa2 100644
--- a/crates/ui-egui/src/select_other_tests.rs
+++ b/crates/ui-egui/src/select_other_tests.rs
@@ -921,3 +921,222 @@ fn changing_hidden_selection_or_opening_an_empty_point_clears_the_old_list() {
assert_eq!(h.call("ui.selectOther", json!({"x":rect.left()+20.0,"y":rect.top()+20.0}))["result"]["open"], false);
assert!(!super::is_open(&h.app), "an empty point cannot keep the preceding list");
}
+
+/// A separate cover blocks the target edge at every point along it.
+fn covered_edge() -> (Harness, egui::Pos2) {
+ let mut h = Harness::new();
+ h.app.set_origin_shown(false);
+ h.app.run("solid.box", json!({"length":10,"width":10,"height":10,"body_name":"Target"})).unwrap();
+ h.app.run("solid.box", json!({"length":30,"width":30,"height":10,"corner":[-10,-10,20],"body_name":"Cover"})).unwrap();
+ h.call("ui.view", json!({"view":"top"}));
+ h.call("ui.view", json!({"view":"fit"}));
+ let at = h.at(&json!({"world":[5,0,10]})).unwrap();
+ (h, egui::pos2(at[0] as f32, at[1] as f32))
+}
+
+#[test]
+fn hidden_edge_mode_is_scoped_and_invalidates_hover_without_pointer_motion() {
+ use crate::viewport::{Hit, pick_all, pick_cached, projection};
+ let (mut h, pos) = covered_edge();
+ let proj = projection(&h.app, h.app.viewport.rect.unwrap());
+ let target = |hit: &Hit| matches!(hit, Hit::Edge { body, .. } if body == "Target");
+ h.app.ui.visual_style = 3;
+ assert!(!pick_cached(&mut h.app, &proj, pos).iter().any(target));
+ assert_eq!(h.call("ui.prefs", json!({"select_hidden_edges":true}))["ok"], true);
+ assert!(pick_cached(&mut h.app, &proj, pos).iter().any(target));
+ assert!(pick_all(&h.app, &proj, pos).iter().any(target));
+ for style in [0, 1, 2, 3] {
+ h.app.ui.visual_style = style;
+ assert_eq!(pick_cached(&mut h.app, &proj, pos).iter().any(target), style >= 2, "style {style}");
+ }
+ h.app.session.visibility.hidden_bodies.push("Target".into());
+ assert!(!pick_cached(&mut h.app, &proj, pos).iter().any(target));
+ h.app.session.visibility.hidden_bodies.clear();
+ // The section removes the target entirely: even hidden-edge mode must exclude it.
+ h.app.session.section = Some((solidcore_record::Vec3::new(0.0, 0.0, -5.0), solidcore_record::Vec3::Z));
+ assert!(!pick_all(&h.app, &proj, pos).iter().any(target));
+ h.app.session.section = None;
+ h.call("ui.prefs", json!({"select_hidden_edges":false}));
+ assert!(!pick_cached(&mut h.app, &proj, pos).iter().any(target));
+}
+
+#[test]
+fn hidden_edge_mode_keeps_section_caps_as_occluders() {
+ use crate::viewport::{Hit, pick, pick_all, projection};
+ let (mut h, pos) = covered_edge();
+ h.app.ui.visual_style = 3;
+ h.app.preferences.select_hidden_edges = true;
+ let proj = projection(&h.app, h.app.viewport.rect.unwrap());
+ let target = |hit: &Hit| matches!(hit, Hit::Edge { body, .. } if body == "Target");
+ assert!(pick_all(&h.app, &proj, pos).iter().any(target), "an ordinary face permits hidden edges");
+ // The target remains below the cut, but the section cap through the cover hides it.
+ h.app.session.section = Some((solidcore_record::Vec3::new(0.0, 0.0, 25.0), solidcore_record::Vec3::Z));
+ assert!(!pick(&h.app, &proj, pos).iter().any(target), "ordinary picking must respect the cap");
+ assert!(!pick_all(&h.app, &proj, pos).iter().any(target), "Select Other must respect the cap");
+ // A plane between the bodies removes the cover without making a cap over the target.
+ h.app.session.section = Some((solidcore_record::Vec3::new(0.0, 0.0, 15.0), solidcore_record::Vec3::Z));
+ assert!(pick_all(&h.app, &proj, pos).iter().any(target));
+}
+
+#[test]
+fn hidden_edge_mode_keeps_caps_behind_a_nearer_kept_face() {
+ use crate::viewport::{Hit, pick, pick_all, projection};
+ let (mut h, _) = covered_edge();
+ // This face counts as kept just before the cut. The Cover still crosses the plane.
+ let top = 25.0 + crate::view_pick::SECTION_EPS * 0.5;
+ h.app.run("solid.box", json!({"length":30,"width":30,"height":1,"corner":[-10,-10,top-1.0],"body_name":"NearFace"})).unwrap();
+ h.app.cam.pitch = std::f64::consts::FRAC_PI_2;
+ h.app.ui.perspective = false;
+ h.app.ui.visual_style = 3;
+ h.app.preferences.select_hidden_edges = true;
+ let proj = projection(&h.app, h.app.viewport.rect.unwrap());
+ // The ray lies inside the faces, close enough to reach the Target's edge.
+ let pos = proj.to_screen(solidcore_record::Vec3::new(5.0, 0.02, 10.0)).unwrap();
+ let target = |hit: &Hit| matches!(hit, Hit::Edge { body, .. } if body == "Target");
+ assert!(pick_all(&h.app, &proj, pos).iter().any(target), "ordinary faces permit hidden edges");
+ h.app.session.section = Some((solidcore_record::Vec3::new(0.0, 0.0, 25.0), solidcore_record::Vec3::Z));
+ for enabled in [false, true] {
+ h.app.preferences.select_hidden_edges = enabled;
+ for hits in [pick(&h.app, &proj, pos), pick_all(&h.app, &proj, pos)] {
+ assert!(hits.iter().any(|hit| matches!(hit, Hit::Face { body, .. } if body == "NearFace")), "the nearer kept face remains selectable");
+ assert!(!hits.iter().any(target), "the cap still hides the Target with hidden edges {enabled}");
+ }
+ }
+}
+
+#[test]
+fn hidden_edge_ties_prefer_visible_edges_without_overriding_distance() {
+ use crate::viewport::{Hit, pick, pick_all, projection};
+ for front_first in [false, true] {
+ for offset in [0.0, -0.1] {
+ let mut h = Harness::new();
+ h.app.set_origin_shown(false);
+ for front in [front_first, !front_first] {
+ h.app
+ .run("solid.box", json!({"length":40,"width":30,"height":10,"corner":[0,if front { offset } else { 0.0 },if front { 20 } else { 0 }],"body_name":if front { "Front" } else { "Rear" }}))
+ .unwrap();
+ }
+ h.call("ui.view", json!({"view":"top"}));
+ h.call("ui.view", json!({"view":"fit"}));
+ h.app.ui.visual_style = 3;
+ // Standard views stop just short of vertical; use an exact pole for a true screen tie.
+ h.app.cam.pitch = std::f64::consts::FRAC_PI_2;
+ h.app.ui.perspective = false;
+ let proj = projection(&h.app, h.app.viewport.rect.unwrap());
+ assert_eq!(h.app.session.world_state().unwrap().bodies[0].name, if front_first { "Front" } else { "Rear" });
+ if offset == 0.0 {
+ for x in [0.0, 40.0] {
+ assert_eq!(proj.to_screen(solidcore_record::Vec3::new(x, 0.0, 10.0)), proj.to_screen(solidcore_record::Vec3::new(x, 0.0, 30.0)));
+ }
+ }
+ // Keep the ray inside both faces so boundary rounding cannot hide the nearer face.
+ let pos = proj.to_screen(solidcore_record::Vec3::new(20.0, 0.02, 10.0)).unwrap();
+ for enabled in [false, true] {
+ h.app.preferences.select_hidden_edges = enabled;
+ let expected = if enabled && offset != 0.0 { "Rear" } else { "Front" };
+ for (all, hits) in [(false, pick(&h.app, &proj, pos)), (true, pick_all(&h.app, &proj, pos))] {
+ let edges: Vec<&str> =
+ hits.iter().filter_map(|hit| if let Hit::Edge { body, .. } = hit { Some(body.as_str()) } else { None }).collect();
+ assert_eq!(edges.first().copied(), Some(expected), "front_first={front_first}, offset={offset}, enabled={enabled}: {edges:?}");
+ if enabled && all {
+ assert!(edges.contains(&"Rear"), "Select Other still offers the hidden edge: {edges:?}");
+ }
+ }
+ }
+ }
+ }
+}
+
+#[test]
+fn hidden_edge_mode_reaches_the_far_side_of_the_same_body() {
+ use crate::viewport::{Hit, pick_all, projection};
+ let mut h = Harness::new();
+ h.app.set_origin_shown(false);
+ h.app.run("solid.box", json!({"length":40,"width":30,"height":20})).unwrap();
+ h.app.cam.yaw = 0.6;
+ h.app.cam.pitch = 0.5;
+ h.app.fit_view();
+ h.settle();
+ h.app.ui.visual_style = 3;
+ let proj = projection(&h.app, h.app.viewport.rect.unwrap());
+ let mesh = h.app.session.world_state().unwrap().body("Body1").unwrap().mesh();
+ let mut hidden = 0;
+ for (index, points) in mesh.edges.iter().enumerate() {
+ let mid = (points[0] + points[points.len() - 1]) * 0.5;
+ let Some(pos) = proj.to_screen(mid) else { continue };
+ let wanted = |hit: &Hit| matches!(hit, Hit::Edge { index: i, .. } if *i == index);
+ h.app.preferences.select_hidden_edges = false;
+ if pick_all(&h.app, &proj, pos).iter().any(wanted) {
+ continue;
+ }
+ h.app.preferences.select_hidden_edges = true;
+ assert!(pick_all(&h.app, &proj, pos).iter().any(wanted), "far-side edge {index}");
+ hidden += 1;
+ }
+ assert!(hidden >= 3, "the three edges meeting at the far corner: {hidden}");
+}
+
+#[test]
+fn hidden_edge_clicks_feed_fillet_before_and_after_opening_the_dialog() {
+ for preselect in [true, false] {
+ let (mut h, pos) = covered_edge();
+ h.call("ui.prefs", json!({"select_hidden_edges":true}));
+ h.app.ui.visual_style = 3;
+ if !preselect {
+ h.app.start("solid.fillet");
+ }
+ h.step(&json!({"click":[pos.x,pos.y]})).unwrap();
+ if preselect {
+ #[cfg(not(target_arch = "wasm32"))]
+ save_hidden_edge_evidence(&h, "hidden-edge-selected");
+ assert!(matches!(h.app.session.selection.first(), Some(Sel::Edge {body,..}) if body == "Target"));
+ h.app.start("solid.fillet");
+ }
+ let d = h.app.dialog.as_mut().unwrap();
+ assert!(matches!(d.inputs[0].items.first(), Some(Sel::Edge {body,..}) if body == "Target"));
+ if let crate::dialogs::Kind::Fillet { radius, .. } = &mut d.kind {
+ *radius = "1".into();
+ }
+ let cmds = crate::dialogs::apply_commands(&h.app, h.app.dialog.as_ref().unwrap()).unwrap();
+ let before = h.app.session.doc.features.len();
+ h.app.dialog = None;
+ for (command, params) in cmds {
+ h.app.run(&command, params).unwrap();
+ }
+ assert_eq!(h.app.session.doc.features.len(), before + 1);
+ assert!(h.app.session.model.results.iter().all(|r| r.error.is_none()));
+ let state = h.app.session.world_state().unwrap();
+ let volume = |name| solidcraft_engine::kernel::measure(&state.body(name).unwrap().body).unwrap().volume;
+ let expected = 1000.0 - 10.0 * (1.0 - std::f64::consts::FRAC_PI_4);
+ assert!((volume("Target") - expected).abs() < 0.02, "radius-1 fillet on a length-10 edge: {}", volume("Target"));
+ assert!((volume("Cover") - 9000.0).abs() < 1e-6, "the cover must stay intact");
+ #[cfg(not(target_arch = "wasm32"))]
+ if preselect {
+ h.app.session.selection.clear();
+ save_hidden_edge_evidence(&h, "hidden-edge-fillet");
+ }
+ }
+}
+
+/// Optional real viewport captures for local review, using the same GPU pipeline as the app.
+#[cfg(not(target_arch = "wasm32"))]
+fn save_hidden_edge_evidence(h: &Harness, name: &str) {
+ let Ok(dir) = std::env::var("SOLIDCRAFT_HIDDEN_EDGE_EVIDENCE") else { return };
+ let size = 768;
+ let proj = crate::viewport::projection(&h.app, egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(size as f32, size as f32)));
+ let eye = proj.cam.eye().to_f32();
+ let rgba = crate::gpu::render_offscreen(
+ crate::viewport::build_scene(&h.app),
+ Some(crate::viewport::build_highlight(&h.app)),
+ proj.vp.to_f32(),
+ proj.cam.back().to_f32(),
+ [eye[0], eye[1], eye[2], if proj.cam.fov > 0.0 { 1.0 } else { 0.0 }],
+ size,
+ None,
+ [0.0; 8],
+ crate::gpu::analysis_colors(&crate::theme::Tokens::get().analysis),
+ )
+ .expect("a GPU is required when evidence capture is requested");
+ std::fs::create_dir_all(&dir).unwrap();
+ image::save_buffer(std::path::Path::new(&dir).join(format!("{name}.png")), &rgba, size, size, image::ColorType::Rgba8).unwrap();
+}
diff --git a/crates/ui-egui/src/viewport.rs b/crates/ui-egui/src/viewport.rs
index ca75607ac9..3816aedae4 100644
--- a/crates/ui-egui/src/viewport.rs
+++ b/crates/ui-egui/src/viewport.rs
@@ -2438,6 +2438,8 @@ pub(crate) fn pick_cached(app: &mut SolveApp, proj: &Proj, pos: Pos2) -> Vec<Hit
app.dialog.is_none().hash(&mut h);
measuring_mesh_edges(app).hash(&mut h);
app.preferences.prefer_free_sketch_points.hash(&mut h);
+ app.preferences.select_hidden_edges.hash(&mut h);
+ app.ui.visual_style.hash(&mut h);
app.viewport.woken_centre.hash(&mut h);
crate::sketch3d::drawing(app).hash(&mut h);
app.dialog.as_ref().and_then(|d| d.active_input()).map(|i| i.accept).hash(&mut h);
@@ -2489,7 +2491,7 @@ pub fn pick_all(app: &SolveApp, proj: &Proj, pos: Pos2) -> Vec<Hit> {
}
/// See-through candidates in a small screen-space disk. The nine rays are fixed and bounded;
-/// ordinary picking and repeat-click cycling retain their visible-only path.
+/// ordinary picking and repeat-click cycling follow the visual style and edge preference.
pub(crate) fn pick_through(app: &SolveApp, proj: &Proj, pos: Pos2) -> Vec<Hit> {
if !pos.x.is_finite() || !pos.y.is_finite() || !proj.rect.contains(pos) {
return Vec::new();
@@ -2777,25 +2779,28 @@ fn pick_hits(app: &SolveApp, proj: &Proj, pos: Pos2, other_sketch_points: bool,
if crate::render_workspace::active(app) {
return if all { faces.sorted().into_iter().map(|(_, hit)| hit).collect() } else { bestf.into_iter().map(|(_, hit)| hit).collect() };
}
- // The cut cap, where the plane crosses a body nearer than any kept face: it hides that face
- // and everything behind it, and is no face itself.
+ // Find the cap independently: a face within the clipping tolerance may lie just ahead
+ // of it. That face stays selectable, but cannot expose edges behind the cap.
let cap = section.and_then(|(so, sn)| {
let den = sn.dot(d);
let t_cap = (sn.dot(so) - sn.dot(o)) / den;
- let nearer = den.abs() > 1e-12 && t_cap > 0.0 && bestf.as_ref().is_none_or(|(t, _)| t_cap < *t);
+ let crosses = den.abs() > 1e-12 && t_cap > 0.0;
let replaced = app.preview.effective_replaced();
let shown_bodies = &None;
- (nearer && crate::view_pick::body_cut_at(app, &st, &bounds, o, d, t_cap, true, replaced, shown_bodies).is_some()).then_some(t_cap)
+ (crosses && crate::view_pick::body_cut_at(app, &st, &bounds, o, d, t_cap, true, replaced, shown_bodies).is_some()).then_some(t_cap)
});
if let Some(t_cap) = cap {
- bestf = None;
- faces.v.retain(|(t, _)| *t < t_cap);
+ if bestf.as_ref().is_some_and(|(t, _)| t_cap < *t) {
+ bestf = None;
+ }
+ faces.v.retain(|(t, _)| *t <= t_cap);
}
- let hidden_from = cap.or(bestf.as_ref().map(|(t, _)| *t));
+ let hidden_from = bestf.as_ref().map(|(t, _)| *t).or(cap);
let slack = scene_pick_slack(app);
// Wireframe draws no faces, so nothing hides an edge or a vertex. `slack` is the body's own:
// what counts as lying on the face in front depends on how coarsely that body is meshed.
let wireframe = app.ui.visual_style == 2;
+ let hidden_edges = app.ui.visual_style == 3 && app.preferences.select_hidden_edges;
let visible = |p: Vec3, slack: f64| kept(p) && (through || wireframe || hidden_from.is_none_or(|t| (p - o).dot(d) <= t + slack));
// Vertices (edge end points) and edges, within 7 and 6 points of the cursor.
let reach = crate::pick_index::reach(proj, pos, 8.0);
@@ -2844,8 +2849,14 @@ fn pick_hits(app: &SolveApp, proj: &Proj, pos: Pos2, other_sketch_points: bool,
// Visible where the cursor is: the edge's point under the cursor, not an end or
// the middle, which can lie deeper than the face the cursor is on.
let point = ray_segment_closest(o, d, p0, p1);
- if dd < 6.0 && beste.wants(dd) && visible(point, body_slack) {
- beste.offer(dd, Hit::Edge { body: b.name.clone(), index: ei, mid: at(polyline_mid(e)), point });
+ // Hidden-edge mode changes only edges of shown bodies. Section clipping,
+ // vertex picks and modelling edge identities keep their ordinary rules.
+ let seen = visible(point, body_slack);
+ let key = (dd, !seen);
+ // A section cap still hides kept material; only ordinary faces permit hidden edges.
+ let hidden = hidden_edges && kept(point) && cap.is_none_or(|t| (point - o).dot(d) <= t + body_slack);
+ if dd < 6.0 && beste.wants(key) && (seen || hidden) {
+ beste.offer(key, Hit::Edge { body: b.name.clone(), index: ei, mid: at(polyline_mid(e)), point });
}
}
}
diff --git a/docs/control-protocol.md b/docs/control-protocol.md
index f75e7330f3..8ad8c603c1 100644
--- a/docs/control-protocol.md
+++ b/docs/control-protocol.md
@@ -747,6 +747,7 @@ One setting per line, sorted by name. A change that adds a setting adds its own
- `quick_measure` (default false: the selection's length, area or distance in the view's bottom right corner, the rect `measure:quick`; #7000)
- `ribbon_reveal` (default false: hovering a result in Search commands switches the ribbon to the command's tab and marks its button, or opens the panel drop-down that holds it on its row, handle `ribbon:reveal`; leaving the results goes back to the tab before; a command started from the search blinks there, and a running command from a drop-down marks its panel label, `ribbon:running_section:<TAB>:<SECTION>`, #7287)
- `right_drag_orbits` (default true; false: a right drag the mouse preset would orbit leaves the camera alone, #6492)
+- `select_hidden_edges` (default false: v0.30.1 visible-only edge picking; true allows ordinary edge picks through faces in Shaded with hidden edges, including Fillet inputs; hidden bodies and section-clipped edges stay excluded)
- `select_other_hidden` (default true: Select Other includes hidden geometry near the pointer; false restores the original visible-only list under the pointer)
- `show_frame_rate` (default false: frames per second in the view's bottom-right corner, counting the frames the view draws anyway; it reads 0 FPS once the view is idle)
- `sketch_auto_dimensions` (default false: each shape drawn in a sketch gets all its dimensions at the sizes drawn, as `sketch.draw.dimensioned` with `as_drawn`; typed values win)
diff --git a/xtask/src/kernel_cases.rs b/xtask/src/kernel_cases.rs
index d5e8022670..91f07d74f3 100644
--- a/xtask/src/kernel_cases.rs
+++ b/xtask/src/kernel_cases.rs
@@ -740,8 +740,13 @@ mod tests {
assert!(options(&["--route", "boolean=solidcore"], "x").is_err());
assert!(options(&["--kernel", "smlib"], "x").is_err());
assert!(options(&["--kernel", "solidcore", "--known-failing", "/k"], "x").is_err());
- let o = options(&["--known-failing", "/k", "--out", "/r"], "x").unwrap();
- assert_eq!((o.known_failing, o.out), (Some(PathBuf::from("/k")), PathBuf::from("/r")));
+ let dir = std::env::current_dir().unwrap();
+ let known = dir.join("known.txt");
+ let out = dir.join("result");
+ let o = options(&["--known-failing", known.to_str().unwrap(), "--out", out.to_str().unwrap()], "x").unwrap();
+ assert_eq!((o.known_failing, o.out), (Some(known), out));
+ let o = options(&["--known-failing", "known.txt", "--out", "result"], "x").unwrap();
+ assert_eq!((o.known_failing, o.out), (Some(root().join("known.txt")), PathBuf::from("result")));
}
fn gate_on(text: &str, cases: &[(&str, &str)]) -> Result<String, String> {