Skip to content
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
94 changes: 92 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions modeling-cmds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ convert_client_crate = ["dep:kittycad"]
websocket = ["dep:serde_json"]
webrtc = ["dep:webrtc"]
unstable_exhaustive = []
python = ["dep:pyo3"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand All @@ -40,6 +41,7 @@ kittycad-unit-conversion-derive = "0.1.0"
measurements = "0.11.0"
parse-display = "0.9.1"
parse-display-derive = "0.9.0"
pyo3 = { version = "0.25.1", optional = true }
schemars = { version = "0.8.22", features = [
"bigdecimal04",
"chrono",
Expand Down
11 changes: 11 additions & 0 deletions modeling-cmds/src/format/dxf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,19 @@ pub mod export {
#[serde(rename = "DxfExportOptions")]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(feature = "python", pyo3::pyclass)]
pub struct Options {
/// Export storage.
pub storage: Storage,
}

#[cfg(feature = "python")]
#[pyo3::pymethods]
impl Options {
#[new]
/// Set the options to their defaults.
pub fn new() -> Self {
Default::default()
}
}
}
22 changes: 22 additions & 0 deletions modeling-cmds/src/format/fbx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,18 @@ pub mod import {
#[serde(rename = "FbxImportOptions")]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(feature = "python", pyo3::pyclass)]
pub struct Options {}

#[cfg(feature = "python")]
#[pyo3::pymethods]
impl Options {
#[new]
/// Set the options to their defaults.
pub fn new() -> Self {
Default::default()
}
}
}

/// Export models in FBX format.
Expand All @@ -22,6 +33,7 @@ pub mod export {
#[derive(Clone, Debug, Default, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema)]
#[serde(rename = "FbxExportOptions")]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "python", pyo3::pyclass)]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
pub struct Options {
/// Specifies which kind of FBX will be exported.
Expand All @@ -31,6 +43,16 @@ pub mod export {
pub created: Option<chrono::DateTime<chrono::Utc>>,
}

#[cfg(feature = "python")]
#[pyo3::pymethods]
impl Options {
#[new]
/// Set the options to their defaults.
pub fn new() -> Self {
Default::default()
}
}

impl std::fmt::Display for Options {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "storage: {}", self.storage)
Expand Down
22 changes: 22 additions & 0 deletions modeling-cmds/src/format/gltf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@ pub mod import {
#[serde(rename = "GltfImportOptions")]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(feature = "python", pyo3::pyclass)]
pub struct Options {}

#[cfg(feature = "python")]
#[pyo3::pymethods]
impl Options {
#[new]
/// Set the options to their defaults.
pub fn new() -> Self {
Default::default()
}
}
}

/// Export models in KittyCAD's GLTF format.
Expand All @@ -23,6 +34,7 @@ pub mod export {
#[display("storage: {storage}, presentation: {presentation}")]
#[serde(rename = "GltfExportOptions")]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "python", pyo3::pyclass)]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
pub struct Options {
/// Specifies which kind of glTF 2.0 will be exported.
Expand All @@ -31,6 +43,16 @@ pub mod export {
pub presentation: Presentation,
}

#[cfg(feature = "python")]
#[pyo3::pymethods]
impl Options {
#[new]
/// Set the options to their defaults.
pub fn new() -> Self {
Default::default()
}
}

/// Describes the storage format of a glTF 2.0 scene.
#[derive(
Default, Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr,
Expand Down
1 change: 1 addition & 0 deletions modeling-cmds/src/format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ pub type InputFormat = InputFormat3d;
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)]
#[serde(tag = "type", rename_all = "snake_case")]
#[display(style = "snake_case")]
#[cfg_attr(feature = "python", pyo3::pyclass)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
pub enum InputFormat3d {
Expand Down
22 changes: 22 additions & 0 deletions modeling-cmds/src/format/obj.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub mod import {
#[serde(rename = "ObjImportOptions")]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(feature = "python", pyo3::pyclass)]
pub struct Options {
/// Co-ordinate system of input data.
///
Expand All @@ -31,6 +32,16 @@ pub mod import {
pub units: UnitLength,
}

#[cfg(feature = "python")]
#[pyo3::pymethods]
impl Options {
#[new]
/// Set the options to their defaults.
pub fn new() -> Self {
Default::default()
}
}

impl Default for Options {
fn default() -> Self {
Self {
Expand All @@ -50,6 +61,7 @@ pub mod export {
#[display("coords: {coords}, units: {units}")]
#[serde(rename = "ObjExportOptions")]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "python", pyo3::pyclass)]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
pub struct Options {
/// Co-ordinate system of output data.
Expand All @@ -65,6 +77,16 @@ pub mod export {
pub units: UnitLength,
}

#[cfg(feature = "python")]
#[pyo3::pymethods]
impl Options {
#[new]
/// Set the options to their defaults.
pub fn new() -> Self {
Default::default()
}
}

impl Default for Options {
fn default() -> Self {
Self {
Expand Down
22 changes: 22 additions & 0 deletions modeling-cmds/src/format/ply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub mod import {
#[serde(rename = "PlyImportOptions")]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(feature = "python", pyo3::pyclass)]
pub struct Options {
/// Co-ordinate system of input data.
///
Expand All @@ -31,6 +32,16 @@ pub mod import {
pub units: UnitLength,
}

#[cfg(feature = "python")]
#[pyo3::pymethods]
impl Options {
#[new]
/// Set the options to their defaults.
pub fn new() -> Self {
Default::default()
}
}

impl Default for Options {
fn default() -> Self {
Self {
Expand All @@ -51,6 +62,7 @@ pub mod export {
#[display("coords: {coords}, selection: {selection}, storage: {storage}, units: {units}")]
#[serde(rename = "PlyExportOptions")]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "python", pyo3::pyclass)]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
pub struct Options {
/// Co-ordinate system of output data.
Expand All @@ -72,6 +84,16 @@ pub mod export {
pub units: UnitLength,
}

#[cfg(feature = "python")]
#[pyo3::pymethods]
impl Options {
#[new]
/// Set the options to their defaults.
pub fn new() -> Self {
Default::default()
}
}

impl Default for Options {
fn default() -> Self {
Self {
Expand Down
Loading