Sweep guide rails and two-rail sweep (#771) (#1806)

Thanks @jyviko.
This commit is contained in:
Irakli Kourtis authored and GitHub committed 2026-10-17 04:07:46 -04:00
1 parent 7ba2d5db47
commit 98ce6a4ee8
22 files changed
+804 -55

No files matched your search

+37
View File
@@ -299,6 +299,31 @@ impl SweepOrientation {
}
}
/// A sweep's guide rail: a chain of curves of a sketch, followed from the end nearest the path's
/// start.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, solidcraft_derive::Walk)]
pub struct SweepRail {
pub sketch: SketchId,
pub curves: Vec<String>,
}
/// How a sweep's guide rails reshape its profile.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum RailFit {
/// Evenly, with the distance across to the rail (between the rails).
#[default]
Scale,
/// Only across to the rail (between the rails).
Stretch,
}
impl RailFit {
pub fn is_scale(&self) -> bool {
*self == RailFit::Scale
}
}
/// Where a thin wall lies against its curves. A closed loop's inside is the area it encloses;
/// an open chain's is the side it bends toward (a straight one's, the left of its first
/// curve as drawn).
@@ -729,6 +754,12 @@ pub enum FeatureKind {
#[serde(default, skip_serializing_if = "Option::is_none")]
#[walk(unitless = "Scale")]
scale: Option<Expr>,
/// Guide rails (one or two) the profile follows, instead of orientation, twist and scale.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
rails: Vec<SweepRail>,
/// How the rails reshape the profile.
#[serde(default, skip_serializing_if = "RailFit::is_scale")]
rail_fit: RailFit,
#[serde(default)]
operation: Operation,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
@@ -1316,6 +1347,12 @@ pub enum FeatureKind {
#[serde(default, skip_serializing_if = "Option::is_none")]
#[walk(unitless = "Scale")]
scale: Option<Expr>,
/// Guide rails (one or two) the curves follow, instead of orientation, twist and scale.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
rails: Vec<SweepRail>,
/// How the rails reshape the curves.
#[serde(default, skip_serializing_if = "RailFit::is_scale")]
rail_fit: RailFit,
},
/// A surface body lofted through sections in order, each one open or closed chain of
/// sketch curves: walls only, no caps.