Replace kittycad crate with kittycad-modeling-cmds (#3909)

lib.rs/kittycad-modeling-cmds is the source of our Modeling API. It gets included in our backend APIs, and those APIs generate OpenAPI specs which are read by `openapitor` which generates the lib.rs/kittycad crate. So basically, our modeling app is using the _generated code_ instead of the _handwritten code_.

This sucks -- if you add a new field to the modeling-api crate, you have to merge PRs to the engine, api-deux, and kittycad.rs before finally you can get the new field into the modeling-app. I was pretty embarrased when @mlfarrell asked how to get a new field into the modeling app and had to explain this whole bullshit cycle. Let's fix it.

Switching to use the kittycad-modeling-cmds (aka kcmc) crate directly should speed up our dev cycle.
This commit is contained in:
Adam Chalmers
2024-09-18 17:04:04 -05:00
committed by GitHub
parent 2978e80226
commit 5cc92f0162
23 changed files with 744 additions and 510 deletions

View File

@ -2,7 +2,10 @@
use anyhow::Result;
use derive_docs::stdlib;
use kittycad::types::ModelingCmd;
use kcmc::each_cmd as mcmd;
use kcmc::length_unit::LengthUnit;
use kcmc::ModelingCmd;
use kittycad_modeling_cmds as kcmc;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
@ -230,12 +233,12 @@ async fn inner_shell(
args.batch_modeling_cmd(
uuid::Uuid::new_v4(),
ModelingCmd::Solid3DShellFace {
ModelingCmd::from(mcmd::Solid3dShellFace {
hollow: false,
face_ids,
object_id: extrude_groups[0].id,
shell_thickness: data.thickness,
},
shell_thickness: LengthUnit(data.thickness),
}),
)
.await?;
@ -316,12 +319,12 @@ async fn inner_hollow(
args.batch_modeling_cmd(
uuid::Uuid::new_v4(),
ModelingCmd::Solid3DShellFace {
ModelingCmd::from(mcmd::Solid3dShellFace {
hollow: true,
face_ids: Vec::new(), // This is empty because we want to hollow the entire object.
object_id: extrude_group.id,
shell_thickness: thickness,
},
shell_thickness: LengthUnit(thickness),
}),
)
.await?;