Complete parametric drawing interoperability

This commit is contained in:
Hakan Seven committed 2026-09-14 23:51:37 +03:00
1 parent 7aff9fa046
commit 753df67ee4
13 files changed
+1602 -138

No files matched your search

+16
View File
@@ -27,6 +27,8 @@ pub struct SketchRef {
pub marker: Option<i32>,
}
const POLYLINE_SEGMENT_MARKER_BASE: i32 = -1_000_000;
impl SketchRef {
pub fn whole(entity: Handle) -> Self {
Self {
@@ -51,6 +53,20 @@ impl SketchRef {
marker: Some(-3),
}
}
/// Select one straight segment of a polyline.
pub fn segment(entity: Handle, index: usize) -> Self {
Self {
entity,
marker: Some(POLYLINE_SEGMENT_MARKER_BASE - index as i32),
}
}
pub fn segment_index(self) -> Option<usize> {
let marker = self.marker?;
(marker <= POLYLINE_SEGMENT_MARKER_BASE)
.then(|| (POLYLINE_SEGMENT_MARKER_BASE - marker) as usize)
}
}
/// The friendly, user-facing constraint types — the "what button did they