From f51c7b02f28f8bcea6663bd6a2762e9877c30dfc Mon Sep 17 00:00:00 2001 From: Adam Chalmers Date: Wed, 12 Aug 2026 13:07:17 -0500 Subject: [PATCH 1/2] WIP --- modeling-cmds/openapi/api.json | 28 ++++++++++++++++++++++++++++ modeling-cmds/src/format/step.rs | 26 ++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/modeling-cmds/openapi/api.json b/modeling-cmds/openapi/api.json index 7fba1ff8..34cfe9ac 100644 --- a/modeling-cmds/openapi/api.json +++ b/modeling-cmds/openapi/api.json @@ -2416,6 +2416,15 @@ "default": false, "type": "boolean" }, + "target_representation": { + "description": "What representation should be used for this file after it's imported?", + "default": "mesh", + "allOf": [ + { + "$ref": "#/components/schemas/StepImportTargetRepresentation" + } + ] + }, "type": { "type": "string", "enum": [ @@ -9457,6 +9466,25 @@ "path_id" ] }, + "StepImportTargetRepresentation": { + "description": "After importing, how should this model's data be represented?", + "oneOf": [ + { + "description": "Mesh of 2D geometry", + "type": "string", + "enum": [ + "mesh" + ] + }, + { + "description": "Boundary representation", + "type": "string", + "enum": [ + "brep" + ] + } + ] + }, "StepPresentation": { "description": "Describes the presentation style of the EXPRESS exchange format.", "oneOf": [ diff --git a/modeling-cmds/src/format/step.rs b/modeling-cmds/src/format/step.rs index 9f53cee1..b8a54f62 100644 --- a/modeling-cmds/src/format/step.rs +++ b/modeling-cmds/src/format/step.rs @@ -5,6 +5,27 @@ use serde::{Deserialize, Serialize}; use crate::coord; +/// After importing, how should this model's data be represented? +#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema)] +#[serde(rename = "StepImportTargetRepresentation", rename_all = "snake_case")] +#[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_enum, + pyo3::pyclass(name = "StepImportTargetRepresentation", from_py_object) +)] +#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)] +pub enum TargetRepresentation { + /// Mesh of 2D geometry + Mesh, + /// Boundary representation + Brep, +} + +const DEFAULT_REPR: TargetRepresentation = TargetRepresentation::Mesh; + /// Import models in STEP format. pub mod import { use super::*; @@ -35,6 +56,10 @@ pub mod import { /// Defaults to `false` but is implicitly `true` when importing into the engine. #[builder(default)] pub split_closed_faces: bool, + + /// What representation should be used for this file after it's imported? + #[builder(default = DEFAULT_REPR)] + pub target_representation: TargetRepresentation, } #[cfg(feature = "python")] @@ -51,6 +76,7 @@ pub mod import { impl Default for Options { fn default() -> Self { Self { + target_representation: DEFAULT_REPR, coords: *coord::KITTYCAD, split_closed_faces: false, } From 79dfbcb5da0ad9cd1072dd6a61965affa7c3c155 Mon Sep 17 00:00:00 2001 From: Adam Chalmers Date: Wed, 12 Aug 2026 13:21:14 -0500 Subject: [PATCH 2/2] Change default to brep --- modeling-cmds/openapi/api.json | 2 +- modeling-cmds/src/format/step.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modeling-cmds/openapi/api.json b/modeling-cmds/openapi/api.json index 34cfe9ac..7d86cfbc 100644 --- a/modeling-cmds/openapi/api.json +++ b/modeling-cmds/openapi/api.json @@ -2418,7 +2418,7 @@ }, "target_representation": { "description": "What representation should be used for this file after it's imported?", - "default": "mesh", + "default": "brep", "allOf": [ { "$ref": "#/components/schemas/StepImportTargetRepresentation" diff --git a/modeling-cmds/src/format/step.rs b/modeling-cmds/src/format/step.rs index b8a54f62..c0804c14 100644 --- a/modeling-cmds/src/format/step.rs +++ b/modeling-cmds/src/format/step.rs @@ -24,7 +24,7 @@ pub enum TargetRepresentation { Brep, } -const DEFAULT_REPR: TargetRepresentation = TargetRepresentation::Mesh; +const DEFAULT_REPR: TargetRepresentation = TargetRepresentation::Brep; /// Import models in STEP format. pub mod import {