Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove STL import selection and storage options #8

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was millimetres previously.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to keep it as metres for now so I'll update the format tests accordingly.

}
}
}

/// 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