Files
modeling-app/public/kcl-samples/french-press/main.kcl
Jonathan Tran 69553fded7 test: Vendor kcl-samples and add simulation tests for them (#5460)
* Change to unzip

* Download kcl-samples as zip to public dir

* Fix fetch:samples, e2e electron still not working

* Change error message to be clearer

* Refactor so that input and output directories of sim tests can be different

* Add kcl samples test implementation

* Update output since adding kcl_samples tests

* Update kcl-samples branch

* Fix git-ignore pattern to only apply to the root

* Fix yarn install and yarn fetch:samples to work the first time

* Remove unneeded exists check

* Change to use kcl-samples in public directory

* Add kcl-samples

* Update output since updating kcl-samples

* Update output files

* Change to not fetch samples during yarn install

* Update output after merge

* Ignore kcl-samples in codespell

* WIP: Don't run e2e if only kcl-samples changed

* Conditionally run cargo tests

* Fix to round floating point values in program memory arrays

* Update output since merge and rounding numbers in memory

* Fix memory redaction for floating point to find more values

* Fix float redaction pattern

* Update output since rounding floating point numbers

* Add center to floating point pattern

* Fix trigger to use picomatch syntax

* Update output since rounding center

* Remove kcl-samples github workflows

* Enable Rust backtrace

* Update output after re-running

* Update output after changing order of post-extrude commands

* Fix to have deterministic order of commands

* Update output after reverting ordering changes

* Update kcl-samples

* Update output after updating samples

* Fix error messages to show the names of all samples that failed

* Change cargo test command to match current one

* Update kcl-samples

* Update output since updating kcl-samples

* Add generate manifest workflow and yarn script

* Fix error check to actually work

* Change util function to be what we actually need

* Move new files after merge

* Fix paths since directory move

* Add dependabot updates for kcl-samples

* Add GitHub workflow to make PR to kcl-samples repo

* Add GitHub workflow to check kcl-samples header comments

* Fix worfklow to change to the right directory

* Add auto-commit simulation test output changes

* Add permissions to workflows

* Fix to run git commit step

* Install just if needed

* Fix directory of justfile

* Add installation of cargo-insta

* Fix to use underscore

* Fix to allow just command failure

* Change to always install CLI tools and cache them

* Trying to fix overwrite failing

* Combine commands

* Change reviewer

* Change to PR targeting the next branch

* Change git commands to not do unnecessary fetch

* Comment out trigger for creating a PR

* Update kcl-samples from next branch

* Update outputs after kcl-samples change

* Fix to use bash pipefail

* Add rust backtrace

* Print full env from sim tests

* Change command to use long option name

* Fix to use ci profile even when calling through just

* Add INSTA_UPDATE=always

* Fix git push by using an app token on checkout

* Add comments

* Fix to use bash options

* Change to echo when no changes are found

* Fix so that kcl-samples updates don't trigger full run

* Fix paths to reflect new crate location

* Fix path detection

* Fix e2e job to ignore kcl_samples simulation test output

* Fix the fetch logic for the KCL samples after vendoring (#5661)

Fixes the last 2 E2E tests for #5460.

---------

Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Frank Noirot <frank@zoo.dev>
2025-03-06 18:01:24 -05:00

232 lines
6.0 KiB
Plaintext

// French Press
// A french press immersion coffee maker
// Set units
@settings(defaultLengthUnit = in)
// Define constants
carafeDiameter = 4.41
carafeHeight = 7.32
handleThickness = 0.65
// Upper ring of the metal structure
sketch001 = startSketchOn('XZ')
|> startProfileAt([carafeDiameter / 2, 5.7], %)
|> angledLine([0, 0.1], %, $rectangleSegmentA001)
|> angledLine([
segAng(rectangleSegmentA001) - 90,
-0.75
], %, $rectangleSegmentB001)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $rectangleSegmentC001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> revolve({ angle = 360, axis = 'Y' }, %)
// Create an angled plane to sketch the supports
plane001 = {
plane = {
origin = [-0.26, 0.26, 0.0],
xAxis = [1, 1, 0.0],
yAxis = [0.0, 0.0, 1.0],
zAxis = [1.0, 0.0, 0.0]
}
}
// Cross section of the metal supports
sketch002 = startSketchOn(plane001)
|> startProfileAt([carafeDiameter / 2, 5.7], %)
|> xLine(0.1, %)
|> yLine(-5.2, %, $edge1)
|> arc({
angleStart = 180,
angleEnd = 205,
radius = 0.3
}, %)
|> angledLine({ angle = -60, length = 0.6 }, %, $edge2)
|> arc({
angleStart = 30,
angleEnd = -120,
radius = 0.6
}, %)
|> angledLineToY({ angle = 150, to = -0.2 }, %, $edge3)
|> arc({
angleStart = 60,
angleEnd = 90,
radius = 0.5
}, %)
|> xLineTo(0.1, %, $edgeLen)
|> yLine(0.1, %)
|> xLine(segLen(edgeLen) + 0.035, %, $edge4)
|> arc({
angleStart = 90,
angleEnd = 60,
radius = 0.6
}, %)
|> angledLine({
angle = 150,
length = -segLen(edge3) + 0.035
}, %, $edge5)
|> arc({
angleStart = -120,
angleEnd = 30,
radius = 0.5
}, %)
|> angledLine({
angle = -60,
length = -segLen(edge2) + 0.035
}, %, $edge6)
|> arc({
angleStart = 205,
angleEnd = 180,
radius = 0.6
}, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> extrude(length = 0.75)
|> patternCircular3d(
axis = [0, 0, 1],
center = [0, 0, 0],
instances = 4,
arcDegrees = 360,
rotateDuplicates = true
)
// Cross plate
sketch003 = startSketchOn(offsetPlane('XY', offset = 1))
|> circle(
center = [0, 0],
radius = carafeDiameter / 2 - 0.15
)
extrude001 = extrude(sketch003, length = 0.050)
sketch004 = startSketchOn(extrude001, 'END')
|> startProfileAt([0.3, 0.17], %)
|> yLine(1.2, %)
|> arc({
angleStart = 90,
angleEnd = -30,
radius = 1.2
}, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> patternCircular2d(
center = [0, 0],
instances = 3,
arcDegrees = 360,
rotateDuplicates = true
)
extrude002 = extrude(sketch004, length = -0.050)
// Filter screen
sketch005 = startSketchOn('XZ')
|> startProfileAt([0.15, 1.11], %)
|> xLineTo(carafeDiameter / 2 - 0.2, %)
|> angledLineToX({
angle = 30,
to = carafeDiameter / 2 - 0.07
}, %, $seg1)
|> angledLine({ angle = -60, length = 0.050 }, %)
|> angledLine({ angle = 30, length = -segLen(seg1) }, %)
|> xLineTo(0.15, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> revolve({ axis = 'y' }, %)
// Plunger and stem
sketch006 = startSketchOn('XZ')
|> startProfileAt([0.1, 1], %)
|> line(end = [0.1, 0])
|> angledLineToX({ angle = 10, to = 0.05 }, %)
|> yLine(10, %)
|> line(end = [0.6, 0])
|> yLine(-.05, %)
|> tangentialArc({ radius = 0.6, offset = -90 }, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> revolve({ axis = 'y' }, %)
// Spiral plate
sketch007 = startSketchOn(offsetPlane('XY', offset = 1.12))
|> circle(
center = [0, 0],
radius = carafeDiameter / 2 - 0.24
)
|> hole(circle(center = [0, 0], radius = .15), %)
extrude003 = extrude(sketch007, length = 0.050)
// Pattern holes in the spiral plate
sketch008 = startSketchOn(extrude003, 'END')
|> circle(center = [1.4, 0], radius = .3)
|> patternCircular2d(
center = [0, 0],
instances = 8,
arcDegrees = 360,
rotateDuplicates = true
)
extrude004 = extrude(sketch008, length = -0.050)
// Pattern holes in the spiral plate
sketch009 = startSketchOn(extrude003, 'END')
|> circle(center = [0.6, 0], radius = .2)
|> patternCircular2d(
center = [0, 0],
instances = 4,
arcDegrees = 360,
rotateDuplicates = true
)
extrude005 = extrude(sketch009, length = -0.050)
// Extrude a glass carafe body
sketch010 = startSketchOn("XY")
|> circle(
center = [0, 0],
radius = carafeDiameter / 2
)
// Perform a shell operation to hollow the carafe body with the top face removed
extrude006 = extrude(sketch010, length = carafeHeight)
|> shell(faces = ["end"], thickness = .07)
// Draw and revolve the lid
sketch011 = startSketchOn('XZ')
|> startProfileAt([0.2, carafeHeight - 0.7], %)
|> xLine(carafeDiameter / 2 - 0.3, %)
|> yLine(0.7, %)
|> xLine(0.3, %)
|> yLine(0.4, %)
|> line(end = [-0.02, 0.02])
|> bezierCurve({
to = [-carafeDiameter / 2 - 0.1, 1],
control1 = [-0.3, 0],
control2 = [carafeDiameter / 10, 1]
}, %)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> revolve({ axis = 'y' }, %)
// Draw and extrude handle
sketch012 = startSketchOn(offsetPlane('XZ', offset = handleThickness / 2))
|> startProfileAt([2.3, 6.4], %)
|> line(end = [0.56, 0])
|> tangentialArcTo([4.1, 5.26], %)
|> tangentialArcTo([4.17, 1.6], %)
|> tangentialArcTo([3.13, 0.61], %)
|> line(end = [-1.09, 0])
|> line(end = [0, 0.43])
|> line(end = [0.99, -0.02])
|> tangentialArcTo([3.63, 1.6], %)
|> tangentialArcTo([3.56, 5.15], %)
|> tangentialArcTo([2.72, 5.88], %)
|> line(end = [-0.4, 0])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude007 = extrude(sketch012, length = -handleThickness)