Extrude: a symmetric distance is the total thickness (#1260)

A symmetric solid extrude of 10 mm is now 10 mm thick, 5 mm each side of the sketch plane, and switching from One Side to Symmetric keeps the thickness entered. Under format 21 the extent records its convention; designs saved without it keep the per-side reading, so their geometry and parameters don't change. Fixes #1236.

Co-authored-by: Karl-VonRichter <Karl-VonRichter@users.noreply.github.com>
This commit is contained in:
Karl Von RichterandKarl-VonRichter authored and GitHub committed 2026-10-15 01:19:55 -04:00
1 parent faeeff1c64
commit 1ec33fcdc7
19 files changed
+323 -18

No files matched your search

+22 -1
View File
@@ -134,7 +134,7 @@ pub enum Direction {
#[default]
Positive,
Negative,
/// Both sides; `distance` per side.
/// Both sides; the extent convention determines whether `distance` is total or per side.
Symmetric,
}
@@ -186,12 +186,33 @@ pub enum RevolveConvention {
SketchNormal,
}
/// Symmetric distance semantics. Missing markers preserve existing designs' thickness.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ExtrudeConvention {
#[default]
LegacyPerSide,
TotalDistance,
}
impl ExtrudeConvention {
/// Distance from the mid-plane to either cap for a distance-limited extent.
pub fn symmetric_half_distance(self, distance: f64) -> f64 {
match self {
Self::LegacyPerSide => distance,
Self::TotalDistance => distance * 0.5,
}
}
}
/// Extent of an extrude.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, solidcraft_derive::Walk)]
pub struct Extent {
#[walk(length = "Distance")]
pub distance: String,
#[serde(default)]
pub convention: ExtrudeConvention,
#[serde(default)]
pub direction: Direction,
/// Optional second side distance (two-sided extrude), along the negative normal.
#[serde(default, skip_serializing_if = "Option::is_none")]