Measure now reads the picked item's exact shape (cylindrical faces, circular and arc edges, sketch circles, arcs and lines, profiles, planes, points): - A circle, hole or arc shows Ø, R and its length (circumference, or arc length and angle). - A slot (a sketch profile, or a half-cylinder end of a slot in a solid) shows its width, centre-to-centre length and overall length. - Two items where one is round measure from the centre or axis by default (axis to axis, axis to plane, edge or point), with the closest and farthest distances listed too; the panel switches between centre, min and max, and the canvas line follows. - inspect.measure and MCP `measure` (new `items` argument) add diameter, radius, center_distance, min and max; existing fields are unchanged. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c36a6f9f90
commit
1744fbb262
18 files changed
+1244
-73
No files matched your search
@@ -249,8 +249,8 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui, painter: &egui::Painter, proj
|
||||
app.dialog = Some(d);
|
||||
return;
|
||||
}
|
||||
if let Kind::Measure { result: Some(r), .. } = &d.kind {
|
||||
measure_line(app, painter, proj, r);
|
||||
if let Kind::Measure { result: Some(r), show, .. } = &d.kind {
|
||||
measure_line(app, painter, proj, r, *show);
|
||||
app.dialog = Some(d);
|
||||
return;
|
||||
}
|
||||
@@ -758,14 +758,11 @@ fn radius_spline_handles(app: &SolveApp, ui: &mut egui::Ui, painter: &egui::Pain
|
||||
true
|
||||
}
|
||||
|
||||
/// The measured distance: a line between the closest points with its length.
|
||||
fn measure_line(app: &SolveApp, painter: &egui::Painter, proj: &Proj, r: &serde_json::Value) {
|
||||
/// The measured distance: a line between the ends of the shown measure (the centres for
|
||||
/// centre to centre, the closest or farthest points) with its length.
|
||||
fn measure_line(app: &SolveApp, painter: &egui::Painter, proj: &Proj, r: &serde_json::Value, show: Option<crate::dialogs::Shown>) {
|
||||
let t = Tokens::get();
|
||||
let p = |k: &str| -> Option<Vec3> {
|
||||
let a = r.get(k)?.as_array()?;
|
||||
Some(Vec3::new(a.first()?.as_f64()?, a.get(1)?.as_f64()?, a.get(2)?.as_f64()?))
|
||||
};
|
||||
let (Some(a), Some(b), Some(d)) = (p("from"), p("to"), r.get("distance_mm").and_then(|v| v.as_f64())) else { return };
|
||||
let Some((_, d, a, b)) = crate::dialogs::shown_distance(r, show) else { return };
|
||||
let (Some(sa), Some(sb)) = (proj.to_screen(a), proj.to_screen(b)) else { return };
|
||||
painter.line_segment([sa, sb], Stroke::new(2.0, t.manipulator));
|
||||
for s in [sa, sb] {
|
||||
|
||||
Reference in new issue
Block a user