From 02447325449054b732a9aaab50c4f39b46342d10 Mon Sep 17 00:00:00 2001 From: David Harvey-Macaulay Date: Fri, 8 Dec 2023 19:24:04 +0000 Subject: [PATCH] Remove STL import selection and storage options (#8) * Fix STL import options * Move format.rs to format/mod.rs --- .../src/{format.rs => format/mod.rs} | 0 modeling-cmds/src/format/stl.rs | 46 +++++-------------- 2 files changed, 11 insertions(+), 35 deletions(-) rename modeling-cmds/src/{format.rs => format/mod.rs} (100%) 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.