Patterns fixes (2d) (#2197)
* updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * patterns fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix docs Signed-off-by: Jess Frazelle <github@jessfraz.com> * better autocomplete 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:
56
src/wasm-lib/tests/executor/inputs/lego.kcl
Normal file
56
src/wasm-lib/tests/executor/inputs/lego.kcl
Normal file
@ -0,0 +1,56 @@
|
||||
// Lego Brick
|
||||
|
||||
const lbumps = 10 // number of bumps long
|
||||
const wbumps = 6 // number of bumps wide
|
||||
|
||||
const pitch = 8.0
|
||||
const clearance = 0.1
|
||||
const bumpDiam = 4.8
|
||||
const bumpHeight = 1.8
|
||||
const height = 3.2
|
||||
|
||||
|
||||
const t = (pitch - (2 * clearance) - bumpDiam) / 2.0
|
||||
const postDiam = pitch - t // works out to 6.5
|
||||
const total_length = lbumps * pitch - (2.0 * clearance)
|
||||
const total_width = wbumps * pitch - (2.0 * clearance)
|
||||
|
||||
const lSegments = total_length / (lbumps + 1)
|
||||
const wSegments = total_width / (wbumps + 1)
|
||||
|
||||
// make the base
|
||||
const s = startSketchOn('XY')
|
||||
|> startProfileAt([-total_width / 2, -total_length / 2], %)
|
||||
|> line([total_width, 0], %)
|
||||
|> line([0, total_length], %)
|
||||
|> line([-total_width, 0], %)
|
||||
|> close(%)
|
||||
|> extrude(height, %)
|
||||
|
||||
const shellExtrude = startSketchOn(s, "start")
|
||||
|> startProfileAt([
|
||||
-(total_width / 2 - t),
|
||||
-(total_length / 2 - t)
|
||||
], %)
|
||||
|> line([total_width - (2 * t), 0], %)
|
||||
|> line([0, total_length - (2 * t)], %)
|
||||
|> line([-(total_width - (2 * t)), 0], %)
|
||||
|> close(%)
|
||||
|> extrude(-(height - t), %)
|
||||
|
||||
const peg = startSketchOn(s, "end")
|
||||
|> circle([
|
||||
-(total_width / 2 - wSegments),
|
||||
-(total_length / 2 - lSegments)
|
||||
], bumpDiam / 2, %)
|
||||
|> patternLinear2d({
|
||||
axis: [1, 0],
|
||||
repetitions: 5,
|
||||
distance: 7
|
||||
}, %)
|
||||
|> patternLinear2d({
|
||||
axis: [0, 1],
|
||||
repetitions: 9,
|
||||
distance: 7
|
||||
}, %)
|
||||
|> extrude(bumpHeight, %)
|
@ -115,6 +115,15 @@ async fn serial_test_riddle_small() {
|
||||
twenty_twenty::assert_image("tests/executor/outputs/riddle_small.png", &result, 0.999);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn serial_test_lego() {
|
||||
let code = include_str!("inputs/lego.kcl");
|
||||
let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm)
|
||||
.await
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image("tests/executor/outputs/lego.png", &result, 0.999);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn serial_test_pentagon_fillet_desugar() {
|
||||
let code = include_str!("inputs/pentagon_fillet_desugar.kcl");
|
||||
|
BIN
src/wasm-lib/tests/executor/outputs/lego.png
Normal file
BIN
src/wasm-lib/tests/executor/outputs/lego.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 199 KiB |
Reference in New Issue
Block a user