From d1b61c7330f1db98431e7afc2c77fbb5aec5789a Mon Sep 17 00:00:00 2001 From: ramox81 <184937705+ramox81@users.noreply.github.com> Date: Wed, 30 Sep 2026 17:50:23 +0300 Subject: [PATCH] Point cloud extraction: structured scans only Plane and cylinder picks ask again and section extraction gives nothing on a scan without segments, as the reference does with unstructured scans (scan segmentation is not decoded yet). The section dialog's time estimate reads in minutes. Co-Authored-By: Claude Opus 5.5 --- locales/ar-SA/opencadstudio.ftl | 2 +- locales/bg-BG/opencadstudio.ftl | 2 +- locales/cs-CZ/opencadstudio.ftl | 2 +- locales/de-DE/opencadstudio.ftl | 2 +- locales/el-GR/opencadstudio.ftl | 2 +- locales/en-US/opencadstudio.ftl | 2 +- locales/es-ES/opencadstudio.ftl | 2 +- locales/fi-FI/opencadstudio.ftl | 2 +- locales/fr-FR/opencadstudio.ftl | 2 +- locales/hi-IN/opencadstudio.ftl | 2 +- locales/hu-HU/opencadstudio.ftl | 2 +- locales/it-IT/opencadstudio.ftl | 2 +- locales/ja-JP/opencadstudio.ftl | 2 +- locales/ko-KR/opencadstudio.ftl | 2 +- locales/nl-NL/opencadstudio.ftl | 2 +- locales/pl-PL/opencadstudio.ftl | 2 +- locales/pt-BR/opencadstudio.ftl | 2 +- locales/ru-RU/opencadstudio.ftl | 2 +- locales/zh-CN/opencadstudio.ftl | 2 +- locales/zh-TW/opencadstudio.ftl | 2 +- src/locale_catalog.rs | 2 +- src/modules/insert/pc_extract.rs | 28 ++++++++++++++++++++++++---- src/ui/window/pdf_dialogs.rs | 2 +- 23 files changed, 46 insertions(+), 26 deletions(-) diff --git a/locales/ar-SA/opencadstudio.ftl b/locales/ar-SA/opencadstudio.ftl index 93a36a4d2..49b2b7ec2 100644 --- a/locales/ar-SA/opencadstudio.ftl +++ b/locales/ar-SA/opencadstudio.ftl @@ -4019,7 +4019,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/bg-BG/opencadstudio.ftl b/locales/bg-BG/opencadstudio.ftl index 33c312e7b..11eec1078 100644 --- a/locales/bg-BG/opencadstudio.ftl +++ b/locales/bg-BG/opencadstudio.ftl @@ -4006,7 +4006,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/cs-CZ/opencadstudio.ftl b/locales/cs-CZ/opencadstudio.ftl index 9549ccac5..ecef5c891 100644 --- a/locales/cs-CZ/opencadstudio.ftl +++ b/locales/cs-CZ/opencadstudio.ftl @@ -4004,7 +4004,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/de-DE/opencadstudio.ftl b/locales/de-DE/opencadstudio.ftl index 423fb8678..9f6184f50 100644 --- a/locales/de-DE/opencadstudio.ftl +++ b/locales/de-DE/opencadstudio.ftl @@ -4005,7 +4005,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/el-GR/opencadstudio.ftl b/locales/el-GR/opencadstudio.ftl index 087579b77..c4fa2d108 100644 --- a/locales/el-GR/opencadstudio.ftl +++ b/locales/el-GR/opencadstudio.ftl @@ -4007,7 +4007,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/en-US/opencadstudio.ftl b/locales/en-US/opencadstudio.ftl index 7f99698b7..f958e0a44 100644 --- a/locales/en-US/opencadstudio.ftl +++ b/locales/en-US/opencadstudio.ftl @@ -4008,7 +4008,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/es-ES/opencadstudio.ftl b/locales/es-ES/opencadstudio.ftl index 60dffb911..9adc06b83 100644 --- a/locales/es-ES/opencadstudio.ftl +++ b/locales/es-ES/opencadstudio.ftl @@ -4007,7 +4007,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/fi-FI/opencadstudio.ftl b/locales/fi-FI/opencadstudio.ftl index 6279fea91..20dd5dfa0 100644 --- a/locales/fi-FI/opencadstudio.ftl +++ b/locales/fi-FI/opencadstudio.ftl @@ -4006,7 +4006,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/fr-FR/opencadstudio.ftl b/locales/fr-FR/opencadstudio.ftl index 6347339d4..01c1d1bb6 100644 --- a/locales/fr-FR/opencadstudio.ftl +++ b/locales/fr-FR/opencadstudio.ftl @@ -4007,7 +4007,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/hi-IN/opencadstudio.ftl b/locales/hi-IN/opencadstudio.ftl index f1384b42b..ed27d6574 100644 --- a/locales/hi-IN/opencadstudio.ftl +++ b/locales/hi-IN/opencadstudio.ftl @@ -3995,7 +3995,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/hu-HU/opencadstudio.ftl b/locales/hu-HU/opencadstudio.ftl index cc45f9d92..bc78e77d9 100644 --- a/locales/hu-HU/opencadstudio.ftl +++ b/locales/hu-HU/opencadstudio.ftl @@ -4006,7 +4006,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/it-IT/opencadstudio.ftl b/locales/it-IT/opencadstudio.ftl index ebb736379..835f99590 100644 --- a/locales/it-IT/opencadstudio.ftl +++ b/locales/it-IT/opencadstudio.ftl @@ -4006,7 +4006,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/ja-JP/opencadstudio.ftl b/locales/ja-JP/opencadstudio.ftl index dbb5e7649..969801da3 100644 --- a/locales/ja-JP/opencadstudio.ftl +++ b/locales/ja-JP/opencadstudio.ftl @@ -3995,7 +3995,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/ko-KR/opencadstudio.ftl b/locales/ko-KR/opencadstudio.ftl index 7d1e6615b..8cce74f8e 100644 --- a/locales/ko-KR/opencadstudio.ftl +++ b/locales/ko-KR/opencadstudio.ftl @@ -4006,7 +4006,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/nl-NL/opencadstudio.ftl b/locales/nl-NL/opencadstudio.ftl index 51e16f52e..a1f00441a 100644 --- a/locales/nl-NL/opencadstudio.ftl +++ b/locales/nl-NL/opencadstudio.ftl @@ -4005,7 +4005,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/pl-PL/opencadstudio.ftl b/locales/pl-PL/opencadstudio.ftl index d990b8e06..f48cd9afb 100644 --- a/locales/pl-PL/opencadstudio.ftl +++ b/locales/pl-PL/opencadstudio.ftl @@ -4006,7 +4006,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/pt-BR/opencadstudio.ftl b/locales/pt-BR/opencadstudio.ftl index 36f801710..ca46a1361 100644 --- a/locales/pt-BR/opencadstudio.ftl +++ b/locales/pt-BR/opencadstudio.ftl @@ -4007,7 +4007,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/ru-RU/opencadstudio.ftl b/locales/ru-RU/opencadstudio.ftl index bc0715a63..dc296c1f3 100644 --- a/locales/ru-RU/opencadstudio.ftl +++ b/locales/ru-RU/opencadstudio.ftl @@ -4008,7 +4008,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/zh-CN/opencadstudio.ftl b/locales/zh-CN/opencadstudio.ftl index 9b004a4b0..a11b026f3 100644 --- a/locales/zh-CN/opencadstudio.ftl +++ b/locales/zh-CN/opencadstudio.ftl @@ -3990,7 +3990,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/locales/zh-TW/opencadstudio.ftl b/locales/zh-TW/opencadstudio.ftl index b263be935..ed9378cd3 100644 --- a/locales/zh-TW/opencadstudio.ftl +++ b/locales/zh-TW/opencadstudio.ftl @@ -4002,7 +4002,7 @@ insert = .pcs-max-points = Maximum points to process .pcs-faster = Faster .pcs-accurate = More accurate - .pcs-time = Estimated time: __ocs_fmt_0__ min + .pcs-time = Estimated time: __ocs_fmt_0__ minutes .pcs-output = Output geometry .pcs-polylines = 2D Polylines .pcs-width = Polyline width diff --git a/src/locale_catalog.rs b/src/locale_catalog.rs index 8a1e880cc..2c8c5156d 100644 --- a/src/locale_catalog.rs +++ b/src/locale_catalog.rs @@ -150,7 +150,7 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static "Maximum points to process" => Some(("insert", "pcs-max-points")), "Faster" => Some(("insert", "pcs-faster")), "More accurate" => Some(("insert", "pcs-accurate")), - "Estimated time: {count} min" => Some(("insert", "pcs-time")), + "Estimated time: {count} minutes" => Some(("insert", "pcs-time")), "Output geometry" => Some(("insert", "pcs-output")), "2D Polylines" => Some(("insert", "pcs-polylines")), "Polyline width" => Some(("insert", "pcs-width")), diff --git a/src/modules/insert/pc_extract.rs b/src/modules/insert/pc_extract.rs index a355f3766..807c39b36 100644 --- a/src/modules/insert/pc_extract.rs +++ b/src/modules/insert/pc_extract.rs @@ -15,9 +15,12 @@ // [Accept/Settings/Undo] : // (-PCEXTRACTSECTION creates them without asking.) // -// A plane is found from the cloud points under the cursor: the front-most -// point in the pick aperture, a plane fitted to the points around it, then -// grown over the points on that plane connected to it. +// Planes, cylinders and section lines come from structured (segmented) +// scans only; on an unstructured scan a plane or cylinder pick asks again +// and a section extracts nothing, as the reference does. On a +// structured scan a plane is found from the cloud points under the cursor: +// the front-most point in the pick aperture, a plane fitted to the points +// around it, then grown over the points on that plane connected to it. use std::sync::{Arc, Mutex}; @@ -53,6 +56,13 @@ impl Clouds { }) } + /// Whether the clouds carry segments (structured scans) to extract from. + // ponytail: scan segmentation is not decoded, so every scan counts as + // unstructured; read the scan's segmentation to extract from structured ones. + fn segmented(&self) -> bool { + false + } + fn of(&self, handle: Handle) -> Option { let found: Vec<_> = self.0.iter().filter(|(h, _)| *h == handle).cloned().collect(); (!found.is_empty()).then_some(Clouds(found)) @@ -406,7 +416,10 @@ impl CadCommand for PlanesCommand { let Some(context) = self.context else { return CmdResult::NeedPoint; }; - // Off the cloud or not on a plane: the prompt again. + // Off the cloud, not on a plane or an unstructured scan: the prompt again. + if !self.clouds.segmented() { + return CmdResult::NeedPoint; + } let Some(plane) = surface_hit(&self.clouds, &context, pt) .and_then(|(hit, pixel)| detect_plane(&self.clouds, hit, pixel)) else { @@ -470,6 +483,9 @@ impl CadCommand for CenterlineCommand { let Some(context) = self.context else { return CmdResult::NeedPoint; }; + if !self.clouds.segmented() { + return CmdResult::NeedPoint; + } match surface_hit(&self.clouds, &context, pt).and_then(|(hit, pixel)| detect_cylinder(&self.clouds, hit, pixel)) { Some((start, end)) => CmdResult::CommitAndExit(EntityType::Line(Line::from_points(vector(start), vector(end)))), None => CmdResult::NeedPoint, @@ -746,6 +762,10 @@ impl SectionCommand { let (Some(cloud), Some(section)) = (&self.cloud, self.section) else { return Ok(Vec::new()); }; + // An unstructured scan gives no section lines (nothing, silently). + if !cloud.segmented() { + return Ok(Vec::new()); + } let s = settings(); let n = section.viewing; let kept: Vec = cloud diff --git a/src/ui/window/pdf_dialogs.rs b/src/ui/window/pdf_dialogs.rs index b860bb94e..a59d918b1 100644 --- a/src/ui/window/pdf_dialogs.rs +++ b/src/ui/window/pdf_dialogs.rs @@ -1592,7 +1592,7 @@ pub fn view_pc_section<'a>(state: &'a PcSectionState, sizing: crate::ui::modal:: Space::new().width(Fill), text(t!("More accurate")).size(10).style(muted_style), Space::new().width(Fill), - text(crate::tf!("Estimated time: {count} min", count = minutes)).size(10).style(muted_style), + text(crate::tf!("Estimated time: {count} minutes", count = minutes)).size(10).style(muted_style), ], ] .spacing(6),