Skip to content

Commit 4990534

Browse files
committed
Reintroduce STEP coords
1 parent 5de908f commit 4990534

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

modeling-cmds/openapi/api.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,6 +1605,24 @@
16051605
"description": "ISO 10303-21 (STEP) format.",
16061606
"type": "object",
16071607
"properties": {
1608+
"coords": {
1609+
"description": "Co-ordinate system of input data.\n\nDefaults to the [KittyCAD co-ordinate system].\n\n[KittyCAD co-ordinate system]: ../coord/constant.KITTYCAD.html",
1610+
"default": {
1611+
"forward": {
1612+
"axis": "y",
1613+
"direction": "negative"
1614+
},
1615+
"up": {
1616+
"axis": "z",
1617+
"direction": "positive"
1618+
}
1619+
},
1620+
"allOf": [
1621+
{
1622+
"$ref": "#/components/schemas/System"
1623+
}
1624+
]
1625+
},
16081626
"split_closed_faces": {
16091627
"description": "Splits all closed faces into two open faces.\n\nDefaults to `false` but is implicitly `true` when importing into the engine.",
16101628
"default": false,

modeling-cmds/src/convert_client_crate.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ mod format {
144144
InputFormat3d::Sldprt(sldprt::import::Options { split_closed_faces }) => {
145145
kt::InputFormat3D::Sldprt { split_closed_faces }
146146
}
147-
InputFormat3d::Step(step::import::Options { split_closed_faces }) => {
147+
InputFormat3d::Step(step::import::Options { split_closed_faces, .. }) => {
148148
kt::InputFormat3D::Step { split_closed_faces }
149149
}
150150
InputFormat3d::Stl(stl::import::Options { coords, units }) => kt::InputFormat3D::Stl {
@@ -171,9 +171,10 @@ mod format {
171171
kt::InputFormat3D::Sldprt { split_closed_faces } => {
172172
Self::Sldprt(crate::format::sldprt::import::Options { split_closed_faces })
173173
}
174-
kt::InputFormat3D::Step { split_closed_faces } => {
175-
Self::Step(crate::format::step::import::Options { split_closed_faces })
176-
}
174+
kt::InputFormat3D::Step { split_closed_faces } => Self::Step(crate::format::step::import::Options {
175+
split_closed_faces,
176+
..Default::default()
177+
}),
177178
kt::InputFormat3D::Stl { coords, units } => Self::Stl(crate::format::stl::import::Options {
178179
coords: coords.into(),
179180
units: units.into(),

modeling-cmds/src/format/step.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ pub mod import {
99
use super::*;
1010

1111
/// Options for importing STEP format.
12-
#[derive(Clone, Debug, Default, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)]
13-
#[display("split_closed_faces: {split_closed_faces}")]
12+
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr)]
13+
#[display("coords: {coords}, split_closed_faces: {split_closed_faces}")]
1414
#[serde(default, rename = "StepImportOptions")]
1515
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1616
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
@@ -20,6 +20,13 @@ pub mod import {
2020
pyo3::pyclass(name = "StepImportOptions")
2121
)]
2222
pub struct Options {
23+
/// Co-ordinate system of input data.
24+
///
25+
/// Defaults to the [KittyCAD co-ordinate system].
26+
///
27+
/// [KittyCAD co-ordinate system]: ../coord/constant.KITTYCAD.html
28+
pub coords: coord::System,
29+
2330
/// Splits all closed faces into two open faces.
2431
///
2532
/// Defaults to `false` but is implicitly `true` when importing into the engine.
@@ -36,6 +43,15 @@ pub mod import {
3643
Default::default()
3744
}
3845
}
46+
47+
impl Default for Options {
48+
fn default() -> Self {
49+
Self {
50+
coords: *coord::KITTYCAD,
51+
split_closed_faces: false,
52+
}
53+
}
54+
}
3955
}
4056

4157
/// Export models in STEP format.

0 commit comments

Comments
 (0)