turning back on all planes (#720)
* updates Signed-off-by: Jess Frazelle <github@jessfraz.com> tests Signed-off-by: Jess Frazelle <github@jessfraz.com> fix more tests Signed-off-by: Jess Frazelle <github@jessfraz.com> fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> fix stdlib Signed-off-by: Jess Frazelle <github@jessfraz.com> fix tests Signed-off-by: Jess Frazelle <github@jessfraz.com> fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> compile Signed-off-by: Jess Frazelle <github@jessfraz.com> update sample code Signed-off-by: Jess Frazelle <github@jessfraz.com> re-enable the planes Signed-off-by: Jess Frazelle <github@jessfraz.com> fix tests Signed-off-by: Jess Frazelle <github@jessfraz.com> fix tests Signed-off-by: Jess Frazelle <github@jessfraz.com> fix tests Signed-off-by: Jess Frazelle <github@jessfraz.com> fix tests Signed-off-by: Jess Frazelle <github@jessfraz.com> fix tests Signed-off-by: Jess Frazelle <github@jessfraz.com> fix tests Signed-off-by: Jess Frazelle <github@jessfraz.com> fix tests Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fix all tests Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> boilerplate Signed-off-by: Jess Frazelle <github@jessfraz.com> Cut release v0.9.2 (#714) rust make default planes Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> use the planes from engine Signed-off-by: Jess Frazelle <github@jessfraz.com> fixups Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> negative args Signed-off-by: Jess Frazelle <github@jessfraz.com> diable camera Signed-off-by: Jess Frazelle <github@jessfraz.com> hide planes Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updatress Signed-off-by: Jess Frazelle <github@jessfraz.com> fmt Signed-off-by: Jess Frazelle <github@jessfraz.com> Update src/hooks/useAppMode.ts Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch> Update src/hooks/useAppMode.ts Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch> cleanups Signed-off-by: Jess Frazelle <github@jessfraz.com> Bump kittycad from 0.2.26 to 0.2.27 in /src-tauri (#726) Bumps [kittycad](https://github.com/KittyCAD/kittycad.rs) from 0.2.26 to 0.2.27. - [Release notes](https://github.com/KittyCAD/kittycad.rs/releases) - [Commits](https://github.com/KittyCAD/kittycad.rs/compare/v0.2.26...v0.2.27) --- updated-dependencies: - dependency-name: kittycad dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Bump tauri-plugin-fs-extra from `b04bde3` to `6c7a4c0` in /src-tauri (#725) Bumps [tauri-plugin-fs-extra](https://github.com/tauri-apps/plugins-workspace) from `b04bde3` to `6c7a4c0`. - [Release notes](https://github.com/tauri-apps/plugins-workspace/releases) - [Commits](b04bde3461...6c7a4c0984
) --- updated-dependencies: - dependency-name: tauri-plugin-fs-extra dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Bump toml from 0.8.0 to 0.8.1 in /src-tauri (#724) Bumps [toml](https://github.com/toml-rs/toml) from 0.8.0 to 0.8.1. - [Commits](https://github.com/toml-rs/toml/compare/toml-v0.8.0...toml-v0.8.1) --- updated-dependencies: - dependency-name: toml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Bump openapitor from `61a1605` to `d3e98c4` in /src/wasm-lib (#723) Bumps [openapitor](https://github.com/KittyCAD/kittycad.rs) from `61a1605` to `d3e98c4`. - [Release notes](https://github.com/KittyCAD/kittycad.rs/releases) - [Commits](61a16059b3...d3e98c4ec0
) --- updated-dependencies: - dependency-name: openapitor dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Bump kittycad from 0.2.26 to 0.2.27 in /src/wasm-lib (#722) Bumps [kittycad](https://github.com/KittyCAD/kittycad.rs) from 0.2.26 to 0.2.27. - [Release notes](https://github.com/KittyCAD/kittycad.rs/releases) - [Commits](https://github.com/KittyCAD/kittycad.rs/compare/v0.2.26...v0.2.27) --- updated-dependencies: - dependency-name: kittycad dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Bump thiserror from 1.0.48 to 1.0.49 in /src/wasm-lib (#721) Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.48 to 1.0.49. - [Release notes](https://github.com/dtolnay/thiserror/releases) - [Commits](https://github.com/dtolnay/thiserror/compare/1.0.48...1.0.49) --- updated-dependencies: - dependency-name: thiserror dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Bump expectorate from 1.0.7 to 1.1.0 in /src/wasm-lib (#712) Bumps [expectorate](https://github.com/oxidecomputer/expectorate) from 1.0.7 to 1.1.0. - [Release notes](https://github.com/oxidecomputer/expectorate/releases) - [Commits](https://github.com/oxidecomputer/expectorate/compare/v1.0.7...v1.1.0) --- updated-dependencies: - dependency-name: expectorate dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Bump clap from 4.4.4 to 4.4.5 in /src/wasm-lib (#711) Bumps [clap](https://github.com/clap-rs/clap) from 4.4.4 to 4.4.5. - [Release notes](https://github.com/clap-rs/clap/releases) - [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md) - [Commits](https://github.com/clap-rs/clap/compare/v4.4.4...v4.4.5) --- updated-dependencies: - dependency-name: clap dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> refactor cleanup Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> type improvements * use new sketchmode no camera Signed-off-by: Jess Frazelle <github@jessfraz.com> * js working better Signed-off-by: Jess Frazelle <github@jessfraz.com> * start of negative planes Signed-off-by: Jess Frazelle <github@jessfraz.com> * tests and neg Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * images Signed-off-by: Jess Frazelle <github@jessfraz.com> * norma;s Signed-off-by: Jess Frazelle <github@jessfraz.com> * better initial load of planes Signed-off-by: Jess Frazelle <github@jessfraz.com> * ts Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix tsc Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix edit sketch Signed-off-by: Jess Frazelle <github@jessfraz.com> * add regression test for 2d solid issue Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * show planes Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix clippy Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix tests Signed-off-by: Jess Frazelle <github@jessfraz.com> * canecel in progress Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix ci as well Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -1,14 +1,14 @@
|
||||
use anyhow::Result;
|
||||
use kcl_lib::{
|
||||
ast::{modify::modify_ast_for_sketch, types::Program},
|
||||
engine::{EngineConnection, EngineManager},
|
||||
executor::{MemoryItem, SourceRange},
|
||||
engine::EngineManager,
|
||||
executor::{ExecutorContext, MemoryItem, PlaneType, SourceRange},
|
||||
};
|
||||
use kittycad::types::{ModelingCmd, Point3D};
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
/// Setup the engine and parse code for an ast.
|
||||
async fn setup(code: &str, name: &str) -> Result<(EngineConnection, Program, uuid::Uuid)> {
|
||||
async fn setup(code: &str, name: &str) -> Result<(ExecutorContext, Program, uuid::Uuid)> {
|
||||
let user_agent = concat!(env!("CARGO_PKG_NAME"), ".rs/", env!("CARGO_PKG_VERSION"),);
|
||||
let http_client = reqwest::Client::builder()
|
||||
.user_agent(user_agent)
|
||||
@ -38,8 +38,9 @@ async fn setup(code: &str, name: &str) -> Result<(EngineConnection, Program, uui
|
||||
let program = parser.ast()?;
|
||||
let mut mem: kcl_lib::executor::ProgramMemory = Default::default();
|
||||
let engine = kcl_lib::engine::EngineConnection::new(ws).await?;
|
||||
let memory =
|
||||
kcl_lib::executor::execute(program.clone(), &mut mem, kcl_lib::executor::BodyType::Root, &engine).await?;
|
||||
let planes = kcl_lib::executor::DefaultPlanes::new(&engine).await?;
|
||||
let ctx = ExecutorContext { engine, planes };
|
||||
let memory = kcl_lib::executor::execute(program.clone(), &mut mem, kcl_lib::executor::BodyType::Root, &ctx).await?;
|
||||
|
||||
// We need to get the sketch ID.
|
||||
// Get the sketch group ID from memory.
|
||||
@ -49,7 +50,7 @@ async fn setup(code: &str, name: &str) -> Result<(EngineConnection, Program, uui
|
||||
let sketch_id = sketch_group.id;
|
||||
|
||||
let plane_id = uuid::Uuid::new_v4();
|
||||
engine
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
plane_id,
|
||||
SourceRange::default(),
|
||||
@ -66,7 +67,7 @@ async fn setup(code: &str, name: &str) -> Result<(EngineConnection, Program, uui
|
||||
// Enter sketch mode.
|
||||
// We can't get control points without being in sketch mode.
|
||||
// You can however get path info without sketch mode.
|
||||
engine
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
uuid::Uuid::new_v4(),
|
||||
SourceRange::default(),
|
||||
@ -74,13 +75,14 @@ async fn setup(code: &str, name: &str) -> Result<(EngineConnection, Program, uui
|
||||
animated: false,
|
||||
ortho: true,
|
||||
plane_id,
|
||||
disable_camera_with_plane: Some(Point3D { x: 0.0, y: 0.0, z: 1.0 }),
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
||||
// Enter edit mode.
|
||||
// We can't get control points of an existing sketch without being in edit mode.
|
||||
engine
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
uuid::Uuid::new_v4(),
|
||||
SourceRange::default(),
|
||||
@ -88,14 +90,15 @@ async fn setup(code: &str, name: &str) -> Result<(EngineConnection, Program, uui
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok((engine, program, sketch_id))
|
||||
Ok((ctx, program, sketch_id))
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn serial_test_modify_sketch_part001() {
|
||||
let name = "part001";
|
||||
let code = format!(
|
||||
r#"const {} = startSketchAt([8.41, 5.78])
|
||||
r#"const {} = startSketchOn("XY")
|
||||
|> startProfileAt([8.41, 5.78], %)
|
||||
|> line([7.37, -11.0], %)
|
||||
|> line([-8.69, -3.75], %)
|
||||
|> line([-5.0, 4.25], %)
|
||||
@ -103,9 +106,9 @@ async fn serial_test_modify_sketch_part001() {
|
||||
name
|
||||
);
|
||||
|
||||
let (mut engine, program, sketch_id) = setup(&code, name).await.unwrap();
|
||||
let (mut ctx, program, sketch_id) = setup(&code, name).await.unwrap();
|
||||
let mut new_program = program.clone();
|
||||
let new_code = modify_ast_for_sketch(&mut engine, &mut new_program, name, sketch_id)
|
||||
let new_code = modify_ast_for_sketch(&mut ctx.engine, &mut new_program, name, PlaneType::XY, sketch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -119,7 +122,8 @@ async fn serial_test_modify_sketch_part001() {
|
||||
async fn serial_test_modify_sketch_part002() {
|
||||
let name = "part002";
|
||||
let code = format!(
|
||||
r#"const {} = startSketchAt([8.41, 5.78])
|
||||
r#"const {} = startSketchOn("XY")
|
||||
|> startProfileAt([8.41, 5.78], %)
|
||||
|> line([7.42, -8.62], %)
|
||||
|> line([-6.38, -3.51], %)
|
||||
|> line([-3.77, 3.56], %)
|
||||
@ -127,9 +131,9 @@ async fn serial_test_modify_sketch_part002() {
|
||||
name
|
||||
);
|
||||
|
||||
let (mut engine, program, sketch_id) = setup(&code, name).await.unwrap();
|
||||
let (mut ctx, program, sketch_id) = setup(&code, name).await.unwrap();
|
||||
let mut new_program = program.clone();
|
||||
let new_code = modify_ast_for_sketch(&mut engine, &mut new_program, name, sketch_id)
|
||||
let new_code = modify_ast_for_sketch(&mut ctx.engine, &mut new_program, name, PlaneType::XY, sketch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -144,7 +148,8 @@ async fn serial_test_modify_sketch_part002() {
|
||||
async fn serial_test_modify_close_sketch() {
|
||||
let name = "part002";
|
||||
let code = format!(
|
||||
r#"const {} = startSketchAt([7.91, 3.89])
|
||||
r#"const {} = startSketchOn("XY")
|
||||
|> startProfileAt([7.91, 3.89], %)
|
||||
|> line([7.42, -8.62], %)
|
||||
|> line([-6.38, -3.51], %)
|
||||
|> line([-3.77, 3.56], %)
|
||||
@ -153,9 +158,9 @@ async fn serial_test_modify_close_sketch() {
|
||||
name
|
||||
);
|
||||
|
||||
let (mut engine, program, sketch_id) = setup(&code, name).await.unwrap();
|
||||
let (mut ctx, program, sketch_id) = setup(&code, name).await.unwrap();
|
||||
let mut new_program = program.clone();
|
||||
let new_code = modify_ast_for_sketch(&mut engine, &mut new_program, name, sketch_id)
|
||||
let new_code = modify_ast_for_sketch(&mut ctx.engine, &mut new_program, name, PlaneType::XY, sketch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -169,7 +174,8 @@ async fn serial_test_modify_close_sketch() {
|
||||
async fn serial_test_modify_line_to_close_sketch() {
|
||||
let name = "part002";
|
||||
let code = format!(
|
||||
r#"const {} = startSketchAt([7.91, 3.89])
|
||||
r#"const {} = startSketchOn("XY")
|
||||
|> startProfileAt([7.91, 3.89], %)
|
||||
|> line([7.42, -8.62], %)
|
||||
|> line([-6.38, -3.51], %)
|
||||
|> line([-3.77, 3.56], %)
|
||||
@ -178,9 +184,9 @@ async fn serial_test_modify_line_to_close_sketch() {
|
||||
name
|
||||
);
|
||||
|
||||
let (mut engine, program, sketch_id) = setup(&code, name).await.unwrap();
|
||||
let (mut ctx, program, sketch_id) = setup(&code, name).await.unwrap();
|
||||
let mut new_program = program.clone();
|
||||
let new_code = modify_ast_for_sketch(&mut engine, &mut new_program, name, sketch_id)
|
||||
let new_code = modify_ast_for_sketch(&mut ctx.engine, &mut new_program, name, PlaneType::XY, sketch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -188,7 +194,8 @@ async fn serial_test_modify_line_to_close_sketch() {
|
||||
assert_eq!(
|
||||
new_code,
|
||||
format!(
|
||||
r#"const {} = startSketchAt([7.91, 3.89])
|
||||
r#"const {} = startSketchOn("XY")
|
||||
|> startProfileAt([7.91, 3.89], %)
|
||||
|> line([7.42, -8.62], %)
|
||||
|> line([-6.38, -3.51], %)
|
||||
|> line([-3.77, 3.56], %)
|
||||
@ -204,7 +211,8 @@ async fn serial_test_modify_with_constraint() {
|
||||
let name = "part002";
|
||||
let code = format!(
|
||||
r#"const thing = 12
|
||||
const {} = startSketchAt([7.91, 3.89])
|
||||
const {} = startSketchOn("XY")
|
||||
|> startProfileAt([7.91, 3.89], %)
|
||||
|> line([7.42, -8.62], %)
|
||||
|> line([-6.38, -3.51], %)
|
||||
|> line([-3.77, 3.56], %)
|
||||
@ -213,14 +221,14 @@ const {} = startSketchAt([7.91, 3.89])
|
||||
name
|
||||
);
|
||||
|
||||
let (mut engine, program, sketch_id) = setup(&code, name).await.unwrap();
|
||||
let (mut ctx, program, sketch_id) = setup(&code, name).await.unwrap();
|
||||
let mut new_program = program.clone();
|
||||
let result = modify_ast_for_sketch(&mut engine, &mut new_program, name, sketch_id).await;
|
||||
let result = modify_ast_for_sketch(&mut ctx.engine, &mut new_program, name, PlaneType::XY, sketch_id).await;
|
||||
|
||||
assert!(result.is_err());
|
||||
assert_eq!(
|
||||
result.unwrap_err().to_string(),
|
||||
r#"engine: KclErrorDetails { source_ranges: [SourceRange([159, 164])], message: "Sketch part002 is constrained `partial` and cannot be modified" }"#
|
||||
r#"engine: KclErrorDetails { source_ranges: [SourceRange([188, 193])], message: "Sketch part002 is constrained `partial` and cannot be modified" }"#
|
||||
);
|
||||
}
|
||||
|
||||
@ -228,7 +236,8 @@ const {} = startSketchAt([7.91, 3.89])
|
||||
async fn serial_test_modify_line_should_close_sketch() {
|
||||
let name = "part003";
|
||||
let code = format!(
|
||||
r#"const {} = startSketchAt([13.69, 3.8])
|
||||
r#"const {} = startSketchOn("XY")
|
||||
|> startProfileAt([13.69, 3.8], %)
|
||||
|> line([4.23, -11.79], %)
|
||||
|> line([-10.7, -1.16], %)
|
||||
|> line([-3.72, 8.69], %)
|
||||
@ -237,9 +246,9 @@ async fn serial_test_modify_line_should_close_sketch() {
|
||||
name
|
||||
);
|
||||
|
||||
let (mut engine, program, sketch_id) = setup(&code, name).await.unwrap();
|
||||
let (mut ctx, program, sketch_id) = setup(&code, name).await.unwrap();
|
||||
let mut new_program = program.clone();
|
||||
let new_code = modify_ast_for_sketch(&mut engine, &mut new_program, name, sketch_id)
|
||||
let new_code = modify_ast_for_sketch(&mut ctx.engine, &mut new_program, name, PlaneType::XY, sketch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -247,7 +256,8 @@ async fn serial_test_modify_line_should_close_sketch() {
|
||||
assert_eq!(
|
||||
new_code,
|
||||
format!(
|
||||
r#"const {} = startSketchAt([13.69, 3.8])
|
||||
r#"const {} = startSketchOn("XY")
|
||||
|> startProfileAt([13.69, 3.8], %)
|
||||
|> line([4.23, -11.79], %)
|
||||
|> line([-10.7, -1.16], %)
|
||||
|> line([-3.72, 8.69], %)
|
||||
|
Reference in New Issue
Block a user