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
142 changes: 124 additions & 18 deletions Cargo.lock

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

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ image = { version = "0.25", default-features = false, features = [
"jpeg",
] }
itertools = "0.15.0"
kcl-error = "=0.2.167"
kcl-lib = { version = "=0.2.167", features = ["disable-println"] }
kcl-test-server = "=0.2.167"
kittycad = { version = "0.4.12", features = [
Expand All @@ -47,7 +48,7 @@ kittycad = { version = "0.4.12", features = [
"requests",
"retry",
] }
kittycad-modeling-cmds = { version = "0.2.208", features = [
kittycad-modeling-cmds = { version = "0.2.209", features = [
"websocket",
"tabled",
] }
Expand All @@ -73,6 +74,7 @@ reqwest = { version = "0.12", default-features = false, features = [
"deflate",
] }
ring = "0.17.14"
rmp-serde = "1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_yaml = "0.9"
Expand Down Expand Up @@ -121,5 +123,6 @@ incremental = true
debug = 0

[patch.crates-io]
# kcl-lib = { git = "https://github.com/KittyCAD/modeling-app", branch = "main" }
kcl-lib = { git = "https://github.com/KittyCAD/modeling-app", branch = "main" }
kcl-test-server = { git = "https://github.com/KittyCAD/modeling-app", branch = "main" }
# kittycad-modeling-cmds = { git = "https://github.com/KittyCAD/modeling-api", branch = "achalmers/remove-cruft"}
37 changes: 34 additions & 3 deletions src/cmd_kcl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,39 @@ impl crate::cmd::Command for CmdKclExport {
.map_err(|err| kcl_error_fmt::into_miette_for_parse(&filepath.display().to_string(), &code, err))?;
let meta_settings = program.meta_settings()?.unwrap_or_default();
let units: UnitLength = meta_settings.default_length_units.to_kcmc();
let output_format = get_output_format(&self.output_format, units, self.deterministic);

if crate::context::Context::use_server_kcl_execution() {
let (mut responses, session_data) = ctx
.run_server_kcl_then_modeling_cmds(
"",
&filepath.display().to_string(),
&filepath,
&code,
vec![kcmc::ModelingCmd::Export(
kcmc::Export::builder().entity_ids(vec![]).format(output_format).build(),
)],
settings,
self.run_options.issue_check(),
)
.await?;
let Some(kcmc::websocket::OkWebSocketResponseData::Export { files }) = responses.pop() else {
anyhow::bail!("Expected Export response from engine");
};

for file in files {
let path = self.output_dir.join(file.name);
std::fs::write(&path, file.contents)?;

writeln!(ctx.io.out, "Wrote file: {}", path.display())?;
}

if self.show_trace {
print_trace_link(&mut ctx.io, &session_data)
}

return Ok(());
}

let client = ctx.api_client("")?;
let ectx = kcl_lib::ExecutorContext::new(&client, settings).await?;
Expand All @@ -174,9 +207,7 @@ impl crate::cmd::Command for CmdKclExport {
self.run_options.issue_check(),
)?;

let files = ectx
.export(get_output_format(&self.output_format, units, self.deterministic))
.await?;
let files = ectx.export(output_format).await?;

// Save the files to our export directory.
for file in files {
Expand Down
Loading
Loading