kittycad_modeling_cmds/format/
obj.rs1use parse_display::{Display, FromStr};
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4
5use crate::{coord, units::UnitLength};
6
7pub mod import {
9 use super::*;
10
11 #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)]
13 #[display("coords: {coords}, units: {units}")]
14 #[serde(rename = "ObjImportOptions")]
15 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
16 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
17 #[cfg_attr(
18 feature = "python",
19 pyo3_stub_gen::derive::gen_stub_pyclass,
20 pyo3::pyclass(name = "ObjImportOptions")
21 )]
22 pub struct Options {
23 pub coords: coord::System,
29
30 pub units: UnitLength,
37 }
38
39 #[cfg(feature = "python")]
40 #[pyo3_stub_gen::derive::gen_stub_pymethods]
41 #[pyo3::pymethods]
42 impl Options {
43 #[new]
44 pub fn new() -> Self {
46 Default::default()
47 }
48 }
49
50 impl Default for Options {
51 fn default() -> Self {
52 Self {
53 coords: *coord::KITTYCAD,
54 units: UnitLength::Millimeters,
55 }
56 }
57 }
58}
59
60pub mod export {
62 use super::*;
63
64 #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)]
66 #[display("coords: {coords}, units: {units}")]
67 #[serde(rename = "ObjExportOptions")]
68 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
69 #[cfg_attr(
70 feature = "python",
71 pyo3_stub_gen::derive::gen_stub_pyclass,
72 pyo3::pyclass(name = "ObjExportOptions")
73 )]
74 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
75 pub struct Options {
76 pub coords: coord::System,
82
83 pub units: UnitLength,
87 }
88
89 #[cfg(feature = "python")]
90 #[pyo3_stub_gen::derive::gen_stub_pymethods]
91 #[pyo3::pymethods]
92 impl Options {
93 #[new]
94 pub fn new() -> Self {
96 Default::default()
97 }
98 }
99
100 impl Default for Options {
101 fn default() -> Self {
102 Self {
103 coords: *coord::KITTYCAD,
104 units: UnitLength::Millimeters,
105 }
106 }
107 }
108}