Skip to content

Commit

Permalink
Remove STL import selection and storage options (#8)
Browse files Browse the repository at this point in the history
* Fix STL import options
* Move format.rs to format/mod.rs
  • Loading branch information
alteous authored Dec 8, 2023
1 parent 611473f commit 0244732
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 35 deletions.
File renamed without changes.
46 changes: 11 additions & 35 deletions modeling-cmds/src/format/stl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 0244732

Please sign in to comment.