kittycad_modeling_cmds/format/
dxf.rs

1/// Export sketches in DXF format.
2pub mod export {
3    use parse_display::{Display, FromStr};
4    use schemars::JsonSchema;
5    use serde::{Deserialize, Serialize};
6
7    /// Export storage.
8    #[derive(
9        Clone, Copy, Debug, Default, Deserialize, Display, Eq, FromStr, Hash, JsonSchema, PartialEq, Serialize,
10    )]
11    #[display(style = "snake_case")]
12    #[serde(rename = "DxfStorage", rename_all = "snake_case")]
13    #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
14    #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
15    #[cfg_attr(
16        feature = "python",
17        pyo3_stub_gen::derive::gen_stub_pyclass_enum,
18        pyo3::pyclass(name = "DxfStorage")
19    )]
20    pub enum Storage {
21        /// Plaintext encoding.
22        ///
23        /// This is the default setting.
24        #[default]
25        Ascii,
26
27        /// Binary encoding.
28        Binary,
29    }
30
31    /// Options for exporting DXF format.
32    #[derive(Clone, Debug, Default, Deserialize, Display, Eq, FromStr, Hash, JsonSchema, PartialEq, Serialize)]
33    #[display("storage: {storage}")]
34    #[serde(rename = "DxfExportOptions")]
35    #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
36    #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
37    #[cfg_attr(
38        feature = "python",
39        pyo3_stub_gen::derive::gen_stub_pyclass,
40        pyo3::pyclass(name = "DxfExportOptions")
41    )]
42    pub struct Options {
43        /// Export storage.
44        pub storage: Storage,
45    }
46
47    #[cfg(feature = "python")]
48    #[pyo3_stub_gen::derive::gen_stub_pymethods]
49    #[pyo3::pymethods]
50    impl Options {
51        #[new]
52        /// Set the options to their defaults.
53        pub fn new() -> Self {
54            Default::default()
55        }
56    }
57}