kittycad_modeling_cmds/format/
step.rs1use parse_display::{Display, FromStr};
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4
5use crate::coord;
6
7pub mod import {
9 use super::*;
10
11 #[derive(Clone, Debug, Default, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)]
13 #[display("split_closed_faces: {split_closed_faces}")]
14 #[serde(default, rename = "StepImportOptions")]
15 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
16 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
17 pub struct Options {
18 pub split_closed_faces: bool,
22 }
23}
24
25pub mod export {
27 use super::*;
28
29 #[derive(Clone, Debug, Deserialize, Eq, Hash, JsonSchema, PartialEq, Serialize)]
31 #[serde(rename = "StepExportOptions")]
32 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
33 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
34 pub struct Options {
35 pub coords: coord::System,
41
42 pub created: Option<chrono::DateTime<chrono::Utc>>,
44 }
45
46 impl Default for Options {
47 fn default() -> Self {
48 Self {
49 coords: *coord::KITTYCAD,
50 created: None,
51 }
52 }
53 }
54
55 impl std::fmt::Display for Options {
56 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
57 write!(f, "coords: {}", self.coords)
58 }
59 }
60
61 impl std::str::FromStr for Options {
62 type Err = <coord::System as std::str::FromStr>::Err;
63 fn from_str(s: &str) -> Result<Self, Self::Err> {
64 Ok(Self {
65 coords: <coord::System as std::str::FromStr>::from_str(s)?,
66 created: None,
67 })
68 }
69 }
70}