Compare commits
11 Commits
derive-doc
...
achalmers/
Author | SHA1 | Date | |
---|---|---|---|
74b09f3ef6 | |||
76480f1a43 | |||
f850f80de1 | |||
15ebbe6947 | |||
01beba42da | |||
509e372ed2 | |||
b0417114af | |||
0360a4021b | |||
6f36371e6d | |||
ebcc19e757 | |||
84cbcddff1 |
Before Width: | Height: | Size: 221 KiB After Width: | Height: | Size: 224 KiB |
Before Width: | Height: | Size: 221 KiB After Width: | Height: | Size: 224 KiB |
Before Width: | Height: | Size: 221 KiB After Width: | Height: | Size: 224 KiB |
Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 165 KiB |
Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 165 KiB |
Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 165 KiB |
Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 165 KiB |
Before Width: | Height: | Size: 221 KiB After Width: | Height: | Size: 224 KiB |
Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 165 KiB |
Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 165 KiB |
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 50 KiB |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "untitled-app",
|
"name": "untitled-app",
|
||||||
"version": "0.17.0",
|
"version": "0.17.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@codemirror/autocomplete": "^6.15.0",
|
"@codemirror/autocomplete": "^6.15.0",
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
},
|
},
|
||||||
"package": {
|
"package": {
|
||||||
"productName": "zoo-modeling-app",
|
"productName": "zoo-modeling-app",
|
||||||
"version": "0.17.0"
|
"version": "0.17.1"
|
||||||
},
|
},
|
||||||
"tauri": {
|
"tauri": {
|
||||||
"allowlist": {
|
"allowlist": {
|
||||||
|
@ -34,5 +34,28 @@ const bracket = startSketchOn('XY')
|
|||||||
|> fillet({
|
|> fillet({
|
||||||
radius: filletR + thickness,
|
radius: filletR + thickness,
|
||||||
tags: [getNextAdjacentEdge('outerEdge', %)]
|
tags: [getNextAdjacentEdge('outerEdge', %)]
|
||||||
}, %)
|
}, %)`
|
||||||
`
|
|
||||||
|
function findLineInExampleCode({
|
||||||
|
searchText,
|
||||||
|
example = bracket,
|
||||||
|
}: {
|
||||||
|
searchText: string
|
||||||
|
example?: string
|
||||||
|
}) {
|
||||||
|
const lines = example.split('\n')
|
||||||
|
const lineNumber = lines.findIndex((l) => l.includes(searchText)) + 1
|
||||||
|
if (lineNumber === 0) {
|
||||||
|
throw new Error(
|
||||||
|
`Could not find the line with search text "${searchText}" in the example code. Was it removed?`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return lineNumber
|
||||||
|
}
|
||||||
|
|
||||||
|
export const bracketWidthConstantLine = findLineInExampleCode({
|
||||||
|
searchText: 'const width',
|
||||||
|
})
|
||||||
|
export const bracketThicknessCalculationLine = findLineInExampleCode({
|
||||||
|
searchText: 'const thickness',
|
||||||
|
})
|
||||||
|
@ -21,7 +21,8 @@ export default function Export() {
|
|||||||
<section className="flex-1">
|
<section className="flex-1">
|
||||||
<h2 className="text-2xl font-bold">Export</h2>
|
<h2 className="text-2xl font-bold">Export</h2>
|
||||||
<p className="my-4">
|
<p className="my-4">
|
||||||
Try opening the project menu and clicking "Export Part".
|
Try opening the project menu and clicking the "Export Part" at the
|
||||||
|
bottom of the pane.
|
||||||
</p>
|
</p>
|
||||||
<p className="my-4">
|
<p className="my-4">
|
||||||
{APP_NAME} uses{' '}
|
{APP_NAME} uses{' '}
|
||||||
|
@ -2,6 +2,7 @@ import { OnboardingButtons, kbdClasses, useDismiss, useNextClick } from '.'
|
|||||||
import { onboardingPaths } from 'routes/Onboarding/paths'
|
import { onboardingPaths } from 'routes/Onboarding/paths'
|
||||||
import { useStore } from '../../useStore'
|
import { useStore } from '../../useStore'
|
||||||
import { useBackdropHighlight } from 'hooks/useBackdropHighlight'
|
import { useBackdropHighlight } from 'hooks/useBackdropHighlight'
|
||||||
|
import { bracketWidthConstantLine } from 'lib/exampleKcl'
|
||||||
|
|
||||||
export default function InteractiveNumbers() {
|
export default function InteractiveNumbers() {
|
||||||
const { buttonDownInStream } = useStore((s) => ({
|
const { buttonDownInStream } = useStore((s) => ({
|
||||||
@ -26,11 +27,25 @@ export default function InteractiveNumbers() {
|
|||||||
<h2 className="text-3xl font-bold">Hybrid editing</h2>
|
<h2 className="text-3xl font-bold">Hybrid editing</h2>
|
||||||
|
|
||||||
<p className="my-4">
|
<p className="my-4">
|
||||||
Try changing the value of <code>width</code> on line 2 by holding
|
We believe editing in Modeling App should feel fluid between code
|
||||||
the <kbd className={kbdClasses}>Alt</kbd> (or{' '}
|
and point-and-click, so that you can work in the way that feels most
|
||||||
<kbd className={kbdClasses}>Option</kbd>) key and dragging the
|
natural to you. Let's try something out that demonstrates this
|
||||||
number left and right. You can hold down different modifier keys to
|
principle, by editing numbers without typing.
|
||||||
change the value by different increments:
|
</p>
|
||||||
|
<ol className="pl-6 my-4 list-decimal">
|
||||||
|
<li className="list-decimal">
|
||||||
|
Press and hold the <kbd className={kbdClasses}>Alt</kbd> (or{' '}
|
||||||
|
<kbd className={kbdClasses}>Option</kbd>) key
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Hover over the number assigned to <code>width</code> on line{' '}
|
||||||
|
{bracketWidthConstantLine}
|
||||||
|
</li>
|
||||||
|
<li>Drag the number left and right to change its value</li>
|
||||||
|
</ol>
|
||||||
|
<p className="my-4">
|
||||||
|
You can hold down different modifier keys to change the value by
|
||||||
|
different increments:
|
||||||
</p>
|
</p>
|
||||||
<ul className="flex flex-col text-sm my-4 mx-12 divide-y divide-chalkboard-20 dark:divide-chalkboard-70">
|
<ul className="flex flex-col text-sm my-4 mx-12 divide-y divide-chalkboard-20 dark:divide-chalkboard-70">
|
||||||
<li className="flex justify-between m-0 px-0 py-2">
|
<li className="flex justify-between m-0 px-0 py-2">
|
||||||
@ -70,10 +85,8 @@ export default function InteractiveNumbers() {
|
|||||||
lets you interact with numbers in your code by dragging them around.
|
lets you interact with numbers in your code by dragging them around.
|
||||||
</p>
|
</p>
|
||||||
<p className="my-4">
|
<p className="my-4">
|
||||||
We believe editing in Modeling App should feel fluid between code
|
We're going to keep extending the text editor, and we'd love to hear
|
||||||
and point-and-click, so that you can work in the way that feels most
|
your ideas for how to make it better.
|
||||||
natural to you. We're going to keep extending the text editor, and
|
|
||||||
we'd love to hear your ideas for how to make it better.
|
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
<OnboardingButtons
|
<OnboardingButtons
|
||||||
|
@ -141,10 +141,11 @@ export default function Introduction() {
|
|||||||
<section className="my-12">
|
<section className="my-12">
|
||||||
<p className="my-4">
|
<p className="my-4">
|
||||||
Welcome to {APP_NAME}! This is a hardware design tool that lets you
|
Welcome to {APP_NAME}! This is a hardware design tool that lets you
|
||||||
edit visually, with code, or both. It's powered by the first API
|
edit visually, with code, or both. It's powered by the KittyCAD
|
||||||
created for anyone to build hardware design tools. The 3D view is
|
Design API, the first API created for anyone to build hardware
|
||||||
not running on your computer, but is instead being streamed to you
|
design tools. The 3D view is not running on your computer, but is
|
||||||
from a remote GPU as video.
|
instead being streamed to you from an instance of our Geometry
|
||||||
|
Engine on a remote GPU as video.
|
||||||
</p>
|
</p>
|
||||||
<p className="my-4">
|
<p className="my-4">
|
||||||
This is an alpha release, so you will encounter bugs and missing
|
This is an alpha release, so you will encounter bugs and missing
|
||||||
@ -173,7 +174,7 @@ export default function Introduction() {
|
|||||||
className="mt-6"
|
className="mt-6"
|
||||||
dismiss={dismiss}
|
dismiss={dismiss}
|
||||||
next={next}
|
next={next}
|
||||||
nextText="Camera"
|
nextText="Mouse Controls"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,6 +4,7 @@ import { useStore } from '../../useStore'
|
|||||||
import { useBackdropHighlight } from 'hooks/useBackdropHighlight'
|
import { useBackdropHighlight } from 'hooks/useBackdropHighlight'
|
||||||
import { Themes, getSystemTheme } from 'lib/theme'
|
import { Themes, getSystemTheme } from 'lib/theme'
|
||||||
import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext'
|
import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext'
|
||||||
|
import { bracketThicknessCalculationLine } from 'lib/exampleKcl'
|
||||||
|
|
||||||
export default function ParametricModeling() {
|
export default function ParametricModeling() {
|
||||||
const { buttonDownInStream } = useStore((s) => ({
|
const { buttonDownInStream } = useStore((s) => ({
|
||||||
@ -61,7 +62,10 @@ export default function ParametricModeling() {
|
|||||||
<p className="my-4">
|
<p className="my-4">
|
||||||
We are able to easily calculate the thickness of the material based
|
We are able to easily calculate the thickness of the material based
|
||||||
on the width of the bracket to meet a set safety factor on{' '}
|
on the width of the bracket to meet a set safety factor on{' '}
|
||||||
<em className="text-energy-60 dark:text-energy-20">line 14</em>.
|
<em className="text-energy-60 dark:text-energy-20">
|
||||||
|
line {bracketThicknessCalculationLine}
|
||||||
|
</em>
|
||||||
|
.
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
<OnboardingButtons
|
<OnboardingButtons
|
||||||
|
@ -30,9 +30,15 @@ export default function Sketching() {
|
|||||||
<h1 className="text-2xl font-bold">Sketching</h1>
|
<h1 className="text-2xl font-bold">Sketching</h1>
|
||||||
<p className="my-4">
|
<p className="my-4">
|
||||||
Our 3D modeling tools are still very much a work in progress, but we
|
Our 3D modeling tools are still very much a work in progress, but we
|
||||||
want to show you some early features. Try creating a sketch by
|
want to show you some early features. Try sketching by clicking Start
|
||||||
clicking Create Sketch in the top toolbar, then clicking the Line
|
Sketch in the top toolbar and selecting a plane to draw on. Now you
|
||||||
tool, and clicking in the 3D view.
|
can start clicking to draw lines and shapes.
|
||||||
|
</p>
|
||||||
|
<p className="my-4">
|
||||||
|
The Line tool will be equipped by default, but you can switch it to as
|
||||||
|
you go by clicking another tool in the toolbar, or unequip it by
|
||||||
|
clicking the Line tool button. With no tool selected, you can move
|
||||||
|
points and add constraints to your sketch.
|
||||||
</p>
|
</p>
|
||||||
<p className="my-4">
|
<p className="my-4">
|
||||||
Watch the code pane as you click. Point-and-click interactions are
|
Watch the code pane as you click. Point-and-click interactions are
|
||||||
|
@ -14,12 +14,12 @@ slow-timeout = { period = "30s", terminate-after = 5 }
|
|||||||
[[profile.default.overrides]]
|
[[profile.default.overrides]]
|
||||||
filter = "test(serial_test_)"
|
filter = "test(serial_test_)"
|
||||||
test-group = "serial-integration"
|
test-group = "serial-integration"
|
||||||
threads-required = 4
|
threads-required = 2
|
||||||
|
|
||||||
[[profile.ci.overrides]]
|
[[profile.ci.overrides]]
|
||||||
filter = "test(serial_test_)"
|
filter = "test(serial_test_)"
|
||||||
test-group = "serial-integration"
|
test-group = "serial-integration"
|
||||||
threads-required = 4
|
threads-required = 2
|
||||||
|
|
||||||
[[profile.default.overrides]]
|
[[profile.default.overrides]]
|
||||||
filter = "test(parser::parser_impl::snapshot_tests)"
|
filter = "test(parser::parser_impl::snapshot_tests)"
|
||||||
|
53
src/wasm-lib/Cargo.lock
generated
@ -565,9 +565,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.5.3"
|
version = "4.5.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "949626d00e063efc93b6dca932419ceb5432f99769911c0b995f7e884c778813"
|
checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
"clap_derive",
|
"clap_derive",
|
||||||
@ -589,9 +589,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_derive"
|
name = "clap_derive"
|
||||||
version = "4.5.3"
|
version = "4.5.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "90239a040c80f5e14809ca132ddc4176ab33d5e17e49691793296e3fcb34d72f"
|
checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck 0.5.0",
|
"heck 0.5.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@ -944,6 +944,23 @@ dependencies = [
|
|||||||
"syn 2.0.55",
|
"syn 2.0.55",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "derive-docs"
|
||||||
|
version = "0.1.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "138b94245509a9dd516008788b585c34847829cf37b40a758b4aa581cf94f147"
|
||||||
|
dependencies = [
|
||||||
|
"Inflector",
|
||||||
|
"convert_case",
|
||||||
|
"once_cell",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"regex",
|
||||||
|
"serde",
|
||||||
|
"serde_tokenstream",
|
||||||
|
"syn 2.0.55",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "diesel_derives"
|
name = "diesel_derives"
|
||||||
version = "2.1.3"
|
version = "2.1.3"
|
||||||
@ -1842,7 +1859,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-lib"
|
name = "kcl-lib"
|
||||||
version = "0.1.46"
|
version = "0.1.47"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"approx 0.5.1",
|
"approx 0.5.1",
|
||||||
@ -1856,7 +1873,7 @@ dependencies = [
|
|||||||
"criterion",
|
"criterion",
|
||||||
"dashmap",
|
"dashmap",
|
||||||
"databake",
|
"databake",
|
||||||
"derive-docs",
|
"derive-docs 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"expectorate",
|
"expectorate",
|
||||||
"futures",
|
"futures",
|
||||||
"gltf-json",
|
"gltf-json",
|
||||||
@ -1943,8 +1960,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kittycad-execution-plan"
|
name = "kittycad-execution-plan"
|
||||||
version = "0.1.1"
|
version = "0.1.3"
|
||||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#a3b8df282c684b3f7003ec96f5cea85284e0f1f9"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e913f8e5f3ef7928cddca2e7b53c6582d7be6a8f900d18ce6c31c04083056270"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"gltf-json",
|
"gltf-json",
|
||||||
@ -1966,7 +1984,8 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "kittycad-execution-plan-macros"
|
name = "kittycad-execution-plan-macros"
|
||||||
version = "0.1.9"
|
version = "0.1.9"
|
||||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#a3b8df282c684b3f7003ec96f5cea85284e0f1f9"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0611fc9b9786175da21d895ffa0f65039e19c9111e94a41b7af999e3b95f045f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -1976,7 +1995,8 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "kittycad-execution-plan-traits"
|
name = "kittycad-execution-plan-traits"
|
||||||
version = "0.1.15"
|
version = "0.1.15"
|
||||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#a3b8df282c684b3f7003ec96f5cea85284e0f1f9"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "123cb47e2780ea8ef3aa67b4db237a27b388d3d3b96db457e274aa4565723151"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
@ -1985,8 +2005,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kittycad-modeling-cmds"
|
name = "kittycad-modeling-cmds"
|
||||||
version = "0.2.7"
|
version = "0.2.10"
|
||||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#a3b8df282c684b3f7003ec96f5cea85284e0f1f9"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b41beb7d9b776df93fd449604de5c447e33c7bd3326fd590002dc18cf5f08166"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
@ -2014,7 +2035,8 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "kittycad-modeling-cmds-macros"
|
name = "kittycad-modeling-cmds-macros"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#a3b8df282c684b3f7003ec96f5cea85284e0f1f9"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "385775cc9d5bf25579f3029824ca1a6e7ab1b7c338e972ec8e8fcefff801f353"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -2023,8 +2045,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kittycad-modeling-session"
|
name = "kittycad-modeling-session"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
source = "git+https://github.com/KittyCAD/modeling-api?branch=main#a3b8df282c684b3f7003ec96f5cea85284e0f1f9"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6ee3a24232a086ec12ae4cfee443485c22e6c6959936d861006fa13bebef0904"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"kittycad",
|
"kittycad",
|
||||||
|
@ -60,11 +60,11 @@ members = [
|
|||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
kittycad = { version = "0.2.63", default-features = false, features = ["js", "requests"] }
|
kittycad = { version = "0.2.63", default-features = false, features = ["js", "requests"] }
|
||||||
kittycad-execution-plan = { git = "https://github.com/KittyCAD/modeling-api", branch = "main" }
|
kittycad-execution-plan = "0.1.3"
|
||||||
kittycad-execution-plan-macros = { git = "https://github.com/KittyCAD/modeling-api", branch = "main" }
|
kittycad-execution-plan-macros = "0.1.9"
|
||||||
kittycad-execution-plan-traits = { git = "https://github.com/KittyCAD/modeling-api", branch = "main" }
|
kittycad-execution-plan-traits = "0.1.14"
|
||||||
kittycad-modeling-cmds = { git = "https://github.com/KittyCAD/modeling-api", branch = "main" }
|
kittycad-modeling-cmds = "0.2.10"
|
||||||
kittycad-modeling-session = { git = "https://github.com/KittyCAD/modeling-api", branch = "main" }
|
kittycad-modeling-session = "0.1.2"
|
||||||
|
|
||||||
[[test]]
|
[[test]]
|
||||||
name = "executor"
|
name = "executor"
|
||||||
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 81 KiB |
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-lib"
|
name = "kcl-lib"
|
||||||
description = "KittyCAD Language implementation and tools"
|
description = "KittyCAD Language implementation and tools"
|
||||||
version = "0.1.46"
|
version = "0.1.47"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
@ -15,11 +15,11 @@ anyhow = { version = "1.0.81", features = ["backtrace"] }
|
|||||||
async-recursion = "1.1.0"
|
async-recursion = "1.1.0"
|
||||||
async-trait = "0.1.79"
|
async-trait = "0.1.79"
|
||||||
chrono = "0.4.37"
|
chrono = "0.4.37"
|
||||||
clap = { version = "4.5.3", features = ["cargo", "derive", "env", "unicode"], optional = true }
|
clap = { version = "4.5.4", features = ["cargo", "derive", "env", "unicode"], optional = true }
|
||||||
dashmap = "5.5.3"
|
dashmap = "5.5.3"
|
||||||
databake = { version = "0.1.7", features = ["derive"] }
|
databake = { version = "0.1.7", features = ["derive"] }
|
||||||
#derive-docs = { version = "0.1.12" }
|
derive-docs = { version = "0.1.12" }
|
||||||
derive-docs = { path = "../derive-docs" }
|
#derive-docs = { path = "../derive-docs" }
|
||||||
futures = { version = "0.3.30" }
|
futures = { version = "0.3.30" }
|
||||||
gltf-json = "1.4.0"
|
gltf-json = "1.4.0"
|
||||||
kittycad = { workspace = true }
|
kittycad = { workspace = true }
|
||||||
|
@ -2649,8 +2649,8 @@ async fn execute_pipe_body(
|
|||||||
source_range: SourceRange,
|
source_range: SourceRange,
|
||||||
ctx: &ExecutorContext,
|
ctx: &ExecutorContext,
|
||||||
) -> Result<MemoryItem, KclError> {
|
) -> Result<MemoryItem, KclError> {
|
||||||
let mut body_iter = body.iter();
|
let mut body = body.iter();
|
||||||
let first = body_iter.next().ok_or_else(|| {
|
let first = body.next().ok_or_else(|| {
|
||||||
KclError::Semantic(KclErrorDetails {
|
KclError::Semantic(KclErrorDetails {
|
||||||
message: "Pipe expressions cannot be empty".to_owned(),
|
message: "Pipe expressions cannot be empty".to_owned(),
|
||||||
source_ranges: vec![source_range],
|
source_ranges: vec![source_range],
|
||||||
|
@ -93,6 +93,7 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
|||||||
} else {
|
} else {
|
||||||
batched_requests
|
batched_requests
|
||||||
};
|
};
|
||||||
|
// println!("Running batch: {final_req:#?}");
|
||||||
|
|
||||||
// Create the map of original command IDs to source range.
|
// Create the map of original command IDs to source range.
|
||||||
// This is for the wasm side, kurt needs it for selections.
|
// This is for the wasm side, kurt needs it for selections.
|
||||||
|
@ -994,9 +994,8 @@ impl ExecutorContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Execute a AST's program.
|
/// Execute an AST's program.
|
||||||
#[async_recursion(?Send)]
|
pub async fn execute_outer(
|
||||||
pub async fn execute(
|
|
||||||
program: crate::ast::types::Program,
|
program: crate::ast::types::Program,
|
||||||
memory: &mut ProgramMemory,
|
memory: &mut ProgramMemory,
|
||||||
_options: BodyType,
|
_options: BodyType,
|
||||||
@ -1013,7 +1012,17 @@ pub async fn execute(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
execute(program, memory, _options, ctx).await
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Execute an AST's program.
|
||||||
|
#[async_recursion(?Send)]
|
||||||
|
pub(crate) async fn execute(
|
||||||
|
program: crate::ast::types::Program,
|
||||||
|
memory: &mut ProgramMemory,
|
||||||
|
_options: BodyType,
|
||||||
|
ctx: &ExecutorContext,
|
||||||
|
) -> Result<ProgramMemory, KclError> {
|
||||||
let pipe_info = PipeInfo::default();
|
let pipe_info = PipeInfo::default();
|
||||||
|
|
||||||
// Iterate over the body of the program.
|
// Iterate over the body of the program.
|
||||||
@ -1299,7 +1308,7 @@ mod tests {
|
|||||||
units: kittycad::types::UnitLength::Mm,
|
units: kittycad::types::UnitLength::Mm,
|
||||||
is_mock: false,
|
is_mock: false,
|
||||||
};
|
};
|
||||||
let memory = execute(program, &mut mem, BodyType::Root, &ctx).await?;
|
let memory = execute_outer(program, &mut mem, BodyType::Root, &ctx).await?;
|
||||||
|
|
||||||
Ok(memory)
|
Ok(memory)
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ pub async fn execute_wasm(
|
|||||||
is_mock,
|
is_mock,
|
||||||
};
|
};
|
||||||
|
|
||||||
let memory = kcl_lib::executor::execute(program, &mut mem, kcl_lib::executor::BodyType::Root, &ctx)
|
let memory = kcl_lib::executor::execute_outer(program, &mut mem, kcl_lib::executor::BodyType::Root, &ctx)
|
||||||
.await
|
.await
|
||||||
.map_err(String::from)?;
|
.map_err(String::from)?;
|
||||||
// The serde-wasm-bindgen does not work here because of weird HashMap issues so we use the
|
// The serde-wasm-bindgen does not work here because of weird HashMap issues so we use the
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
fn make_circle = (face, tag, pos, radius) => {
|
||||||
|
const sg0 = startSketchOn(face, tag)
|
||||||
|
const sg1 = startProfileAt([pos[0] + radius, pos[1]], sg0)
|
||||||
|
const sg2 = arc({
|
||||||
|
angle_end: 360,
|
||||||
|
angle_start: 0,
|
||||||
|
radius: radius
|
||||||
|
}, sg1, 'arc-' + tag)
|
||||||
|
return close(sg2)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn pentagon = (len) => {
|
||||||
|
const sg3 = startSketchOn('XY')
|
||||||
|
const sg4 = startProfileAt([-len / 2, -len / 2], sg3)
|
||||||
|
const sg5 = angledLine({ angle: 0, length: len }, sg4, 'a')
|
||||||
|
const sg6 = angledLine({
|
||||||
|
angle: segAng('a', sg5) + 180 - 108,
|
||||||
|
length: len
|
||||||
|
},sg5, 'b')
|
||||||
|
const sg7 = angledLine({
|
||||||
|
angle: segAng('b', sg6) + 180 - 108,
|
||||||
|
length: len
|
||||||
|
}, sg6, 'c')
|
||||||
|
const sg8 = angledLine({
|
||||||
|
angle: segAng('c', sg7) + 180 - 108,
|
||||||
|
length: len
|
||||||
|
}, sg7, 'd')
|
||||||
|
return angledLine({
|
||||||
|
angle: segAng('d', sg8) + 180 - 108,
|
||||||
|
length: len
|
||||||
|
}, sg8)
|
||||||
|
}
|
||||||
|
|
||||||
|
const p = pentagon(48)
|
||||||
|
const pe = extrude(30, p)
|
||||||
|
|
||||||
|
const plumbus0 = make_circle(pe, 'a', [0, 0], 9)
|
||||||
|
const plumbus1 = extrude(18, plumbus0)
|
||||||
|
const plumbus2 = fillet({
|
||||||
|
radius: 0.5,
|
||||||
|
tags: ['arc-a', getOppositeEdge('arc-a', plumbus1)]
|
||||||
|
}, plumbus1)
|
46
src/wasm-lib/tests/executor/inputs/pentagon_fillet_sugar.kcl
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
fn make_circle = (face, tag, pos, radius) => {
|
||||||
|
const sg = startSketchOn(face, tag)
|
||||||
|
|> startProfileAt([pos[0] + radius, pos[1]], %)
|
||||||
|
|> arc({
|
||||||
|
angle_end: 360,
|
||||||
|
angle_start: 0,
|
||||||
|
radius: radius
|
||||||
|
}, %, 'arc-' + tag)
|
||||||
|
|> close(%)
|
||||||
|
|
||||||
|
return sg
|
||||||
|
}
|
||||||
|
|
||||||
|
fn pentagon = (len) => {
|
||||||
|
const sg = startSketchOn('XY')
|
||||||
|
|> startProfileAt([-len / 2, -len / 2], %)
|
||||||
|
|> angledLine({ angle: 0, length: len }, %, 'a')
|
||||||
|
|> angledLine({
|
||||||
|
angle: segAng('a', %) + 180 - 108,
|
||||||
|
length: len
|
||||||
|
}, %, 'b')
|
||||||
|
|> angledLine({
|
||||||
|
angle: segAng('b', %) + 180 - 108,
|
||||||
|
length: len
|
||||||
|
}, %, 'c')
|
||||||
|
|> angledLine({
|
||||||
|
angle: segAng('c', %) + 180 - 108,
|
||||||
|
length: len
|
||||||
|
}, %, 'd')
|
||||||
|
|> angledLine({
|
||||||
|
angle: segAng('d', %) + 180 - 108,
|
||||||
|
length: len
|
||||||
|
}, %)
|
||||||
|
|
||||||
|
return sg
|
||||||
|
}
|
||||||
|
|
||||||
|
const p = pentagon(48)
|
||||||
|
|> extrude(30, %)
|
||||||
|
|
||||||
|
const plumbus0 = make_circle(p, 'a', [0, 0], 9)
|
||||||
|
|> extrude(18, %)
|
||||||
|
|> fillet({
|
||||||
|
radius: 0.5,
|
||||||
|
tags: ['arc-a', getOppositeEdge('arc-a', %)]
|
||||||
|
}, %)
|
17
src/wasm-lib/tests/executor/inputs/riddle_small.kcl
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
const ANSWER = 41803
|
||||||
|
|
||||||
|
fn m = (s) => {
|
||||||
|
return (ANSWER * s + 12345) % 214748
|
||||||
|
}
|
||||||
|
|
||||||
|
let xs = 205804
|
||||||
|
let ys = 71816
|
||||||
|
let ox = 35 - (m(xs) % 70)
|
||||||
|
let oy = 35 - (m(ys) % 70)
|
||||||
|
const r = startSketchOn('XZ')
|
||||||
|
|> startProfileAt([ox, oy], %)
|
||||||
|
|> line([1, 0], %)
|
||||||
|
|> line([0, -1], %)
|
||||||
|
|> line([-1, 0], %)
|
||||||
|
|> close(%)
|
||||||
|
|> extrude(1, %)
|
@ -41,7 +41,7 @@ async fn execute_and_snapshot(code: &str, units: kittycad::types::UnitLength) ->
|
|||||||
let mut mem: kcl_lib::executor::ProgramMemory = Default::default();
|
let mut mem: kcl_lib::executor::ProgramMemory = Default::default();
|
||||||
let ctx = kcl_lib::executor::ExecutorContext::new(ws, units.clone()).await?;
|
let ctx = kcl_lib::executor::ExecutorContext::new(ws, units.clone()).await?;
|
||||||
|
|
||||||
let _ = kcl_lib::executor::execute(program, &mut mem, kcl_lib::executor::BodyType::Root, &ctx).await?;
|
let _ = kcl_lib::executor::execute_outer(program, &mut mem, kcl_lib::executor::BodyType::Root, &ctx).await?;
|
||||||
|
|
||||||
let (x, y) = kcl_lib::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
let (x, y) = kcl_lib::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||||
|
|
||||||
@ -112,6 +112,33 @@ const part002 = startSketchOn(part001, "here")
|
|||||||
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face.png", &result, 0.999);
|
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face.png", &result, 0.999);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn serial_test_riddle_small() {
|
||||||
|
let code = include_str!("inputs/riddle_small.kcl");
|
||||||
|
let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
twenty_twenty::assert_image("tests/executor/outputs/riddle_small.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");
|
||||||
|
let result = execute_and_snapshot(code, kittycad::types::UnitLength::Cm)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
twenty_twenty::assert_image("tests/executor/outputs/pentagon_fillet_desugar.png", &result, 0.999);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn serial_test_pentagon_fillet_sugar() {
|
||||||
|
let code = include_str!("inputs/pentagon_fillet_sugar.kcl");
|
||||||
|
let result = execute_and_snapshot(code, kittycad::types::UnitLength::Cm)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
twenty_twenty::assert_image("tests/executor/outputs/pentagon_fillet_sugar.png", &result, 0.999);
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn serial_test_sketch_on_face_start() {
|
async fn serial_test_sketch_on_face_start() {
|
||||||
let code = r#"fn cube = (pos, scale) => {
|
let code = r#"fn cube = (pos, scale) => {
|
||||||
@ -1839,3 +1866,66 @@ const part002 = startSketchOn(part001, 'end')
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
twenty_twenty::assert_image("tests/executor/outputs/simple_revolve_sketch_on_edge.png", &result, 1.0);
|
twenty_twenty::assert_image("tests/executor/outputs/simple_revolve_sketch_on_edge.png", &result, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn serial_test_plumbus_fillets() {
|
||||||
|
let code = r#"fn make_circle = (face, tag, pos, radius) => {
|
||||||
|
const sg = startSketchOn(face, tag)
|
||||||
|
|> startProfileAt([pos[0] + radius, pos[1]], %)
|
||||||
|
|> arc({
|
||||||
|
angle_end: 360,
|
||||||
|
angle_start: 0,
|
||||||
|
radius: radius
|
||||||
|
}, %, 'arc-' + tag)
|
||||||
|
|> close(%)
|
||||||
|
|
||||||
|
return sg
|
||||||
|
}
|
||||||
|
|
||||||
|
fn pentagon = (len) => {
|
||||||
|
const sg = startSketchOn('XY')
|
||||||
|
|> startProfileAt([-len / 2, -len / 2], %)
|
||||||
|
|> angledLine({ angle: 0, length: len }, %, 'a')
|
||||||
|
|> angledLine({
|
||||||
|
angle: segAng('a', %) + 180 - 108,
|
||||||
|
length: len
|
||||||
|
}, %, 'b')
|
||||||
|
|> angledLine({
|
||||||
|
angle: segAng('b', %) + 180 - 108,
|
||||||
|
length: len
|
||||||
|
}, %, 'c')
|
||||||
|
|> angledLine({
|
||||||
|
angle: segAng('c', %) + 180 - 108,
|
||||||
|
length: len
|
||||||
|
}, %, 'd')
|
||||||
|
|> angledLine({
|
||||||
|
angle: segAng('d', %) + 180 - 108,
|
||||||
|
length: len
|
||||||
|
}, %)
|
||||||
|
|
||||||
|
return sg
|
||||||
|
}
|
||||||
|
|
||||||
|
const p = pentagon(8)
|
||||||
|
|> extrude(5, %)
|
||||||
|
|
||||||
|
const plumbus0 = make_circle(p, 'a', [0, 0], 1.5)
|
||||||
|
|> extrude(3, %)
|
||||||
|
|> fillet({
|
||||||
|
radius: 0.5,
|
||||||
|
tags: ['arc-a', getOppositeEdge('arc-a', %)]
|
||||||
|
}, %)
|
||||||
|
|
||||||
|
// const plumbus1 = make_circle(p, 'b', [0, 0], 1.5)
|
||||||
|
// |> extrude(3, %)
|
||||||
|
// |> fillet({
|
||||||
|
// radius: 0.5,
|
||||||
|
// tags: ['arc-b', getOppositeEdge('arc-b', %)]
|
||||||
|
// }, %)
|
||||||
|
"#;
|
||||||
|
|
||||||
|
let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
twenty_twenty::assert_image("tests/executor/outputs/plumbus_fillets.png", &result, 1.0);
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 101 KiB |
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 149 KiB After Width: | Height: | Size: 145 KiB |
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 142 KiB |
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 96 KiB |
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 127 KiB |
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 101 KiB |
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 127 KiB After Width: | Height: | Size: 126 KiB |
Before Width: | Height: | Size: 127 KiB After Width: | Height: | Size: 126 KiB |
Before Width: | Height: | Size: 125 KiB After Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 106 KiB |
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 125 KiB After Width: | Height: | Size: 123 KiB |
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 107 KiB |
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 119 KiB |
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 101 KiB |
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 109 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 95 KiB |
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 95 KiB |
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 116 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
BIN
src/wasm-lib/tests/executor/outputs/pentagon_fillet_desugar.png
Normal file
After Width: | Height: | Size: 159 KiB |
BIN
src/wasm-lib/tests/executor/outputs/pentagon_fillet_sugar.png
Normal file
After Width: | Height: | Size: 159 KiB |
BIN
src/wasm-lib/tests/executor/outputs/plumbus_fillets.png
Normal file
After Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 99 KiB |
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 114 KiB |
Before Width: | Height: | Size: 117 KiB After Width: | Height: | Size: 112 KiB |
BIN
src/wasm-lib/tests/executor/outputs/riddle_small.png
Normal file
After Width: | Height: | Size: 92 KiB |
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 99 KiB |
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 112 KiB |
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 106 KiB |
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 106 KiB |
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 112 KiB |
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 108 KiB |
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 108 KiB |
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 108 KiB |
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 104 KiB |
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 106 KiB |