fix bug with order of operations (#2938)
* fix bug with order of operations Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -77,6 +77,15 @@ async fn inner_extrude(length: f64, sketch_group_set: SketchGroupSet, args: Args
|
|||||||
let sketch_groups: Vec<Box<SketchGroup>> = sketch_group_set.into();
|
let sketch_groups: Vec<Box<SketchGroup>> = sketch_group_set.into();
|
||||||
let mut extrude_groups = Vec::new();
|
let mut extrude_groups = Vec::new();
|
||||||
for sketch_group in &sketch_groups {
|
for sketch_group in &sketch_groups {
|
||||||
|
// Make sure we exited sketch mode if sketching on a plane.
|
||||||
|
if let SketchSurface::Plane(_) = sketch_group.on {
|
||||||
|
// Disable the sketch mode.
|
||||||
|
// This is necessary for when people don't close the sketch explicitly.
|
||||||
|
// The sketch mode will mess up the extrude direction if still active.
|
||||||
|
args.batch_modeling_cmd(uuid::Uuid::new_v4(), kittycad::types::ModelingCmd::SketchModeDisable {})
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
|
|
||||||
args.send_modeling_cmd(
|
args.send_modeling_cmd(
|
||||||
id,
|
id,
|
||||||
kittycad::types::ModelingCmd::Extrude {
|
kittycad::types::ModelingCmd::Extrude {
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 114 KiB |
@ -0,0 +1,39 @@
|
|||||||
|
// define a plane with UID 94894440791888
|
||||||
|
const plane94894440791888 = {
|
||||||
|
plane: {
|
||||||
|
origin: [0.005000000000000001, 0.01, -0.005],
|
||||||
|
x_axis: [
|
||||||
|
0.9285064634886234,
|
||||||
|
0.37131623619207604,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
y_axis: [-0.0, 0.0, 1.0],
|
||||||
|
z_axis: [
|
||||||
|
0.37131623619207604,
|
||||||
|
-0.9285064634886234,
|
||||||
|
0.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a sketch with UID 94894440902176
|
||||||
|
const sketch94894440902176 = startSketchOn('-XZ')
|
||||||
|
|> startProfileAt([-0.005, -0.005], %)
|
||||||
|
|> line([0.01, 0.0], %, $line94894439494384)
|
||||||
|
|> line([0.0, 0.01], %, $line94894439429616)
|
||||||
|
|> line([-0.01, 0.0], %, $line94894439638160)
|
||||||
|
|> line([0.0, -0.01], %, $line94894439971808)
|
||||||
|
|
||||||
|
// create an extrusion with UID 94894439487136
|
||||||
|
const extrude94894439487136 = extrude(0.01, sketch94894440902176)
|
||||||
|
|
||||||
|
// create a sketch with UID 94894439448464
|
||||||
|
const sketch94894439448464 = startSketchOn(plane94894440791888)
|
||||||
|
|> startProfileAt([
|
||||||
|
0.00074557205559017,
|
||||||
|
0.00306415853984399
|
||||||
|
], %)
|
||||||
|
|> line([0.004999999999999999, 0.0], %, $line94894440230336)
|
||||||
|
|> line([0.0, -0.005], %, $line94894439497168)
|
||||||
|
|> line([-0.004999999999999999, 0.0], %, $line94894439496768)
|
||||||
|
|> line([0.0, 0.005], %, $line94894440231952)
|
@ -0,0 +1,39 @@
|
|||||||
|
// define a plane with UID 94894440791888
|
||||||
|
const plane94894440791888 = {
|
||||||
|
plane: {
|
||||||
|
origin: [0.005000000000000001, 0.01, -0.005],
|
||||||
|
x_axis: [
|
||||||
|
0.9285064634886234,
|
||||||
|
0.37131623619207604,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
y_axis: [-0.0, 0.0, 1.0],
|
||||||
|
z_axis: [
|
||||||
|
0.37131623619207604,
|
||||||
|
-0.9285064634886234,
|
||||||
|
0.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a sketch with UID 94894440902176
|
||||||
|
const sketch94894440902176 = startSketchOn('-XZ')
|
||||||
|
|> startProfileAt([-0.005, -0.005], %)
|
||||||
|
|> line([0.01, 0.0], %, $line94894439494384)
|
||||||
|
|> line([0.0, 0.01], %, $line94894439429616)
|
||||||
|
|> line([-0.01, 0.0], %, $line94894439638160)
|
||||||
|
|> line([0.0, -0.01], %, $line94894439971808)
|
||||||
|
|
||||||
|
// create a sketch with UID 94894439448464
|
||||||
|
const sketch94894439448464 = startSketchOn(plane94894440791888)
|
||||||
|
|> startProfileAt([
|
||||||
|
0.00074557205559017,
|
||||||
|
0.00306415853984399
|
||||||
|
], %)
|
||||||
|
|> line([0.004999999999999999, 0.0], %, $line94894440230336)
|
||||||
|
|> line([0.0, -0.005], %, $line94894439497168)
|
||||||
|
|> line([-0.004999999999999999, 0.0], %, $line94894439496768)
|
||||||
|
|> line([0.0, 0.005], %, $line94894440231952)
|
||||||
|
|
||||||
|
// create an extrusion with UID 94894439487136
|
||||||
|
const extrude94894439487136 = extrude(0.01, sketch94894440902176)
|
@ -2472,3 +2472,25 @@ async fn serial_test_pattern_vase() {
|
|||||||
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
||||||
twenty_twenty::assert_image("tests/executor/outputs/pattern_vase.png", &result, 0.999);
|
twenty_twenty::assert_image("tests/executor/outputs/pattern_vase.png", &result, 0.999);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn serial_test_order_sketch_extrude_in_order() {
|
||||||
|
let code = include_str!("inputs/order-sketch-extrude-in-order.kcl");
|
||||||
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
||||||
|
twenty_twenty::assert_image(
|
||||||
|
"tests/executor/outputs/order-sketch-extrude-in-order.png",
|
||||||
|
&result,
|
||||||
|
0.999,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn serial_test_order_sketch_extrude_out_of_order() {
|
||||||
|
let code = include_str!("inputs/order-sketch-extrude-out-of-order.kcl");
|
||||||
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
||||||
|
twenty_twenty::assert_image(
|
||||||
|
"tests/executor/outputs/order-sketch-extrude-out-of-order.png",
|
||||||
|
&result,
|
||||||
|
0.999,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
Reference in New Issue
Block a user