new sample code w tangental arc (#756)
* new sample code w tangental arc Signed-off-by: Jess Frazelle <github@jessfraz.com> * line 6 Signed-off-by: Jess Frazelle <github@jessfraz.com> * make sure sample code works in test Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -1,19 +1,27 @@
|
|||||||
export const bracket = `// Material: 6061-T6 Aluminum
|
export const bracket = `const sigmaAllow = 15000 // psi
|
||||||
const sigmaAllow = 35000 // psi
|
const width = 11 // inch
|
||||||
const width = 9 // inch
|
|
||||||
const p = 150 // Force on shelf - lbs
|
const p = 150 // Force on shelf - lbs
|
||||||
const distance = 6 // inches
|
const distance = 12 // inches
|
||||||
const FOS = 2
|
const FOS = 2
|
||||||
|
const thickness = sqrt(distance * p * FOS * 6 / ( sigmaAllow * width ))
|
||||||
|
const filletR = thickness * 2
|
||||||
|
const shelfMountL = 9
|
||||||
|
const wallMountL = 8
|
||||||
|
|
||||||
const leg1 = 5 // inches
|
|
||||||
const leg2 = 8 // inches
|
|
||||||
const thickness = sqrt(distance * p * FOS * 6 / sigmaAllow / width) // inches
|
|
||||||
const bracket = startSketchAt([0, 0])
|
const bracket = startSketchAt([0, 0])
|
||||||
|> line([0, leg1], %)
|
|> line([0, wallMountL], %)
|
||||||
|> line([leg2, 0], %)
|
|> tangentalArc({
|
||||||
|
radius: filletR,
|
||||||
|
offset: 90
|
||||||
|
}, %)
|
||||||
|
|> line([-shelfMountL, 0], %)
|
||||||
|> line([0, -thickness], %)
|
|> line([0, -thickness], %)
|
||||||
|> line([-leg2 + thickness, 0], %)
|
|> line([shelfMountL, 0], %)
|
||||||
|> line([0, -leg1 + thickness], %)
|
|> tangentalArc({
|
||||||
|
radius: filletR - thickness,
|
||||||
|
offset: -90
|
||||||
|
}, %)
|
||||||
|
|> line([0, -wallMountL], %)
|
||||||
|> close(%)
|
|> close(%)
|
||||||
|> extrude(width, %)
|
|> extrude(width, %)
|
||||||
|
|
||||||
|
@ -148,6 +148,41 @@ show(bracket)"#;
|
|||||||
twenty_twenty::assert_image("tests/executor/outputs/parametric.png", &result, 1.0);
|
twenty_twenty::assert_image("tests/executor/outputs/parametric.png", &result, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn serial_test_execute_parametric_with_tan_arc_example() {
|
||||||
|
let code = r#"const sigmaAllow = 15000 // psi
|
||||||
|
const width = 11 // inch
|
||||||
|
const p = 150 // Force on shelf - lbs
|
||||||
|
const distance = 12 // inches
|
||||||
|
const FOS = 2
|
||||||
|
const thickness = sqrt(distance * p * FOS * 6 / ( sigmaAllow * width ))
|
||||||
|
const filletR = thickness * 2
|
||||||
|
const shelfMountL = 9
|
||||||
|
const wallMountL = 8
|
||||||
|
|
||||||
|
const bracket = startSketchAt([0, 0])
|
||||||
|
|> line([0, wallMountL], %)
|
||||||
|
|> tangentalArc({
|
||||||
|
radius: filletR,
|
||||||
|
offset: 90
|
||||||
|
}, %)
|
||||||
|
|> line([-shelfMountL, 0], %)
|
||||||
|
|> line([0, -thickness], %)
|
||||||
|
|> line([shelfMountL, 0], %)
|
||||||
|
|> tangentalArc({
|
||||||
|
radius: filletR - thickness,
|
||||||
|
offset: -90
|
||||||
|
}, %)
|
||||||
|
|> line([0, -wallMountL], %)
|
||||||
|
|> close(%)
|
||||||
|
|> extrude(width, %)
|
||||||
|
|
||||||
|
show(bracket)"#;
|
||||||
|
|
||||||
|
let result = execute_and_snapshot(code).await.unwrap();
|
||||||
|
twenty_twenty::assert_image("tests/executor/outputs/parametric_with_tan_arc.png", &result, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn serial_test_execute_engine_error_return() {
|
async fn serial_test_execute_engine_error_return() {
|
||||||
let code = r#"const part001 = startSketchAt([5.5229, 5.25217])
|
let code = r#"const part001 = startSketchAt([5.5229, 5.25217])
|
||||||
|
BIN
src/wasm-lib/tests/executor/outputs/parametric_with_tan_arc.png
Normal file
BIN
src/wasm-lib/tests/executor/outputs/parametric_with_tan_arc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 71 KiB |
Reference in New Issue
Block a user