Skip to content
Open
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
1 change: 0 additions & 1 deletion Cargo.lock

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

2 changes: 0 additions & 2 deletions modeling-cmds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ tabled = ["dep:tabled"]
ts-rs = ["dep:ts-rs"]
slog = ["dep:slog"]
cxx = ["dep:cxx"]
convert_client_crate = ["dep:kittycad"]
websocket = ["dep:serde_json"]
webrtc = ["dep:webrtc"]
unstable_exhaustive = []
Expand All @@ -36,7 +35,6 @@ enum-iterator = "2.3.0"
enum-iterator-derive = "1.2.1"
euler = "0.4.1"
http = "1.4.0"
kittycad = { workspace = true, optional = true }
kittycad-modeling-cmds-macros = { workspace = true }
kittycad-unit-conversion-derive = "0.1.0"
measurements = "0.11.0"
Expand Down
20 changes: 20 additions & 0 deletions modeling-cmds/openapi/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -1545,6 +1545,26 @@
"InputFormat3d": {
"description": "Input format specifier.",
"oneOf": [
{
"description": "PTC Creo part (PRT) format.",
"type": "object",
"properties": {
"split_closed_faces": {
"description": "Splits all closed faces into two open faces.\n\nDefaults to `false` but is implicitly `true` when importing into the engine.",
"default": false,
"type": "boolean"
},
"type": {
"type": "string",
"enum": [
"creo"
]
}
},
"required": [
"type"
]
},
{
"description": "Autodesk Filmbox (FBX) format.",
"type": "object",
Expand Down
264 changes: 0 additions & 264 deletions modeling-cmds/src/convert_client_crate.rs

This file was deleted.

36 changes: 36 additions & 0 deletions modeling-cmds/src/format/creo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/// Import functionality.
pub mod import {
use bon::Builder;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

/// Options for importing PTC Creo parts.
#[derive(Clone, Debug, Default, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
#[serde(default, rename = "CreoImportOptions")]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(
feature = "python",
pyo3_stub_gen::derive::gen_stub_pyclass,
pyo3::pyclass(name = "CreoImportOptions")
)]
pub struct Options {
/// Splits all closed faces into two open faces.
///
/// Defaults to `false` but is implicitly `true` when importing into the engine.
#[builder(default)]
pub split_closed_faces: bool,
}

#[cfg(feature = "python")]
#[pyo3_stub_gen::derive::gen_stub_pymethods]
#[pyo3::pymethods]
impl Options {
#[new]
/// Set the options to their defaults.
pub fn new() -> Self {
Default::default()
}
}
}
7 changes: 7 additions & 0 deletions modeling-cmds/src/format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use serde::{Deserialize, Serialize};

use crate::shared::{FileExportFormat, FileExportFormat2d, FileImportFormat};

/// PTC Creo part (PRT) format.
pub mod creo;
/// AutoCAD drawing interchange format.
pub mod dxf;
/// Autodesk Filmbox (FBX) format.
Expand Down Expand Up @@ -83,6 +85,8 @@ pub type InputFormat = InputFormat3d;
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub enum InputFormat3d {
/// PTC Creo part (PRT) format.
Creo(creo::import::Options),
/// Autodesk Filmbox (FBX) format.
Fbx(fbx::import::Options),
/// Binary glTF 2.0.
Expand All @@ -105,6 +109,7 @@ impl InputFormat3d {
/// Get the name of this format.
pub fn name(&self) -> &'static str {
match self {
InputFormat3d::Creo(_) => "creo",
InputFormat3d::Fbx(_) => "fbx",
InputFormat3d::Gltf(_) => "gltf",
InputFormat3d::Obj(_) => "obj",
Expand Down Expand Up @@ -242,6 +247,7 @@ impl From<FileExportFormat> for OutputFormat3d {
impl From<InputFormat3d> for FileImportFormat {
fn from(input_format: InputFormat3d) -> Self {
match input_format {
InputFormat3d::Creo(_) => Self::Creo,
InputFormat3d::Fbx(_) => Self::Fbx,
InputFormat3d::Gltf(_) => Self::Gltf,
InputFormat3d::Obj(_) => Self::Obj,
Expand All @@ -256,6 +262,7 @@ impl From<InputFormat3d> for FileImportFormat {
impl From<FileImportFormat> for InputFormat3d {
fn from(import_format: FileImportFormat) -> Self {
match import_format {
FileImportFormat::Creo => InputFormat3d::Creo(Default::default()),
FileImportFormat::Fbx => InputFormat3d::Fbx(Default::default()),
FileImportFormat::Gltf => InputFormat3d::Gltf(Default::default()),
FileImportFormat::Obj => InputFormat3d::Obj(Default::default()),
Expand Down
Loading
Loading