Unstitch and Reverse Normal (#856)

Unstitch takes a body's faces out as surface bodies; Reverse Normal turns a surface body's faces over. Both are saved in format 18. Closes #766.
This commit is contained in:
Irakli Kourtis authored and GitHub committed 2026-10-13 16:45:31 -04:00
1 parent b702f0efde
commit 753b0a2eab
16 files changed
+322 -19

No files matched your search

+7 -2
View File
@@ -104,13 +104,17 @@
//! Construction Geometries); a sketch that shows its construction geometry saves as before.
//! A `SurfaceExtrude` feature (Surface Extrude: `sketch`, optional `profiles`, `curves` and
//! `extent`, walls only) is first saved in 17; 0.8.0 would refuse the unknown feature.
//! - 18: surface features 0.9.0 doesn't know: `Unstitch` (a body's faces taken out as surface
//! bodies) and `ReverseNormal` (a surface body's faces turned over), each a `body` and
//! optional `faces` points. Version 17 designs need no transformation; the version stamp makes
//! 0.9.0 (which reads up to 17) ask for an update instead of meeting a feature it can't read.
use serde_json::Value;
use crate::{DocError, Document, Result};
/// The format this build writes.
pub const FORMAT: u32 = 17;
pub const FORMAT: u32 = 18;
pub fn format_string(n: u32) -> String {
format!("solidcraft/{n}")
@@ -127,7 +131,7 @@ pub fn version_of(s: &str) -> Option<u32> {
/// JSON-level upgrades: entry `i` turns format `i + 1` into `i + 2`.
type JsonStep = fn(&mut Value) -> Result<()>;
const JSON_STEPS: [JsonStep; 16] = [
const JSON_STEPS: [JsonStep; 17] = [
|_| Ok(()),
v2_to_v3,
v3_to_v4,
@@ -144,6 +148,7 @@ const JSON_STEPS: [JsonStep; 16] = [
|_| Ok(()),
|_| Ok(()),
|_| Ok(()),
|_| Ok(()),
];
/// Stored face and edge names were worked out from geometry before format 14; they get the