Files
solidcraft/crates/engine/src/schema/section.rs
T
Nathan Dane 5bd5be9543 Viewport status item: standard details card (#8613) (#8614)
* Keep viewport summary menus below modal owners

* Build viewport status details from shared blocks

* Keep details focus checks outside context data locks

* Preserve native editor Escape ownership in details cards

* Initialize strict contract test sessions directly

* Translate viewport status detail cards

* Use inferred slider options and test legacy Section editing
2026-10-31 01:27:12 +00:00

44 lines
1.5 KiB
Rust

//! Section clipping contract. Explicit planes use numerical millimetre coordinates.
use super::{AxisDir, LengthExpr, Point3, present};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, JsonSchema)]
#[serde(untagged)]
pub enum Plane {
Name(String),
Id(u64),
Explicit { origin: Option<Point3>, normal: AxisDir },
}
#[derive(Debug, Deserialize, JsonSchema)]
#[schemars(deny_unknown_fields)]
pub struct SectionParams {
/// Required unless clearing. XY/XZ/YZ, construction name/id, or {origin?,normal}.
#[serde(default, deserialize_with = "present", skip_serializing_if = "Option::is_none")]
#[schemars(with = "Plane")]
pub plane: Option<Plane>,
/// Signed distance along the original plane normal, in design units or an expression.
pub offset: Option<LengthExpr>,
/// World coordinate on a named plane's normal axis; mutually exclusive with offset.
pub at: Option<LengthExpr>,
pub flip: Option<bool>,
pub hatch: Option<bool>,
pub clear: Option<bool>,
}
#[derive(Serialize, JsonSchema)]
pub struct Section {
pub origin: [f64; 3],
pub normal: [f64; 3],
pub hatch: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub axis: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub at: Option<f64>,
}
#[derive(Serialize, JsonSchema)]
pub struct SectionResult {
pub section: Option<Section>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub param_warnings: Vec<String>,
}