Skip to content

Commit 0b103b9

Browse files
committed
Integrate more builder API from kcmc
1 parent 5e270aa commit 0b103b9

File tree

4 files changed

+28
-35
lines changed

4 files changed

+28
-35
lines changed

Cargo.lock

Lines changed: 7 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,8 @@ incremental = true
118118
# Set this to 1 or 2 to get more useful backtraces in debugger.
119119
debug = 0
120120

121-
# [patch.crates-io]
121+
[patch.crates-io]
122+
kittycad-modeling-cmds = { git = "https://github.com/KittyCAD/modeling-api", branch = "achalmers/more-builders" }
123+
kcl-lib = { git = "https://github.com/KittyCAD/modeling-app", branch = "achalmers/integrate-builder" }
124+
kcl-test-server = { git = "https://github.com/KittyCAD/modeling-app", branch = "achalmers/integrate-builder" }
122125
# kcl-lib = { path = "../modeling-app/rust/kcl-lib" }

src/cmd_kcl/camera_angles.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,35 @@
1+
use kcmc::shared::Point3d;
12
use kittycad_modeling_cmds as kcmc;
23

4+
const Z_UP: Point3d = Point3d { x: 0.0, y: 0.0, z: 1.0 };
5+
const ZERO: Point3d = Point3d { x: 0.0, y: 0.0, z: 0.0 };
6+
37
pub(crate) fn front() -> kcmc::ModelingCmd {
48
kcmc::ModelingCmd::DefaultCameraLookAt(
59
kcmc::DefaultCameraLookAt::builder()
6-
.up(kcmc::shared::Point3d { x: 0.0, y: 0.0, z: 1.0 })
7-
.vantage(kcmc::shared::Point3d {
8-
x: 0.0,
9-
y: -1.0,
10-
z: 0.0,
11-
})
12-
.center(kcmc::shared::Point3d { x: 0.0, y: 0.0, z: 0.0 })
13-
.maybe_sequence(None)
10+
.up(Z_UP)
11+
.vantage(Point3d::only_y(-1.0))
12+
.center(ZERO)
1413
.build(),
1514
)
1615
}
1716

1817
pub(crate) fn right_side() -> kcmc::ModelingCmd {
1918
kcmc::ModelingCmd::DefaultCameraLookAt(
2019
kcmc::DefaultCameraLookAt::builder()
21-
.up(kcmc::shared::Point3d { x: 0.0, y: 0.0, z: 1.0 })
22-
.vantage(kcmc::shared::Point3d { x: 1.0, y: 0.0, z: 0.0 })
23-
.center(kcmc::shared::Point3d { x: 0.0, y: 0.0, z: 0.0 })
24-
.maybe_sequence(None)
20+
.up(Z_UP)
21+
.vantage(Point3d::only_x(1.0))
22+
.center(ZERO)
2523
.build(),
2624
)
2725
}
2826

2927
pub(crate) fn top() -> kcmc::ModelingCmd {
3028
kcmc::ModelingCmd::DefaultCameraLookAt(
3129
kcmc::DefaultCameraLookAt::builder()
32-
.up(kcmc::shared::Point3d { x: 0.0, y: 1.0, z: 0.0 })
33-
.vantage(kcmc::shared::Point3d { x: 0.0, y: 0.0, z: 1.0 })
34-
.center(kcmc::shared::Point3d { x: 0.0, y: 0.0, z: 0.0 })
35-
.maybe_sequence(None)
30+
.up(Point3d::only_y(1.0))
31+
.vantage(Z_UP)
32+
.center(ZERO)
3633
.build(),
3734
)
3835
}

src/cmd_ml/cmd_text_to_cad.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,10 @@ async fn get_image_bytes(
362362
kcl_lib::SourceRange::default(),
363363
&ModelingCmd::from(
364364
mcmd::ImportFiles::builder()
365-
.files(vec![ImportFile {
366-
path: "model.gltf".to_string(),
367-
data: gltf_bytes.to_vec(),
368-
}])
365+
.files(vec![ImportFile::builder()
366+
.path("model.gltf".to_string())
367+
.data(gltf_bytes.to_vec())
368+
.build()])
369369
.format(InputFormat3d::Gltf(Default::default()))
370370
.build(),
371371
),

0 commit comments

Comments
 (0)