diff --git a/modeling-cmds/src/format.rs b/modeling-cmds/src/format/mod.rs similarity index 100% rename from modeling-cmds/src/format.rs rename to modeling-cmds/src/format/mod.rs diff --git a/modeling-cmds/src/format/stl.rs b/modeling-cmds/src/format/stl.rs index 80d7a408..69a4baa5 100644 --- a/modeling-cmds/src/format/stl.rs +++ b/modeling-cmds/src/format/stl.rs @@ -8,57 +8,33 @@ use crate::{coord, format::Selection, units::UnitLength}; pub mod import { use super::*; - /// Options for exporting STL. - #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)] - #[display("coords: {coords}, selection: {selection}, storage: {storage}, units: {units}")] - #[serde(rename = "StlExportOptions")] + /// Options for importing STL. + #[derive( + Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr, + )] + #[display("coords: {coords}, units: {units}")] + #[serde(rename = "StlImportOptions")] pub struct Options { - /// Co-ordinate system of output data. + /// Co-ordinate system of input data. /// /// Defaults to the [KittyCAD co-ordinate system]. /// /// [KittyCAD co-ordinate system]: ../coord/constant.KITTYCAD.html pub coords: coord::System, - - /// Export selection. - pub selection: Selection, - - /// Export storage. - pub storage: Storage, - - /// Export length unit. - /// - /// Defaults to meters. - pub units: UnitLength, + /// The units of the input data. + /// This is very important for correct scaling and when calculating physics properties like + /// mass, etc. + pub units: crate::units::UnitLength, } impl Default for Options { fn default() -> Self { Self { coords: *coord::KITTYCAD, - selection: Default::default(), - storage: Default::default(), units: UnitLength::Meters, } } } - - /// Export storage. - #[derive( - Clone, Copy, Debug, Default, Deserialize, Display, Eq, FromStr, Hash, JsonSchema, PartialEq, Serialize, - )] - #[display(style = "snake_case")] - #[serde(rename = "StlStorage", rename_all = "snake_case")] - pub enum Storage { - /// Plaintext encoding. - Ascii, - - /// Binary STL encoding. - /// - /// This is the default setting. - #[default] - Binary, - } } /// Export models in STL format.