apply fillets before a shell (#3261)
* add test for fillet and shell Signed-off-by: Jess Frazelle <github@jessfraz.com> * apply fillets before a shell Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -77,6 +77,11 @@ async fn inner_shell(
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Flush the batch for our fillets/chamfers if there are any.
|
||||||
|
// If we do not do these for sketch on face, things will fail with face does not exist.
|
||||||
|
args.flush_batch_for_extrude_group_set(extrude_group.clone().into())
|
||||||
|
.await?;
|
||||||
|
|
||||||
args.batch_modeling_cmd(
|
args.batch_modeling_cmd(
|
||||||
uuid::Uuid::new_v4(),
|
uuid::Uuid::new_v4(),
|
||||||
ModelingCmd::Solid3DShellFace {
|
ModelingCmd::Solid3DShellFace {
|
||||||
|
81
src/wasm-lib/tests/executor/inputs/fillet-and-shell.kcl
Normal file
81
src/wasm-lib/tests/executor/inputs/fillet-and-shell.kcl
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
const rpizWidth = 30
|
||||||
|
const rpizLength = 65
|
||||||
|
|
||||||
|
const caseThickness = 1
|
||||||
|
|
||||||
|
const border = 4
|
||||||
|
|
||||||
|
const screwHeight = 4
|
||||||
|
|
||||||
|
const caseWidth = rpizWidth + border * 2
|
||||||
|
const caseLength = rpizLength + border * 2
|
||||||
|
const caseHeight = 8
|
||||||
|
|
||||||
|
const widthBetweenScrews = 23
|
||||||
|
const lengthBetweenScrews = 29 * 2
|
||||||
|
|
||||||
|
const miniHdmiDistance = 12.4
|
||||||
|
const microUsb1Distance = 41.4
|
||||||
|
const microUsb2Distance = 54
|
||||||
|
|
||||||
|
const miniHdmiWidth = 11.2
|
||||||
|
const microUsbWidth = 7.4
|
||||||
|
const connectorPadding = 4
|
||||||
|
|
||||||
|
const miniHdmiHole = startSketchAt([
|
||||||
|
0,
|
||||||
|
border + miniHdmiDistance - (miniHdmiWidth / 2)
|
||||||
|
])
|
||||||
|
|> lineTo([
|
||||||
|
0,
|
||||||
|
border + miniHdmiDistance + miniHdmiWidth / 2
|
||||||
|
], %)
|
||||||
|
|> lineTo([
|
||||||
|
1,
|
||||||
|
border + miniHdmiDistance + miniHdmiWidth / 2
|
||||||
|
], %)
|
||||||
|
|> lineTo([
|
||||||
|
1,
|
||||||
|
border + miniHdmiDistance - (miniHdmiWidth / 2)
|
||||||
|
], %)
|
||||||
|
|> close(%)
|
||||||
|
|
||||||
|
const case = startSketchOn('XY')
|
||||||
|
|> startProfileAt([0, 0], %)
|
||||||
|
|> lineTo([caseWidth, 0], %, $edge1)
|
||||||
|
|> lineTo([caseWidth, caseLength], %, $edge2)
|
||||||
|
|> lineTo([0, caseLength], %, $edge3)
|
||||||
|
|> close(%, $edge4)
|
||||||
|
|> extrude(caseHeight, %)
|
||||||
|
|> fillet({
|
||||||
|
radius: 1,
|
||||||
|
tags: [
|
||||||
|
getNextAdjacentEdge(edge1),
|
||||||
|
getNextAdjacentEdge(edge2),
|
||||||
|
getNextAdjacentEdge(edge3),
|
||||||
|
getNextAdjacentEdge(edge4)
|
||||||
|
],
|
||||||
|
}, %)
|
||||||
|
|
||||||
|
|
||||||
|
fn m25Screw = (x, y, height) => {
|
||||||
|
const screw = startSketchOn("XY")
|
||||||
|
|> startProfileAt([0, 0], %)
|
||||||
|
|> circle([x, y], 2.5, %)
|
||||||
|
|> hole(circle([x, y], 1.25, %), %)
|
||||||
|
|> extrude(height, %)
|
||||||
|
return screw
|
||||||
|
}
|
||||||
|
|
||||||
|
m25Screw(border + rpizWidth / 2 - (widthBetweenScrews / 2), 0 + border + rpizLength / 2 - (lengthBetweenScrews / 2), screwHeight)
|
||||||
|
|
||||||
|
m25Screw(border + rpizWidth / 2 - (widthBetweenScrews / 2), 0 + border + rpizLength / 2 + lengthBetweenScrews / 2, screwHeight)
|
||||||
|
|
||||||
|
m25Screw(border + rpizWidth / 2 + widthBetweenScrews / 2, 0 + border + rpizLength / 2 + lengthBetweenScrews / 2, screwHeight)
|
||||||
|
|
||||||
|
m25Screw(border + rpizWidth / 2 + widthBetweenScrews / 2, 0 + border + rpizLength / 2 - (lengthBetweenScrews / 2), screwHeight)
|
||||||
|
|
||||||
|
shell({
|
||||||
|
faces: ['end'],
|
||||||
|
thickness: caseThickness
|
||||||
|
}, case)
|
@ -2371,3 +2371,15 @@ someFunction('INVALID')
|
|||||||
r#"semantic: KclErrorDetails { source_ranges: [SourceRange([89, 114]), SourceRange([126, 155]), SourceRange([159, 182])], message: "Argument at index 0 was supposed to be type kcl_lib::std::sketch::SketchData but wasn't" }"#
|
r#"semantic: KclErrorDetails { source_ranges: [SourceRange([89, 114]), SourceRange([126, 155]), SourceRange([159, 182])], message: "Argument at index 0 was supposed to be type kcl_lib::std::sketch::SketchData but wasn't" }"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn kcl_test_fillet_and_shell() {
|
||||||
|
let code = kcl_input!("fillet-and-shell");
|
||||||
|
|
||||||
|
let result = execute_and_snapshot(code, UnitLength::Mm).await;
|
||||||
|
assert!(result.is_err());
|
||||||
|
assert_eq!(
|
||||||
|
result.err().unwrap().to_string(),
|
||||||
|
r#"engine: KclErrorDetails { source_ranges: [SourceRange([2004, 2065])], message: "Modeling command failed: [ApiError { error_code: InternalEngine, message: \"Shell of non-planar solid3d not available yet\" }]" }"#
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user