Sketch: infinite construction lines (#1359) (#1547)

Thanks @DuBearte.
This commit is contained in:
DuBearte authored and GitHub committed 2026-10-15 22:54:16 -04:00
1 parent bd17eeef0c
commit 987f0be21e
27 files changed
+435 -28

No files matched your search

+1
View File
@@ -655,6 +655,7 @@ impl Sketch {
link: Some(id.to_string()),
centerline: false,
fixed: false,
infinite: false,
});
}
for li in &lay.lone {
+9 -1
View File
@@ -169,6 +169,11 @@ pub struct Curve {
/// Fixed (locked): its points and radius are constants for the solver.
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub fixed: bool,
/// Infinite line type (#1359), for lines only: construction geometry drawn across the whole
/// view, through its two points, which fix where it lies and which way it runs. Never part of
/// a profile (it is construction too).
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub infinite: bool,
}
/// Geometric constraints and dimensions. Indices refer to `Sketch::points` (`p`, `q`) or
@@ -735,6 +740,7 @@ impl Sketch {
link: None,
centerline: false,
fixed: false,
infinite: false,
});
Ok(self.curves.len() - 1)
}
@@ -772,6 +778,7 @@ impl Sketch {
link: None,
centerline: false,
fixed: false,
infinite: false,
});
Ok(self.curves.len() - 1)
}
@@ -806,6 +813,7 @@ impl Sketch {
link: None,
centerline: false,
fixed: false,
infinite: false,
});
Ok(self.curves.len() - 1)
}
@@ -1376,7 +1384,7 @@ impl Sketch {
}
};
let id = self.curve_id(id, prefix)?;
self.curves.push(Curve { id, kind, construction: false, reversed: false, link: None, centerline: false, fixed: false });
self.curves.push(Curve { id, kind, construction: false, reversed: false, link: None, centerline: false, fixed: false, infinite: false });
Ok(self.curves.len() - 1)
}
+11 -1
View File
@@ -27,13 +27,21 @@ pub struct OffsetRoleFlags {
pub centerline: bool,
pub reversed: bool,
pub fixed: bool,
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub infinite: bool,
}
impl OffsetRoleFlags {
fn is_default(&self) -> bool {
*self == Self::default()
}
fn of(curve: &Curve) -> Self {
Self { construction: curve.construction, centerline: curve.centerline, reversed: curve.reversed, fixed: curve.fixed }
Self {
construction: curve.construction,
centerline: curve.centerline,
reversed: curve.reversed,
fixed: curve.fixed,
infinite: curve.infinite,
}
}
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
@@ -614,6 +622,7 @@ impl Sketch {
link: None,
centerline: false,
fixed: false,
infinite: false,
});
outputs.push(output);
}
@@ -767,6 +776,7 @@ impl Sketch {
link: None,
centerline: role.flags.centerline,
fixed: role.flags.fixed,
infinite: role.flags.infinite,
});
}
outputs.push(role.output.clone());
+1 -1
View File
@@ -558,7 +558,7 @@ fn find_profiles_bounded(sk: &Sketch, max_edges: usize) -> Vec<Profile> {
let mut whole_graph_complete = true;
let mut expected = std::collections::HashMap::<usize, Vec<usize>>::new();
for (ci, c) in sk.curves.iter().enumerate() {
if c.construction || c.centerline {
if c.construction || c.centerline || c.infinite {
continue;
}
if matches!(c.kind, CurveKind::Line { .. } | CurveKind::Arc { .. } | CurveKind::Circle { .. }) {