Compare commits
42 Commits
pierremtb/
...
nrc-std-kw
| Author | SHA1 | Date | |
|---|---|---|---|
| 32572c8ae7 | |||
| e0e707ad85 | |||
| 0913d3ebdc | |||
| c545ad71c6 | |||
| a70718687f | |||
| 85cd29424e | |||
| df1ff68a6d | |||
| 2678d1014e | |||
| cd59691663 | |||
| d7369d8a95 | |||
| ce98218bf0 | |||
| 2d43399703 | |||
| 461a2c3ab2 | |||
| 79be72c5f0 | |||
| 9ddb4e629f | |||
| 25e8e7081b | |||
| c5164cbee3 | |||
| 809b333248 | |||
| a933646667 | |||
| 98a68f5cd9 | |||
| 33dc254e43 | |||
| b54295f2f7 | |||
| a7e09a89ef | |||
| 4b6166dc4f | |||
| e7d00f148b | |||
| d19a7df7e8 | |||
| 45fae52afc | |||
| 270f173aad | |||
| ddcff1ba63 | |||
| cb1b08d6b6 | |||
| 533fa749b2 | |||
| af492d2cb6 | |||
| 26fba71abf | |||
| 859bfc7b28 | |||
| 3b1d1307c4 | |||
| f5a2c84ce2 | |||
| cccb71fd30 | |||
| 44be072d04 | |||
| 86beb6ebf1 | |||
| 6d72104faa | |||
| f2c5661710 | |||
| ecb2359bc5 |
@ -22,6 +22,13 @@
|
||||
"rules": {
|
||||
"@typescript-eslint/no-floating-promises": "error",
|
||||
"@typescript-eslint/no-misused-promises": "error",
|
||||
"@typescript-eslint/no-unused-vars": ["error", {
|
||||
"varsIgnorePattern": "^_",
|
||||
"argsIgnorePattern": "^_",
|
||||
"ignoreRestSiblings": true,
|
||||
"vars": "all",
|
||||
"args": "none"
|
||||
}],
|
||||
"jsx-a11y/click-events-have-key-events": "off",
|
||||
"jsx-a11y/no-autofocus": "off",
|
||||
"jsx-a11y/no-noninteractive-element-interactions": "off",
|
||||
|
||||
9
.github/workflows/cargo-test.yml
vendored
@ -100,9 +100,14 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd rust
|
||||
pushd rust
|
||||
just overwrite-sim-test kcl_samples
|
||||
git add kcl-lib/tests
|
||||
popd
|
||||
git add \
|
||||
rust/kcl-lib/tests \
|
||||
public/kcl-samples/manifest.json \
|
||||
public/kcl-samples/README.md \
|
||||
public/kcl-samples/screenshots
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
|
||||
|
||||
54
.github/workflows/e2e-tests.yml
vendored
@ -75,7 +75,7 @@ jobs:
|
||||
|
||||
prepare-wasm:
|
||||
# seperate job on Ubuntu to build or fetch the wasm blob once on the fastest runner
|
||||
runs-on: namespace-profile-ubuntu-8-cores
|
||||
runs-on: runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64
|
||||
needs: conditions
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@ -163,7 +163,7 @@ jobs:
|
||||
|
||||
snapshots:
|
||||
name: playwright:snapshots:ubuntu
|
||||
runs-on: namespace-profile-ubuntu-8-cores
|
||||
runs-on: runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64
|
||||
needs: [conditions, prepare-wasm]
|
||||
steps:
|
||||
- uses: actions/create-github-app-token@v1
|
||||
@ -237,19 +237,14 @@ jobs:
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
|
||||
with:
|
||||
name: playwright-report-snapshots-${{ matrix.os }}-snapshot-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||
name: playwright-report-ubuntu-snapshot-${{ github.sha }}
|
||||
path: playwright-report/
|
||||
include-hidden-files: true
|
||||
retention-days: 30
|
||||
overwrite: true
|
||||
|
||||
- name: Clean up test-results
|
||||
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
|
||||
continue-on-error: true
|
||||
run: rm -r test-results
|
||||
|
||||
- name: check for changes
|
||||
if: ${{ needs.conditions.outputs.should-run == 'true' && matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 && github.ref != 'refs/heads/main' }}
|
||||
if: ${{ needs.conditions.outputs.should-run == 'true' && github.ref != 'refs/heads/main' }}
|
||||
shell: bash
|
||||
id: git-check
|
||||
run: |
|
||||
@ -270,31 +265,26 @@ jobs:
|
||||
git fetch origin
|
||||
echo ${{ github.head_ref }}
|
||||
git checkout ${{ github.head_ref }}
|
||||
git commit -m "A snapshot a day keeps the bugs away! 📷🐛 (OS: ${{matrix.os}})" || true
|
||||
git commit -m "A snapshot a day keeps the bugs away! 📷🐛" || true
|
||||
git push
|
||||
git push origin ${{ github.head_ref }}
|
||||
|
||||
# only upload artifacts if there's actually changes
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.git-check.outputs.modified == 'true' }}
|
||||
with:
|
||||
name: playwright-report-ubuntu-${{ github.sha }}
|
||||
path: playwright-report/
|
||||
include-hidden-files: true
|
||||
retention-days: 30
|
||||
|
||||
|
||||
electron:
|
||||
needs: [conditions, prepare-wasm]
|
||||
timeout-minutes: 60
|
||||
name: playwright:electron:${{ matrix.os }} ${{ matrix.shardIndex }} ${{ matrix.shardTotal }}
|
||||
env:
|
||||
OS_NAME: ${{ contains(matrix.os, 'ubuntu') && 'ubuntu' || (contains(matrix.os, 'windows') && 'windows' || 'macos') }}
|
||||
name: playwright:electron:${{ contains(matrix.os, 'ubuntu') && 'ubuntu' || (contains(matrix.os, 'windows') && 'windows' || 'macos') }}:${{ matrix.shardIndex }}:${{ matrix.shardTotal }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# TODO: enable namespace-profile-windows-8-cores once available
|
||||
os: [namespace-profile-ubuntu-8-cores, namespace-profile-macos-8-cores, windows-16-cores]
|
||||
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8]
|
||||
shardTotal: [8]
|
||||
# TODO: enable namespace-profile-windows-latest once available
|
||||
os:
|
||||
- "runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64"
|
||||
- namespace-profile-macos-8-cores
|
||||
- windows-latest
|
||||
shardIndex: [1, 2, 3, 4]
|
||||
shardTotal: [4]
|
||||
# Disable macos and windows tests on hourly e2e tests since we only care
|
||||
# about server side changes.
|
||||
# Technique from https://github.com/joaomcteixeira/python-project-skeleton/pull/31/files
|
||||
@ -303,7 +293,7 @@ jobs:
|
||||
exclude:
|
||||
- os: namespace-profile-macos-8-cores
|
||||
isScheduled: true
|
||||
- os: windows-16-cores
|
||||
- os: windows-latest
|
||||
isScheduled: true
|
||||
# TODO: add ref here for main and latest release tag
|
||||
runs-on: ${{ matrix.os }}
|
||||
@ -335,6 +325,7 @@ jobs:
|
||||
run: yarn
|
||||
|
||||
- name: Cache Playwright Browsers
|
||||
if: needs.conditions.outputs.should-run == 'true'
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
@ -342,6 +333,7 @@ jobs:
|
||||
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
|
||||
|
||||
- name: Install Playwright Browsers
|
||||
if: needs.conditions.outputs.should-run == 'true'
|
||||
run: yarn playwright install --with-deps
|
||||
|
||||
- name: Build web
|
||||
@ -361,7 +353,7 @@ jobs:
|
||||
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||
name: test-results-${{ env.OS_NAME }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||
path: test-results/
|
||||
|
||||
- name: Run playwright/electron flow (with retries)
|
||||
@ -370,8 +362,8 @@ jobs:
|
||||
uses: nick-fields/retry@v3.0.2
|
||||
with:
|
||||
shell: bash
|
||||
command: .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}}
|
||||
timeout_minutes: 30
|
||||
command: .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{ env.OS_NAME }}
|
||||
timeout_minutes: 45
|
||||
max_attempts: 15
|
||||
env:
|
||||
CI: true
|
||||
@ -384,7 +376,7 @@ jobs:
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ needs.conditions.outputs.should-run == 'true' && always() }}
|
||||
with:
|
||||
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||
name: test-results-${{ env.OS_NAME }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||
path: test-results/
|
||||
include-hidden-files: true
|
||||
retention-days: 30
|
||||
@ -393,7 +385,7 @@ jobs:
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ needs.conditions.outputs.should-run == 'true' && always() }}
|
||||
with:
|
||||
name: playwright-report-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||
name: playwright-report-${{ env.OS_NAME }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||
path: playwright-report/
|
||||
include-hidden-files: true
|
||||
retention-days: 30
|
||||
|
||||
2
Makefile
@ -4,7 +4,7 @@ KCL_WASM_LIB_FILES := $(wildcard rust/**/*.rs)
|
||||
TS_SRC := $(wildcard src/**/*.tsx) $(wildcard src/**/*.ts)
|
||||
XSTATE_TYPEGENS := $(wildcard src/machines/*.typegen.ts)
|
||||
|
||||
dev: node_modules public/wasm_lib_bg.wasm $(XSTATE_TYPEGENS)
|
||||
dev: node_modules public/kcl_wasm_lib_bg.wasm $(XSTATE_TYPEGENS)
|
||||
yarn start
|
||||
|
||||
# I'm sorry this is so specific to my setup you may as well ignore this.
|
||||
|
||||
10
README.md
@ -105,7 +105,7 @@ Finally, to run the web app only, run:
|
||||
yarn start
|
||||
```
|
||||
|
||||
If you're not a Zoo employee you won't be able to access the dev environment, you should copy everything from `.env.production` to `.env.development` to make it point to production instead, then when you navigate to `localhost:3000` the easiest way to sign in is to paste `localStorage.setItem('TOKEN_PERSIST_KEY', "your-token-from-https://zoo.dev/account/api-tokens")` replacing the with a real token from https://zoo.dev/account/api-tokens of course, then navigate to localhost:3000 again. Note that navigating to `localhost:3000/signin` removes your token so you will need to set the token again.
|
||||
If you're not a Zoo employee you won't be able to access the dev environment, you should copy everything from `.env.production` to `.env.development.local` to make it point to production instead, then when you navigate to `localhost:3000` the easiest way to sign in is to paste `localStorage.setItem('TOKEN_PERSIST_KEY', "your-token-from-https://zoo.dev/account/api-tokens")` replacing the with a real token from https://zoo.dev/account/api-tokens of course, then navigate to `localhost:3000` again. Note that navigating to `localhost:3000/signin` removes your token so you will need to set the token again.
|
||||
|
||||
### Development environment variables
|
||||
|
||||
@ -122,7 +122,7 @@ Third-Party Cookies".
|
||||
|
||||
## Desktop
|
||||
|
||||
To spin up the desktop app, `yarn install` and `yarn build:wasm` need to have been done before hand then
|
||||
To spin up the desktop app, `yarn install` and `yarn build:wasm` need to have been done before hand then:
|
||||
|
||||
```
|
||||
yarn tron:start
|
||||
@ -130,13 +130,13 @@ yarn tron:start
|
||||
|
||||
This will start the application and hot-reload on changes.
|
||||
|
||||
Devtools can be opened with the usual Cmd-Opt-I (Mac) or Ctrl-Shift-I (Linux and Windows).
|
||||
Devtools can be opened with the usual Command-Option-I (macOS) or Ctrl-Shift-I (Linux and Windows).
|
||||
|
||||
To package the app for your platform with electron-builder, run `yarn tronb:package:dev` (or `yarn tronb:package:prod` to point to the .env.production variables)
|
||||
To package the app for your platform with electron-builder, run `yarn tronb:package:dev` (or `yarn tronb:package:prod` to point to the .env.production variables).
|
||||
|
||||
## Checking out commits / Bisecting
|
||||
|
||||
Which commands from setup are one off vs need to be run every time?
|
||||
Which commands from setup are one off vs. need to be run every time?
|
||||
|
||||
The following will need to be run when checking out a new commit and guarantees the build is not stale:
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ example = extrude(exampleSketch, length = 5)
|
||||
// Add color to a revolved solid.
|
||||
sketch001 = startSketchOn('XY')
|
||||
|> circle(center = [15, 0], radius = 5)
|
||||
|> revolve({ angle = 360, axis = 'y' }, %)
|
||||
|> revolve(angle = 360, axis = 'y')
|
||||
|> appearance(color = '#ff0000', metalness = 90, roughness = 90)
|
||||
```
|
||||
|
||||
@ -184,7 +184,6 @@ example = extrude(exampleSketch, length = 1)
|
||||
```js
|
||||
// Color the result of a sweep.
|
||||
|
||||
|
||||
// Create a path for the sweep.
|
||||
sweepPath = startSketchOn('XZ')
|
||||
|> startProfileAt([0.05, 0.05], %)
|
||||
|
||||
@ -15,7 +15,7 @@ std::math::E: number = 2.71828182845904523536028747135266250_
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn("XZ")
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> angledLine({
|
||||
angle = 30,
|
||||
|
||||
@ -17,7 +17,7 @@ std::math::PI: number = 3.14159265358979323846264338327950288_
|
||||
```js
|
||||
circumference = 70
|
||||
|
||||
exampleSketch = startSketchOn("XZ")
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> circle(center = [0, 0], radius = circumference/ (2 * PI))
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
@ -15,7 +15,7 @@ std::math::TAU: number = 6.28318530717958647692528676655900577_
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn("XZ")
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> angledLine({
|
||||
angle = 50,
|
||||
|
||||
@ -12,6 +12,8 @@ You can provide more than one sketch to extrude, and they will all be extruded i
|
||||
extrude(
|
||||
sketches: [Sketch],
|
||||
length: number,
|
||||
tagStart?: TagDeclarator,
|
||||
tagEnd?: TagDeclarator,
|
||||
): [Solid]
|
||||
```
|
||||
|
||||
@ -22,6 +24,8 @@ extrude(
|
||||
|----------|------|-------------|----------|
|
||||
| `sketches` | [`[Sketch]`](/docs/kcl/types/Sketch) | Which sketch or sketches should be extruded | Yes |
|
||||
| `length` | [`number`](/docs/kcl/types/number) | How far to extrude the given sketches | Yes |
|
||||
| `tagStart` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | A named tag for the face at the start of the extrusion, i.e. the original sketch | No |
|
||||
| `tagEnd` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | A named tag for the face at the end of the extrusion, i.e. the new face created by extruding the original sketch | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
||||
54
docs/kcl/getCommonEdge.md
Normal file
@ -22,8 +22,12 @@ layout: manual
|
||||
* [`string`](kcl/types/string)
|
||||
* [`tag`](kcl/types/tag)
|
||||
* **std**
|
||||
* [`Face`](kcl/types/Face)
|
||||
* [`HALF_TURN`](kcl/consts/std-HALF_TURN)
|
||||
* [`Helix`](kcl/types/Helix)
|
||||
* [`Plane`](kcl/types/Plane)
|
||||
* [`Point2d`](kcl/types/Point2d)
|
||||
* [`Point3d`](kcl/types/Point3d)
|
||||
* [`QUARTER_TURN`](kcl/consts/std-QUARTER_TURN)
|
||||
* [`Sketch`](kcl/types/Sketch)
|
||||
* [`Solid`](kcl/types/Solid)
|
||||
@ -57,7 +61,6 @@ layout: manual
|
||||
* [`bezierCurve`](kcl/bezierCurve)
|
||||
* [`ceil`](kcl/ceil)
|
||||
* [`chamfer`](kcl/chamfer)
|
||||
* [`circle`](kcl/circle)
|
||||
* [`circleThreePoint`](kcl/circleThreePoint)
|
||||
* [`close`](kcl/close)
|
||||
* [`cm`](kcl/cm)
|
||||
@ -65,6 +68,7 @@ layout: manual
|
||||
* [`fillet`](kcl/fillet)
|
||||
* [`floor`](kcl/floor)
|
||||
* [`ft`](kcl/ft)
|
||||
* [`getCommonEdge`](kcl/getCommonEdge)
|
||||
* [`getNextAdjacentEdge`](kcl/getNextAdjacentEdge)
|
||||
* [`getOppositeEdge`](kcl/getOppositeEdge)
|
||||
* [`getPreviousAdjacentEdge`](kcl/getPreviousAdjacentEdge)
|
||||
@ -141,3 +145,5 @@ layout: manual
|
||||
* [`cos`](kcl/std-math-cos)
|
||||
* [`sin`](kcl/std-math-sin)
|
||||
* [`tan`](kcl/std-math-tan)
|
||||
* **std::sketch**
|
||||
* [`circle`](kcl/std-sketch-circle)
|
||||
|
||||
50
docs/kcl/intersect.md
Normal file
@ -15,6 +15,8 @@ loft(
|
||||
bezApproximateRational: bool,
|
||||
baseCurveIndex?: integer,
|
||||
tolerance?: number,
|
||||
tagStart?: TagDeclarator,
|
||||
tagEnd?: TagDeclarator,
|
||||
): Solid
|
||||
```
|
||||
|
||||
@ -28,6 +30,8 @@ loft(
|
||||
| `bezApproximateRational` | [`bool`](/docs/kcl/types/bool) | Attempt to approximate rational curves (such as arcs) using a bezier. This will remove banding around interpolations between arcs and non-arcs. It may produce errors in other scenarios Over time, this field won't be necessary. | Yes |
|
||||
| `baseCurveIndex` | `integer` | This can be set to override the automatically determined topological base curve, which is usually the first section encountered. | No |
|
||||
| `tolerance` | [`number`](/docs/kcl/types/number) | Tolerance for the loft operation. | No |
|
||||
| `tagStart` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | A named tag for the face at the start of the loft, i.e. the original sketch | No |
|
||||
| `tagEnd` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | A named tag for the face at the end of the loft, i.e. the last sketch | No |
|
||||
|
||||
### Returns
|
||||
|
||||
|
||||
@ -52,7 +52,6 @@ fn sum(arr):
|
||||
sumSoFar = add(sumSoFar, i)
|
||||
return sumSoFar */
|
||||
|
||||
|
||||
// We use `assertEqual` to check that our `sum` function gives the
|
||||
// expected result. It's good to check your work!
|
||||
assertEqual(sum([1, 2, 3]), 6, 0.00001, "1 + 2 + 3 summed is 6")
|
||||
@ -114,7 +113,6 @@ fn decagon(radius):
|
||||
fullDecagon = partialDecagon // it's now full
|
||||
return fullDecagon */
|
||||
|
||||
|
||||
// Use the `decagon` function declared above, to sketch a decagon with radius 5.
|
||||
decagon(5.0)
|
||||
|> close()
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
---
|
||||
title: "scale"
|
||||
excerpt: "Scale a solid."
|
||||
excerpt: "Scale a solid or a sketch."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Scale a solid.
|
||||
Scale a solid or a sketch.
|
||||
|
||||
By default the transform is applied in local sketch axis, therefore the origin will not move.
|
||||
|
||||
@ -12,10 +12,10 @@ If you want to apply the transform in global space, set `global` to `true`. The
|
||||
|
||||
```js
|
||||
scale(
|
||||
solids: SolidOrImportedGeometry,
|
||||
objects: SolidOrSketchOrImportedGeometry,
|
||||
scale: [number],
|
||||
global?: bool,
|
||||
): SolidOrImportedGeometry
|
||||
): SolidOrSketchOrImportedGeometry
|
||||
```
|
||||
|
||||
|
||||
@ -23,13 +23,13 @@ scale(
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `solids` | [`SolidOrImportedGeometry`](/docs/kcl/types/SolidOrImportedGeometry) | The solid or set of solids to scale. | Yes |
|
||||
| `objects` | [`SolidOrSketchOrImportedGeometry`](/docs/kcl/types/SolidOrSketchOrImportedGeometry) | The solid, sketch, or set of solids or sketches to scale. | Yes |
|
||||
| `scale` | [`[number]`](/docs/kcl/types/number) | The scale factor for the x, y, and z axes. | Yes |
|
||||
| `global` | [`bool`](/docs/kcl/types/bool) | If true, the transform is applied in global space. The origin of the model will move. By default, the transform is applied in local sketch axis, therefore the origin will not move. | No |
|
||||
|
||||
### Returns
|
||||
|
||||
[`SolidOrImportedGeometry`](/docs/kcl/types/SolidOrImportedGeometry) - Data for a solid or an imported geometry.
|
||||
[`SolidOrSketchOrImportedGeometry`](/docs/kcl/types/SolidOrSketchOrImportedGeometry) - Data for a solid or an imported geometry.
|
||||
|
||||
|
||||
### Examples
|
||||
@ -37,7 +37,6 @@ scale(
|
||||
```js
|
||||
// Scale a pipe.
|
||||
|
||||
|
||||
// Create a path for the sweep.
|
||||
sweepPath = startSketchOn('XZ')
|
||||
|> startProfileAt([0.05, 0.05], %)
|
||||
|
||||
@ -9,7 +9,7 @@ Compute the cosine of a number (in radians).
|
||||
|
||||
|
||||
```js
|
||||
cos(num: number(rad)): number(_)
|
||||
cos(@num: number(rad)): number(_)
|
||||
```
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ cos(num: number(rad)): number(_)
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn("XZ")
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> angledLine({
|
||||
angle = 30,
|
||||
|
||||
@ -9,7 +9,7 @@ Compute the sine of a number (in radians).
|
||||
|
||||
|
||||
```js
|
||||
sin(num: number(rad)): number(_)
|
||||
sin(@num: number(rad)): number(_)
|
||||
```
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ sin(num: number(rad)): number(_)
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn("XZ")
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> angledLine({
|
||||
angle = 50,
|
||||
|
||||
@ -9,7 +9,7 @@ Compute the tangent of a number (in radians).
|
||||
|
||||
|
||||
```js
|
||||
tan(num: number(rad)): number(_)
|
||||
tan(@num: number(rad)): number(_)
|
||||
```
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ tan(num: number(rad)): number(_)
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn("XZ")
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> angledLine({
|
||||
angle = 50,
|
||||
|
||||
55
docs/kcl/std-sketch-circle.md
Normal file
38020
docs/kcl/std.json
56
docs/kcl/subtract.md
Normal file
@ -16,6 +16,8 @@ sweep(
|
||||
path: SweepPath,
|
||||
sectional?: bool,
|
||||
tolerance?: number,
|
||||
tagStart?: TagDeclarator,
|
||||
tagEnd?: TagDeclarator,
|
||||
): [Solid]
|
||||
```
|
||||
|
||||
@ -28,6 +30,8 @@ sweep(
|
||||
| `path` | [`SweepPath`](/docs/kcl/types/SweepPath) | The path to sweep the sketch along | Yes |
|
||||
| `sectional` | [`bool`](/docs/kcl/types/bool) | If true, the sweep will be broken up into sub-sweeps (extrusions, revolves, sweeps) based on the trajectory path components. | No |
|
||||
| `tolerance` | [`number`](/docs/kcl/types/number) | Tolerance for this operation | No |
|
||||
| `tagStart` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | A named tag for the face at the start of the sweep, i.e. the original sketch | No |
|
||||
| `tagEnd` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | A named tag for the face at the end of the sweep | No |
|
||||
|
||||
### Returns
|
||||
|
||||
@ -39,7 +43,6 @@ sweep(
|
||||
```js
|
||||
// Create a pipe using a sweep.
|
||||
|
||||
|
||||
// Create a path for the sweep.
|
||||
sweepPath = startSketchOn('XZ')
|
||||
|> startProfileAt([0.05, 0.05], %)
|
||||
@ -64,7 +67,6 @@ sweepSketch = startSketchOn('XY')
|
||||
```js
|
||||
// Create a spring by sweeping around a helix path.
|
||||
|
||||
|
||||
// Create a helix around the Z axis.
|
||||
helixPath = helix(
|
||||
angleStart = 0,
|
||||
|
||||
@ -1,28 +1,12 @@
|
||||
---
|
||||
title: "Face"
|
||||
title: "std::Face"
|
||||
excerpt: "A face."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
A face.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `id` |[`string`](/docs/kcl/types/string)| The id of the face. | No |
|
||||
| `artifactId` |[`ArtifactId`](/docs/kcl/types/ArtifactId)| The artifact ID. | No |
|
||||
| `value` |[`string`](/docs/kcl/types/string)| The tag of the face. | No |
|
||||
| `xAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the face's X axis be? | No |
|
||||
| `yAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the face's Y axis be? | No |
|
||||
| `zAxis` |[`Point3d`](/docs/kcl/types/Point3d)| The z-axis (normal). | No |
|
||||
| `solid` |[`Solid`](/docs/kcl/types/Solid)| The solid the face is on. | No |
|
||||
| `units` |[`UnitLen`](/docs/kcl/types/UnitLen)| A unit of length. | No |
|
||||
|
||||
|
||||
|
||||
@ -1,26 +1,12 @@
|
||||
---
|
||||
title: "Helix"
|
||||
title: "std::Helix"
|
||||
excerpt: "A helix."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
A helix.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `value` |[`string`](/docs/kcl/types/string)| The id of the helix. | No |
|
||||
| `artifactId` |[`ArtifactId`](/docs/kcl/types/ArtifactId)| The artifact ID. | No |
|
||||
| `revolutions` |[`number`](/docs/kcl/types/number)| Number of revolutions. | No |
|
||||
| `angleStart` |[`number`](/docs/kcl/types/number)| Start angle (in degrees). | No |
|
||||
| `ccw` |`boolean`| Is the helix rotation counter clockwise? | No |
|
||||
| `units` |[`UnitLen`](/docs/kcl/types/UnitLen)| A unit of length. | No |
|
||||
|
||||
|
||||
|
||||
@ -188,7 +188,7 @@ Any KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`Face`](/docs/kcl/types/Face)| | No |
|
||||
| `value` |[`Face`](/docs/kcl/types/Face)| A face. | No |
|
||||
| `value` |[`Face`](/docs/kcl/types/Face)| | No |
|
||||
|
||||
|
||||
----
|
||||
@ -236,7 +236,7 @@ Any KCL value.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: [`Helix`](/docs/kcl/types/Helix)| | No |
|
||||
| `value` |[`Helix`](/docs/kcl/types/Helix)| A helix. | No |
|
||||
| `value` |[`Helix`](/docs/kcl/types/Helix)| | No |
|
||||
|
||||
|
||||
----
|
||||
|
||||
17
docs/kcl/types/Point2d.md
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
title: "std::Point2d"
|
||||
excerpt: "A point in two dimensional space."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
A point in two dimensional space.
|
||||
|
||||
```kcl
|
||||
type Point2d = [number; 2]
|
||||
```
|
||||
|
||||
[`Point2d`](/docs/kcl/types/Point2d) is an alias for a two-element array of [number](/docs/kcl/types/number)s. To write a value
|
||||
with type [`Point2d`](/docs/kcl/types/Point2d), use an array, e.g., `[0, 0]` or `[5.0, 3.14]`.
|
||||
|
||||
|
||||
|
||||
@ -1,22 +1,17 @@
|
||||
---
|
||||
title: "Point3d"
|
||||
excerpt: ""
|
||||
title: "std::Point3d"
|
||||
excerpt: "A point in three dimensional space."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
A point in three dimensional space.
|
||||
|
||||
**Type:** `object`
|
||||
```kcl
|
||||
type Point3d = [number; 3]
|
||||
```
|
||||
|
||||
[`Point3d`](/docs/kcl/types/Point3d) is an alias for a three-element array of [number](/docs/kcl/types/number)s. To write a value
|
||||
with type [`Point3d`](/docs/kcl/types/Point3d), use an array, e.g., `[0, 0, 0]` or `[5.0, 3.14, 6.8]`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `x` |[`number`](/docs/kcl/types/number)| | No |
|
||||
| `y` |[`number`](/docs/kcl/types/number)| | No |
|
||||
| `z` |[`number`](/docs/kcl/types/number)| | No |
|
||||
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ mySketch = startSketchOn('XY')
|
||||
|> close()
|
||||
```
|
||||
|
||||
The `mySketch` variable will be an executed `Sketch` object. Executed being past
|
||||
The `mySketch` variable will be an executed [`Sketch`](/docs/kcl/types/Sketch) object. Executed being past
|
||||
tense, because the engine has already executed the commands to create the sketch.
|
||||
|
||||
The previous sketch commands will never be executed again, in this case.
|
||||
|
||||
@ -18,7 +18,7 @@ myPart = startSketchOn('XY')
|
||||
|> extrude(length = 6)
|
||||
```
|
||||
|
||||
The `myPart` variable will be an executed `Solid` object. Executed being past
|
||||
The `myPart` variable will be an executed [`Solid`](/docs/kcl/types/Solid) object. Executed being past
|
||||
tense, because the engine has already executed the commands to create the solid.
|
||||
|
||||
The previous solid commands will never be executed again, in this case.
|
||||
|
||||
66
docs/kcl/types/SolidOrSketchOrImportedGeometry.md
Normal file
@ -0,0 +1,66 @@
|
||||
---
|
||||
title: "SolidOrSketchOrImportedGeometry"
|
||||
excerpt: "Data for a solid or an imported geometry."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Data for a solid or an imported geometry.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
Data for an imported geometry.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `importedGeometry`| | No |
|
||||
| `id` |[`string`](/docs/kcl/types/string)| The ID of the imported geometry. | No |
|
||||
| `value` |`[` [`string`](/docs/kcl/types/string) `]`| The original file paths. | No |
|
||||
|
||||
|
||||
----
|
||||
|
||||
**Type:** `[object, array]`
|
||||
|
||||
`[` [`Solid`](/docs/kcl/types/Solid) `]`
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `solidSet`| | No |
|
||||
|
||||
|
||||
----
|
||||
|
||||
**Type:** `[object, array]`
|
||||
|
||||
`[` [`Sketch`](/docs/kcl/types/Sketch) `]`
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `sketchSet`| | No |
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,6 @@ A path to sweep along.
|
||||
|
||||
|
||||
----
|
||||
A helix.
|
||||
|
||||
[`Helix`](/docs/kcl/types/Helix)
|
||||
|
||||
|
||||
50
docs/kcl/union.md
Normal file
@ -2,7 +2,7 @@ import { test, expect } from './zoo-test'
|
||||
import * as fsp from 'fs/promises'
|
||||
import { executorInputPath, getUtils } from './test-utils'
|
||||
import { KCL_DEFAULT_LENGTH } from 'lib/constants'
|
||||
import path from 'path'
|
||||
import path, { join } from 'path'
|
||||
|
||||
test.describe('Command bar tests', { tag: ['@skipWin'] }, () => {
|
||||
test('Extrude from command bar selects extrude line after', async ({
|
||||
@ -487,4 +487,53 @@ test.describe('Command bar tests', { tag: ['@skipWin'] }, () => {
|
||||
await toolbar.expectFileTreeState(['main.kcl', 'test.kcl'])
|
||||
})
|
||||
})
|
||||
|
||||
test(`Can add a named parameter or constant`, async ({
|
||||
page,
|
||||
homePage,
|
||||
context,
|
||||
cmdBar,
|
||||
scene,
|
||||
editor,
|
||||
}) => {
|
||||
const projectName = 'test'
|
||||
const beforeKclCode = `a = 5
|
||||
b = a * a
|
||||
c = 3 + a`
|
||||
await context.folderSetupFn(async (dir) => {
|
||||
const testProject = join(dir, projectName)
|
||||
await fsp.mkdir(testProject, { recursive: true })
|
||||
await fsp.writeFile(join(testProject, 'main.kcl'), beforeKclCode, 'utf-8')
|
||||
})
|
||||
await homePage.openProject(projectName)
|
||||
// TODO: you probably shouldn't need an engine connection to add a parameter,
|
||||
// but you do because all modeling commands have that requirement
|
||||
await scene.settled(cmdBar)
|
||||
|
||||
await test.step(`Go through the command palette flow`, async () => {
|
||||
await cmdBar.cmdBarOpenBtn.click()
|
||||
await cmdBar.chooseCommand('create parameter')
|
||||
await cmdBar.expectState({
|
||||
stage: 'arguments',
|
||||
commandName: 'Create parameter',
|
||||
currentArgKey: 'value',
|
||||
currentArgValue: '5',
|
||||
headerArguments: {
|
||||
Value: '',
|
||||
},
|
||||
highlightedHeaderArg: 'value',
|
||||
})
|
||||
await cmdBar.argumentInput.locator('[contenteditable]').fill(`b - 5`)
|
||||
// TODO: we have no loading indicator for the KCL argument input calculation
|
||||
await page.waitForTimeout(100)
|
||||
await cmdBar.progressCmdBar()
|
||||
await cmdBar.expectState({
|
||||
stage: 'commandBarClosed',
|
||||
})
|
||||
})
|
||||
|
||||
await editor.expectEditor.toContain(
|
||||
`a = 5b = a * amyParameter001 = b - 5c = 3 + a`
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@ -100,7 +100,8 @@ test(
|
||||
try {
|
||||
const outputGltf = await fsp.readFile(firstFileFullPath)
|
||||
return outputGltf.byteLength
|
||||
} catch (e) {
|
||||
} catch (error: unknown) {
|
||||
void error
|
||||
return 0
|
||||
}
|
||||
},
|
||||
@ -179,7 +180,8 @@ test(
|
||||
try {
|
||||
const outputGltf = await fsp.readFile(secondFileFullPath)
|
||||
return outputGltf.byteLength
|
||||
} catch (e) {
|
||||
} catch (error: unknown) {
|
||||
void error
|
||||
return 0
|
||||
}
|
||||
},
|
||||
|
||||
@ -726,10 +726,10 @@ test.describe('Editor tests', { tag: ['@skipWin'] }, () => {
|
||||
|> line(end = [2, 0])
|
||||
|> line(end = [0, -10])
|
||||
|> close()
|
||||
|> revolve({
|
||||
axis: revolveAxis,
|
||||
angle: 90
|
||||
}, %)
|
||||
|> revolve(
|
||||
axis = revolveAxis,
|
||||
angle = 90
|
||||
)
|
||||
`
|
||||
)
|
||||
})
|
||||
|
||||
@ -21,7 +21,7 @@ sketch001 = startSketchOn('XZ')
|
||||
|> angledLine([-45, length001], %)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
revolve001 = revolve({ axis = "X" }, sketch001)
|
||||
revolve001 = revolve(sketch001, axis = "X")
|
||||
triangle()
|
||||
|> extrude(length = 30)
|
||||
plane001 = offsetPlane('XY', offset = 10)
|
||||
@ -126,7 +126,7 @@ test.describe('Feature Tree pane', () => {
|
||||
await testViewSource({
|
||||
operationName: 'Revolve',
|
||||
operationIndex: 0,
|
||||
expectedActiveLine: 'revolve001 = revolve({ axis = "X" }, sketch001)',
|
||||
expectedActiveLine: 'revolve001 = revolve(sketch001, axis = "X")',
|
||||
})
|
||||
await testViewSource({
|
||||
operationName: 'Triangle',
|
||||
@ -231,9 +231,9 @@ test.describe('Feature Tree pane', () => {
|
||||
|> circle(center = [0, 0], radius = 5)
|
||||
renamedExtrude = extrude(sketch001, length = ${initialInput})`
|
||||
const newConstantName = 'distance001'
|
||||
const expectedCode = `sketch001 = startSketchOn('XZ')
|
||||
const expectedCode = `${newConstantName} = 23
|
||||
sketch001 = startSketchOn('XZ')
|
||||
|> circle(center = [0, 0], radius = 5)
|
||||
${newConstantName} = 23
|
||||
renamedExtrude = extrude(sketch001, length = ${newConstantName})`
|
||||
|
||||
await context.folderSetupFn(async (dir) => {
|
||||
|
||||
@ -1197,7 +1197,7 @@ test.describe('Undo and redo do not keep history when navigating between files',
|
||||
`cloned file has an incremented name and same contents`,
|
||||
{ tag: '@electron' },
|
||||
async ({ page, context, homePage }, testInfo) => {
|
||||
const { panesOpen, createNewFile, cloneFile } = await getUtils(page, test)
|
||||
const { panesOpen, cloneFile } = await getUtils(page, test)
|
||||
|
||||
const { dir } = await context.folderSetupFn(async (dir) => {
|
||||
const finalDir = join(dir, 'testDefault')
|
||||
|
||||
@ -152,9 +152,15 @@ export class EditorFixture {
|
||||
}
|
||||
replaceCode = async (findCode: string, replaceCode: string) => {
|
||||
const lines = await this.page.locator('.cm-line').all()
|
||||
|
||||
let code = (await Promise.all(lines.map((c) => c.textContent()))).join('\n')
|
||||
if (!findCode) {
|
||||
// nuke everything
|
||||
code = replaceCode
|
||||
} else {
|
||||
if (!lines) return
|
||||
code = code.replace(findCode, replaceCode)
|
||||
}
|
||||
await this.codeContent.fill(code)
|
||||
}
|
||||
checkIfPaneIsOpen() {
|
||||
|
||||
@ -3,25 +3,15 @@
|
||||
import type {
|
||||
BrowserContext,
|
||||
ElectronApplication,
|
||||
Fixtures as PlaywrightFixtures,
|
||||
TestInfo,
|
||||
Page,
|
||||
} from '@playwright/test'
|
||||
|
||||
import {
|
||||
_electron as electron,
|
||||
PlaywrightTestArgs,
|
||||
PlaywrightWorkerArgs,
|
||||
} from '@playwright/test'
|
||||
import { _electron as electron } from '@playwright/test'
|
||||
|
||||
import * as TOML from '@iarna/toml'
|
||||
import {
|
||||
TEST_SETTINGS_KEY,
|
||||
TEST_SETTINGS_CORRUPTED,
|
||||
TEST_SETTINGS,
|
||||
TEST_SETTINGS_DEFAULT_THEME,
|
||||
} from '../storageStates'
|
||||
import { SETTINGS_FILE_NAME, PROJECT_SETTINGS_FILE_NAME } from 'lib/constants'
|
||||
import { TEST_SETTINGS } from '../storageStates'
|
||||
import { SETTINGS_FILE_NAME } from 'lib/constants'
|
||||
import { getUtils, setup } from '../test-utils'
|
||||
import fsp from 'fs/promises'
|
||||
import fs from 'node:fs'
|
||||
@ -31,7 +21,6 @@ import { EditorFixture } from './editorFixture'
|
||||
import { ToolbarFixture } from './toolbarFixture'
|
||||
import { SceneFixture } from './sceneFixture'
|
||||
import { HomePageFixture } from './homePageFixture'
|
||||
import { unsafeTypedKeys } from 'lib/utils'
|
||||
import { DeepPartial } from 'lib/types'
|
||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
||||
|
||||
@ -278,13 +267,14 @@ export class ElectronZoo {
|
||||
if (fs.existsSync(this.projectDirName)) {
|
||||
await fsp.rm(this.projectDirName, { recursive: true })
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
} catch (_e) {
|
||||
console.error(_e)
|
||||
}
|
||||
|
||||
try {
|
||||
await fsp.mkdir(this.projectDirName)
|
||||
} catch (e) {
|
||||
} catch (error: unknown) {
|
||||
void error
|
||||
// Not a problem if it already exists.
|
||||
}
|
||||
|
||||
|
||||
@ -850,12 +850,9 @@ openSketch = startSketchOn('XY')
|
||||
})
|
||||
})
|
||||
|
||||
test(`Shift-click to select and deselect sketch segments`, async ({
|
||||
page,
|
||||
homePage,
|
||||
scene,
|
||||
editor,
|
||||
}) => {
|
||||
test.fixme(
|
||||
`Shift-click to select and deselect sketch segments`,
|
||||
async ({ page, homePage, scene, editor }) => {
|
||||
// Locators
|
||||
const firstPointLocation = { x: 200, y: 100 }
|
||||
const secondPointLocation = { x: 800, y: 100 }
|
||||
@ -1002,7 +999,8 @@ openSketch = startSketchOn('XY')
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
test(`Offset plane point-and-click`, async ({
|
||||
context,
|
||||
@ -1880,6 +1878,119 @@ fillet04 = fillet(extrude001, radius = 5, tags = [getOppositeEdge(seg02)])
|
||||
})
|
||||
})
|
||||
|
||||
test(`Fillet with large radius should update code even if engine fails`, async ({
|
||||
context,
|
||||
page,
|
||||
homePage,
|
||||
scene,
|
||||
editor,
|
||||
toolbar,
|
||||
cmdBar,
|
||||
}) => {
|
||||
// Create a cube with small edges that will cause some fillets to fail
|
||||
const initialCode = `sketch001 = startSketchOn('XY')
|
||||
profile001 = startProfileAt([0, 0], sketch001)
|
||||
|> yLine(length = -1)
|
||||
|> xLine(length = -10)
|
||||
|> yLine(length = 10)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
extrude001 = extrude(profile001, length = 5)
|
||||
`
|
||||
const taggedSegment = `yLine(length = -1, tag = $seg01)`
|
||||
const filletExpression = `fillet(radius = 1000, tags = [getNextAdjacentEdge(seg01)])`
|
||||
|
||||
// Locators
|
||||
const edgeLocation = { x: 659, y: 313 }
|
||||
const bodyLocation = { x: 594, y: 313 }
|
||||
|
||||
// Colors
|
||||
const edgeColorWhite: [number, number, number] = [248, 248, 248]
|
||||
const edgeColorYellow: [number, number, number] = [251, 251, 120] // Mac:B=251,251,90 Ubuntu:240,241,180, Windows:240,241,180
|
||||
const backgroundColor: [number, number, number] = [30, 30, 30]
|
||||
const bodyColor: [number, number, number] = [155, 155, 155]
|
||||
const lowTolerance = 20
|
||||
const highTolerance = 70
|
||||
|
||||
// Setup
|
||||
await test.step(`Initial test setup`, async () => {
|
||||
await context.addInitScript((initialCode) => {
|
||||
localStorage.setItem('persistCode', initialCode)
|
||||
}, initialCode)
|
||||
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||
await homePage.goToModelingScene()
|
||||
|
||||
// verify modeling scene is loaded
|
||||
await scene.expectPixelColor(backgroundColor, edgeLocation, lowTolerance)
|
||||
|
||||
// wait for stream to load
|
||||
await scene.expectPixelColor(bodyColor, bodyLocation, highTolerance)
|
||||
})
|
||||
|
||||
// Test
|
||||
await test.step('Select edges and apply oversized fillet', async () => {
|
||||
await test.step(`Select the edge`, async () => {
|
||||
await scene.expectPixelColor(edgeColorWhite, edgeLocation, lowTolerance)
|
||||
const [clickOnTheEdge] = scene.makeMouseHelpers(
|
||||
edgeLocation.x,
|
||||
edgeLocation.y
|
||||
)
|
||||
await clickOnTheEdge()
|
||||
await scene.expectPixelColor(
|
||||
edgeColorYellow,
|
||||
edgeLocation,
|
||||
highTolerance // Ubuntu color mismatch can require high tolerance
|
||||
)
|
||||
})
|
||||
|
||||
await test.step(`Apply fillet`, async () => {
|
||||
await page.waitForTimeout(100)
|
||||
await toolbar.filletButton.click()
|
||||
await cmdBar.expectState({
|
||||
commandName: 'Fillet',
|
||||
highlightedHeaderArg: 'selection',
|
||||
currentArgKey: 'selection',
|
||||
currentArgValue: '',
|
||||
headerArguments: {
|
||||
Selection: '',
|
||||
Radius: '',
|
||||
},
|
||||
stage: 'arguments',
|
||||
})
|
||||
await cmdBar.progressCmdBar()
|
||||
await cmdBar.expectState({
|
||||
commandName: 'Fillet',
|
||||
highlightedHeaderArg: 'radius',
|
||||
currentArgKey: 'radius',
|
||||
currentArgValue: '5',
|
||||
headerArguments: {
|
||||
Selection: '1 sweepEdge',
|
||||
Radius: '',
|
||||
},
|
||||
stage: 'arguments',
|
||||
})
|
||||
// Set a large radius (1000)
|
||||
await cmdBar.currentArgumentInput.locator('.cm-content').fill('1000')
|
||||
await cmdBar.progressCmdBar()
|
||||
await cmdBar.expectState({
|
||||
commandName: 'Fillet',
|
||||
headerArguments: {
|
||||
Selection: '1 sweepEdge',
|
||||
Radius: '1000',
|
||||
},
|
||||
stage: 'review',
|
||||
})
|
||||
// Apply fillet with large radius
|
||||
await cmdBar.progressCmdBar()
|
||||
})
|
||||
})
|
||||
|
||||
await test.step('Verify code is updated regardless of execution errors', async () => {
|
||||
await editor.expectEditor.toContain(taggedSegment)
|
||||
await editor.expectEditor.toContain(filletExpression)
|
||||
})
|
||||
})
|
||||
|
||||
test(`Chamfer point-and-click`, async ({
|
||||
context,
|
||||
page,
|
||||
@ -1906,7 +2017,6 @@ extrude001 = extrude(sketch001, length = -12)
|
||||
// Locators
|
||||
const firstEdgeLocation = { x: 600, y: 193 }
|
||||
const secondEdgeLocation = { x: 600, y: 383 }
|
||||
const bodyLocation = { x: 630, y: 290 }
|
||||
const [clickOnFirstEdge] = scene.makeMouseHelpers(
|
||||
firstEdgeLocation.x,
|
||||
firstEdgeLocation.y
|
||||
@ -1919,7 +2029,6 @@ extrude001 = extrude(sketch001, length = -12)
|
||||
// Colors
|
||||
const edgeColorWhite: [number, number, number] = [248, 248, 248]
|
||||
const edgeColorYellow: [number, number, number] = [251, 251, 40] // Mac:B=67 Ubuntu:B=12
|
||||
const bodyColor: [number, number, number] = [155, 155, 155]
|
||||
const chamferColor: [number, number, number] = [168, 168, 168]
|
||||
const backgroundColor: [number, number, number] = [30, 30, 30]
|
||||
const lowTolerance = 20
|
||||
@ -2812,7 +2921,7 @@ segAng(rectangleSegmentA002),
|
||||
await cmdBar.progressCmdBar()
|
||||
await cmdBar.progressCmdBar()
|
||||
|
||||
const newCodeToFind = `revolve001 = revolve({ angle = 360, axis = 'X' }, sketch002)`
|
||||
const newCodeToFind = `revolve001 = revolve(sketch002, angle = 360, axis = 'X')`
|
||||
expect(editor.expectEditor.toContain(newCodeToFind)).toBeTruthy()
|
||||
})
|
||||
test('revolve surface around edge from an extruded solid2d', async ({
|
||||
@ -2862,7 +2971,7 @@ radius = 8.69
|
||||
await page.getByText(lineCodeToSelection).click()
|
||||
await cmdBar.progressCmdBar()
|
||||
|
||||
const newCodeToFind = `revolve001 = revolve({angle = 360, axis = getOppositeEdge(rectangleSegmentA001)}, sketch002) `
|
||||
const newCodeToFind = `revolve001 = revolve(sketch002, angle = 360, axis = getOppositeEdge(rectangleSegmentA001)) `
|
||||
expect(editor.expectEditor.toContain(newCodeToFind)).toBeTruthy()
|
||||
})
|
||||
test('revolve sketch circle around line segment from startProfileAt sketch', async ({
|
||||
@ -2913,7 +3022,7 @@ radius = 8.69
|
||||
await page.getByText(lineCodeToSelection).click()
|
||||
await cmdBar.progressCmdBar()
|
||||
|
||||
const newCodeToFind = `revolve001 = revolve({ angle = 360, axis = seg01 }, sketch003)`
|
||||
const newCodeToFind = `revolve001 = revolve(sketch003, angle = 360, axis = seg01)`
|
||||
expect(editor.expectEditor.toContain(newCodeToFind)).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
||||
@ -539,7 +539,8 @@ test.describe('Can export from electron app', () => {
|
||||
try {
|
||||
const outputGltf = await fsp.readFile(filepath)
|
||||
return outputGltf.byteLength
|
||||
} catch (e) {
|
||||
} catch (error: unknown) {
|
||||
void error
|
||||
return 0
|
||||
}
|
||||
},
|
||||
|
||||
@ -196,14 +196,9 @@ test.describe('Prompt-to-edit tests', { tag: '@skipWin' }, () => {
|
||||
})
|
||||
})
|
||||
|
||||
test(`manual code selection rename`, async ({
|
||||
context,
|
||||
homePage,
|
||||
cmdBar,
|
||||
editor,
|
||||
page,
|
||||
scene,
|
||||
}) => {
|
||||
test.fixme(
|
||||
`manual code selection rename`,
|
||||
async ({ context, homePage, cmdBar, editor, page, scene }) => {
|
||||
const body1CapCoords = { x: 571, y: 311 }
|
||||
|
||||
await context.addInitScript((file) => {
|
||||
@ -253,7 +248,8 @@ test.describe('Prompt-to-edit tests', { tag: '@skipWin' }, () => {
|
||||
await acceptBtn.click()
|
||||
await expect(successToast).not.toBeVisible()
|
||||
})
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
test('multiple body selections', async ({
|
||||
context,
|
||||
|
||||
@ -405,8 +405,9 @@ extrude001 = extrude(sketch001, length = 50)
|
||||
await expect(successToastMessage).toBeVisible()
|
||||
}
|
||||
)
|
||||
// We updated this test such that you can have multiple exports going at once.
|
||||
test(
|
||||
'ensure you can not export while an export is already going',
|
||||
'ensure you CAN export while an export is already going',
|
||||
{ tag: ['@skipLinux', '@skipWin'] },
|
||||
async ({ page, homePage }) => {
|
||||
const u = await getUtils(page)
|
||||
@ -441,22 +442,13 @@ extrude001 = extrude(sketch001, length = 50)
|
||||
const alreadyExportingToastMessage = page.getByText(`Already exporting`)
|
||||
const successToastMessage = page.getByText(`Exported successfully`)
|
||||
|
||||
await test.step('Blocked second export', async () => {
|
||||
await test.step('second export', async () => {
|
||||
await clickExportButton(page)
|
||||
|
||||
await expect(exportingToastMessage).toBeVisible()
|
||||
|
||||
await clickExportButton(page)
|
||||
|
||||
await test.step('The second export is blocked', async () => {
|
||||
// Find the toast.
|
||||
// Look out for the toast message
|
||||
await Promise.all([
|
||||
expect(exportingToastMessage.first()).toBeVisible(),
|
||||
expect(alreadyExportingToastMessage).toBeVisible(),
|
||||
])
|
||||
})
|
||||
|
||||
await test.step('The first export still succeeds', async () => {
|
||||
await Promise.all([
|
||||
expect(exportingToastMessage).not.toBeVisible({ timeout: 15_000 }),
|
||||
@ -486,12 +478,12 @@ extrude001 = extrude(sketch001, length = 50)
|
||||
expect(alreadyExportingToastMessage).not.toBeVisible(),
|
||||
])
|
||||
|
||||
await expect(successToastMessage).toBeVisible()
|
||||
await expect(successToastMessage).toHaveCount(2)
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
test(
|
||||
test.fixme(
|
||||
`Network health indicator only appears in modeling view`,
|
||||
{ tag: '@electron' },
|
||||
async ({ context, page }, testInfo) => {
|
||||
|
||||
@ -14,7 +14,8 @@ try {
|
||||
// prefer env vars over secrets file
|
||||
secrets[key] = process.env[key] || (value as any).replaceAll('"', '')
|
||||
})
|
||||
} catch (err) {
|
||||
} catch (error: unknown) {
|
||||
void error
|
||||
// probably running in CI
|
||||
console.warn(
|
||||
`Error reading ${secretsPath}; environment variables will be used`
|
||||
|
||||
@ -187,7 +187,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
|
||||
page.getByRole('button', { name: 'Start Sketch' })
|
||||
).toBeVisible()
|
||||
})
|
||||
test.describe('Can edit segments by dragging their handles', () => {
|
||||
test.fixme('Can edit segments by dragging their handles', () => {
|
||||
const doEditSegmentsByDraggingHandle = async (
|
||||
page: Page,
|
||||
homePage: HomePageFixture,
|
||||
@ -666,7 +666,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
|
||||
|> line(end = [12.73, -0.09])
|
||||
|> tangentialArcTo([24.95, -5.38], %)
|
||||
|> close()
|
||||
|> revolve({ axis = "X",}, %)`
|
||||
|> revolve(axis = "X")`
|
||||
)
|
||||
})
|
||||
|
||||
@ -753,7 +753,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
|
||||
|> tangentialArcTo([24.95, -5.38], %)
|
||||
|> line(end = [1.97, 2.06])
|
||||
|> close()
|
||||
|> revolve({ axis = "X" }, %)`)
|
||||
|> revolve(axis = "X")`)
|
||||
})
|
||||
test('Can add multiple sketches', async ({ page, homePage }) => {
|
||||
const u = await getUtils(page)
|
||||
@ -1200,7 +1200,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
|
||||
|> xLine(endAbsolute = 0 + .001)
|
||||
|> yLine(endAbsolute = 0)
|
||||
|> close()
|
||||
|> revolve({ axis = "Y" }, %)
|
||||
|> revolve(axis = "Y")
|
||||
|
||||
return lugSketch
|
||||
}
|
||||
@ -1454,7 +1454,7 @@ test.describe(`Sketching with offset planes`, () => {
|
||||
})
|
||||
|
||||
test.describe('multi-profile sketching', () => {
|
||||
test(
|
||||
test.fixme(
|
||||
`test it removes half-finished expressions when changing tools in sketch mode`,
|
||||
{ tag: ['@skipWin'] },
|
||||
async ({ context, page, scene, toolbar, editor, homePage, cmdBar }) => {
|
||||
@ -1662,6 +1662,96 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
|
||||
})
|
||||
}
|
||||
)
|
||||
test('can enter sketch mode for sketch with no profiles', async ({
|
||||
scene,
|
||||
toolbar,
|
||||
editor,
|
||||
cmdBar,
|
||||
page,
|
||||
homePage,
|
||||
}) => {
|
||||
await page.addInitScript(async () => {
|
||||
localStorage.setItem(
|
||||
'persistCode',
|
||||
`sketch001 = startSketchOn('XY')
|
||||
`
|
||||
)
|
||||
})
|
||||
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||
await homePage.goToModelingScene()
|
||||
await scene.connectionEstablished()
|
||||
await scene.settled(cmdBar)
|
||||
await expect(
|
||||
page.getByRole('button', { name: 'Start Sketch' })
|
||||
).not.toBeDisabled()
|
||||
|
||||
// open feature tree and double click the first sketch
|
||||
await (await toolbar.getFeatureTreeOperation('Sketch', 0)).dblclick()
|
||||
await page.waitForTimeout(600)
|
||||
|
||||
// click in the scene twice to add a segment
|
||||
const [startProfile1] = scene.makeMouseHelpers(658, 140)
|
||||
const [segment1Clk] = scene.makeMouseHelpers(701, 200)
|
||||
|
||||
// wait for line to be aria pressed
|
||||
await expect
|
||||
.poll(async () => toolbar.lineBtn.getAttribute('aria-pressed'))
|
||||
.toBe('true')
|
||||
|
||||
await startProfile1()
|
||||
await editor.expectEditor.toContain(`profile001 = startProfileAt`)
|
||||
await segment1Clk()
|
||||
await editor.expectEditor.toContain(`|> line(end`)
|
||||
})
|
||||
test('can delete all profiles in sketch mode and user can still equip a tool and draw something', async ({
|
||||
scene,
|
||||
toolbar,
|
||||
editor,
|
||||
page,
|
||||
homePage,
|
||||
}) => {
|
||||
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||
await homePage.goToModelingScene()
|
||||
await scene.connectionEstablished()
|
||||
await expect(
|
||||
page.getByRole('button', { name: 'Start Sketch' })
|
||||
).not.toBeDisabled()
|
||||
|
||||
const [selectXZPlane] = scene.makeMouseHelpers(650, 150)
|
||||
|
||||
await toolbar.startSketchPlaneSelection()
|
||||
await selectXZPlane()
|
||||
// timeout wait for engine animation is unavoidable
|
||||
await page.waitForTimeout(600)
|
||||
await editor.expectEditor.toContain(`sketch001 = startSketchOn('XZ')`)
|
||||
|
||||
const [startProfile1] = scene.makeMouseHelpers(568, 70)
|
||||
const [segment1Clk] = scene.makeMouseHelpers(701, 78)
|
||||
const [segment2Clk] = scene.makeMouseHelpers(745, 189)
|
||||
|
||||
await test.step('add two segments', async () => {
|
||||
await startProfile1()
|
||||
await editor.expectEditor.toContain(
|
||||
`profile001 = startProfileAt([4.61, 12.21], sketch001)`
|
||||
)
|
||||
await segment1Clk()
|
||||
await editor.expectEditor.toContain(`|> line(end`)
|
||||
await segment2Clk()
|
||||
await editor.expectEditor.toContain(`|> line(end = [2.98, -7.52])`)
|
||||
})
|
||||
|
||||
await test.step('delete all profiles', async () => {
|
||||
await editor.replaceCode('', "sketch001 = startSketchOn('XZ')\n")
|
||||
await page.waitForTimeout(600) // wait for deferred execution
|
||||
})
|
||||
|
||||
await test.step('equip circle and draw it', async () => {
|
||||
await toolbar.circleBtn.click()
|
||||
await page.mouse.click(700, 200)
|
||||
await page.mouse.click(750, 200)
|
||||
await editor.expectEditor.toContain('circle(sketch001, center = [')
|
||||
})
|
||||
})
|
||||
test('Can add multiple profiles to a sketch (all tool types)', async ({
|
||||
scene,
|
||||
toolbar,
|
||||
@ -2570,10 +2660,11 @@ profile006 = startProfileAt([9.65, 3.82], sketch002)
|
||||
|> line(end = [2.13, -5.57])
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
revolve001 = revolve({
|
||||
revolve001 = revolve(
|
||||
profile004,
|
||||
angle = 45,
|
||||
axis = getNextAdjacentEdge(seg01)
|
||||
}, profile004)
|
||||
)
|
||||
extrude002 = extrude(profile006, length = 4)
|
||||
sketch003 = startSketchOn('-XZ')
|
||||
profile007 = startProfileAt([4.8, 7.55], sketch003)
|
||||
@ -2608,7 +2699,7 @@ profile011 = startProfileAt([5.07, -6.39], sketch003)
|
||||
|> close()
|
||||
extrude003 = extrude(profile011, length = 2.5)
|
||||
// TODO this breaks the test,
|
||||
// revolve002 = revolve({ angle = 45, axis = seg02 }, profile008)
|
||||
// revolve002 = revolve(profile008, angle = 45, axis = seg02)
|
||||
`
|
||||
)
|
||||
})
|
||||
@ -2626,11 +2717,6 @@ extrude003 = extrude(profile011, length = 2.5)
|
||||
{ x: 834, y: -680, z: 534 },
|
||||
{ x: -54, y: -476, z: 148 }
|
||||
)
|
||||
const camPositionForSelectingSketchOnCapProfiles = () =>
|
||||
scene.moveCameraTo(
|
||||
{ x: 404, y: 690, z: 38 },
|
||||
{ x: 16, y: -140, z: -10 }
|
||||
)
|
||||
const wallSelectionOptions = [
|
||||
{
|
||||
title: 'select wall segment',
|
||||
@ -2653,29 +2739,6 @@ extrude003 = extrude(profile011, length = 2.5)
|
||||
selectClick: scene.makeMouseHelpers(836, 103)[0],
|
||||
},
|
||||
] as const
|
||||
const capSelectionOptions = [
|
||||
{
|
||||
title: 'select cap segment',
|
||||
selectClick: scene.makeMouseHelpers(688, 91)[0],
|
||||
},
|
||||
{
|
||||
title: 'select cap solid 2d',
|
||||
selectClick: scene.makeMouseHelpers(733, 204)[0],
|
||||
},
|
||||
// TODO keeps failing
|
||||
// {
|
||||
// title: 'select cap circle',
|
||||
// selectClick: scene.makeMouseHelpers(679, 290)[0],
|
||||
// },
|
||||
{
|
||||
title: 'select cap extrude wall',
|
||||
selectClick: scene.makeMouseHelpers(649, 402)[0],
|
||||
},
|
||||
{
|
||||
title: 'select cap extrude cap',
|
||||
selectClick: scene.makeMouseHelpers(693, 408)[0],
|
||||
},
|
||||
] as const
|
||||
|
||||
const verifyWallProfilesAreDrawn = async () =>
|
||||
test.step('verify wall profiles are drawn', async () => {
|
||||
@ -2697,44 +2760,6 @@ extrude003 = extrude(profile011, length = 2.5)
|
||||
])
|
||||
})
|
||||
|
||||
const verifyCapProfilesAreDrawn = async () =>
|
||||
test.step('verify cap profiles are drawn', async () => {
|
||||
// open polygon
|
||||
await scene.expectPixelColor(
|
||||
TEST_COLORS.WHITE,
|
||||
// TEST_COLORS.BLUE, // When entering via the circle, it's selected and therefore blue
|
||||
{ x: 620, y: 58 },
|
||||
15
|
||||
)
|
||||
// revolved profile
|
||||
await scene.expectPixelColor(
|
||||
TEST_COLORS.WHITE,
|
||||
{ x: 641, y: 110 },
|
||||
15
|
||||
)
|
||||
// closed polygon
|
||||
await scene.expectPixelColor(
|
||||
TEST_COLORS.WHITE,
|
||||
{ x: 632, y: 200 },
|
||||
15
|
||||
)
|
||||
// extruded profile
|
||||
await scene.expectPixelColor(
|
||||
TEST_COLORS.WHITE,
|
||||
{ x: 628, y: 410 },
|
||||
15
|
||||
)
|
||||
// circle
|
||||
await scene.expectPixelColor(
|
||||
[
|
||||
TEST_COLORS.WHITE,
|
||||
TEST_COLORS.BLUE, // When entering via the circle, it's selected and therefore blue
|
||||
],
|
||||
{ x: 681, y: 303 },
|
||||
15
|
||||
)
|
||||
})
|
||||
|
||||
await test.step('select wall profiles', async () => {
|
||||
for (const { title, selectClick } of wallSelectionOptions) {
|
||||
await test.step(title, async () => {
|
||||
|
||||
@ -7,12 +7,7 @@ import { spawn } from 'child_process'
|
||||
import { KCL_DEFAULT_LENGTH } from 'lib/constants'
|
||||
import JSZip from 'jszip'
|
||||
import path from 'path'
|
||||
import {
|
||||
IS_PLAYWRIGHT_KEY,
|
||||
TEST_SETTINGS,
|
||||
TEST_SETTINGS_KEY,
|
||||
} from './storageStates'
|
||||
import * as TOML from '@iarna/toml'
|
||||
import { TEST_SETTINGS, TEST_SETTINGS_KEY } from './storageStates'
|
||||
import { SceneFixture } from './fixtures/sceneFixture'
|
||||
import { CmdBarFixture } from './fixtures/cmdBarFixture'
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 143 KiB |
|
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 127 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
@ -29,5 +29,5 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"kcl_version": "0.2.47"
|
||||
"kcl_version": "0.2.52"
|
||||
}
|
||||
@ -1,4 +1,3 @@
|
||||
import { MouseControlType } from '@rust/kcl-lib/bindings/MouseControlType'
|
||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
||||
import { SaveSettingsPayload } from 'lib/settings/settingsTypes'
|
||||
import { Themes } from 'lib/theme'
|
||||
@ -143,10 +142,10 @@ sketch001 = startSketchOn(box, revolveAxis)
|
||||
|> line(end = [2, 0])
|
||||
|> line(end = [0, -10])
|
||||
|> close()
|
||||
|> revolve({
|
||||
axis: revolveAxis,
|
||||
angle: 90
|
||||
}, %)
|
||||
|> revolve(
|
||||
axis = revolveAxis,
|
||||
angle = 90
|
||||
)
|
||||
|
||||
sketch001 = startSketchOn('XZ')
|
||||
|> startProfileAt([0.0, 0.0], %)
|
||||
|
||||
@ -3,7 +3,7 @@ import { commonPoints, getUtils } from './test-utils'
|
||||
import { EngineCommand } from 'lang/std/artifactGraph'
|
||||
import { uuidv4 } from 'lib/utils'
|
||||
|
||||
test.describe('Test network and connection issues', () => {
|
||||
test.fixme('Test network and connection issues', () => {
|
||||
test(
|
||||
'simulate network down and network little widget',
|
||||
{ tag: '@skipLocalEngine' },
|
||||
|
||||
@ -2,15 +2,12 @@ import {
|
||||
expect,
|
||||
BrowserContext,
|
||||
TestInfo,
|
||||
_electron as electron,
|
||||
ElectronApplication,
|
||||
Locator,
|
||||
Page,
|
||||
} from '@playwright/test'
|
||||
import { test } from './zoo-test'
|
||||
import { EngineCommand } from 'lang/std/artifactGraph'
|
||||
import fsp from 'fs/promises'
|
||||
import fsSync from 'fs'
|
||||
import path from 'path'
|
||||
import pixelMatch from 'pixelmatch'
|
||||
import { PNG } from 'pngjs'
|
||||
@ -24,14 +21,11 @@ import {
|
||||
IS_PLAYWRIGHT_KEY,
|
||||
} from './storageStates'
|
||||
import * as TOML from '@iarna/toml'
|
||||
import { SaveSettingsPayload } from 'lib/settings/settingsTypes'
|
||||
import { SETTINGS_FILE_NAME } from 'lib/constants'
|
||||
import { isErrorWhitelisted } from './lib/console-error-whitelist'
|
||||
import { isArray } from 'lib/utils'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { DeepPartial } from 'lib/types'
|
||||
import { Configuration } from 'lang/wasm'
|
||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
||||
|
||||
const toNormalizedCode = (text: string) => {
|
||||
return text.replace(/\s+/g, '')
|
||||
@ -928,10 +922,6 @@ export async function setup(
|
||||
// await page.reload()
|
||||
}
|
||||
|
||||
let electronApp: ElectronApplication | undefined = undefined
|
||||
let context: BrowserContext | undefined = undefined
|
||||
let page: Page | undefined = undefined
|
||||
|
||||
function failOnConsoleErrors(page: Page, testInfo?: TestInfo) {
|
||||
// enabled for chrome for now
|
||||
if (page.context().browser()?.browserType().name() === 'chromium') {
|
||||
|
||||
@ -4,7 +4,6 @@ import { bracket } from 'lib/exampleKcl'
|
||||
import * as fsp from 'fs/promises'
|
||||
import { join } from 'path'
|
||||
import { FILE_EXT } from 'lib/constants'
|
||||
import { UnitLength_type } from '@kittycad/lib/dist/types/src/models'
|
||||
|
||||
test.describe('Testing in-app sample loading', () => {
|
||||
/**
|
||||
@ -49,8 +48,6 @@ test.describe('Testing in-app sample loading', () => {
|
||||
})
|
||||
const warningText = page.getByText('Overwrite current file and units?')
|
||||
const confirmButton = page.getByRole('button', { name: 'Submit command' })
|
||||
const unitsToast = (unit: UnitLength_type) =>
|
||||
page.getByText(`Set default unit to "${unit}" for this project`)
|
||||
|
||||
await test.step(`Precondition: check the initial code`, async () => {
|
||||
await u.openKclCodePanel()
|
||||
@ -125,8 +122,6 @@ test.describe('Testing in-app sample loading', () => {
|
||||
page.getByRole('listitem').filter({
|
||||
has: page.getByRole('button', { name }),
|
||||
})
|
||||
const unitsToast = (unit: UnitLength_type) =>
|
||||
page.getByText(`Set default unit to "${unit}" for this project`)
|
||||
|
||||
await test.step(`Test setup`, async () => {
|
||||
await page.setBodyDimensions({ width: 1200, height: 500 })
|
||||
|
||||
@ -1386,7 +1386,8 @@ profile001 = startProfileAt([56.37, 120.33], sketch001)
|
||||
page.getByRole('button', { name: 'Edit Sketch' })
|
||||
).toBeVisible()
|
||||
return true
|
||||
} catch (_) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
} catch (_e) {
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
@ -323,7 +323,7 @@ part009 = startSketchOn('XY')
|
||||
|> line(end = [0, pipeLength])
|
||||
|> angledLineToX({ angle = 60, to = pipeLargeDia }, %)
|
||||
|> close()
|
||||
rev = revolve({ axis = 'y' }, part009)
|
||||
rev = revolve(part009, axis = 'y')
|
||||
sketch006 = startSketchOn('XY')
|
||||
profile001 = circle(
|
||||
sketch006,
|
||||
@ -353,6 +353,7 @@ profile003 = startProfileAt([40.16, -120.48], sketch006)
|
||||
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||
|
||||
await homePage.goToModelingScene()
|
||||
await scene.connectionEstablished()
|
||||
await scene.settled(cmdBar)
|
||||
|
||||
const camPosition1 = async () => {
|
||||
@ -364,7 +365,6 @@ profile003 = startProfileAt([40.16, -120.48], sketch006)
|
||||
await camPosition1()
|
||||
|
||||
const revolve = { x: 635, y: 253 }
|
||||
const parentExtrude = { x: 915, y: 133 }
|
||||
const solid2d = { x: 770, y: 167 }
|
||||
const individualProfile = { x: 694, y: 432 }
|
||||
|
||||
@ -380,7 +380,7 @@ profile003 = startProfileAt([40.16, -120.48], sketch006)
|
||||
await page.waitForTimeout(200)
|
||||
|
||||
await expect(u.codeLocator).not.toContainText(
|
||||
`rev = revolve({ axis: 'y' }, part009)`
|
||||
`rev = revolve(part009, axis: 'y')`
|
||||
)
|
||||
|
||||
// FIXME (commented section below), this test would select a wall that had a sketch on it, and delete the underlying extrude
|
||||
@ -452,13 +452,9 @@ profile003 = startProfileAt([40.16, -120.48], sketch006)
|
||||
await page.waitForTimeout(200)
|
||||
await expect(u.codeLocator).not.toContainText(codeToBeDeletedSnippet)
|
||||
})
|
||||
test('parent Solid should be select and deletable and uses custom planes to position children', async ({
|
||||
page,
|
||||
homePage,
|
||||
scene,
|
||||
cmdBar,
|
||||
editor,
|
||||
}) => {
|
||||
test.fixme(
|
||||
'parent Solid should be select and deletable and uses custom planes to position children',
|
||||
async ({ page, homePage, scene, cmdBar, editor }) => {
|
||||
test.setTimeout(90_000)
|
||||
const u = await getUtils(page)
|
||||
await page.addInitScript(async () => {
|
||||
@ -522,7 +518,8 @@ profile001 = startProfileAt([7.49, 9.96], sketch001)
|
||||
shouldNormalise: true,
|
||||
})
|
||||
await editor.snapshot()
|
||||
})
|
||||
}
|
||||
)
|
||||
test('Hovering over 3d features highlights code, clicking puts the cursor in the right place and sends selection id to engine', async ({
|
||||
page,
|
||||
homePage,
|
||||
|
||||
@ -7,7 +7,7 @@ import {
|
||||
createProject,
|
||||
tomlToSettings,
|
||||
} from './test-utils'
|
||||
import { SaveSettingsPayload, SettingsLevel } from 'lib/settings/settingsTypes'
|
||||
import { SettingsLevel } from 'lib/settings/settingsTypes'
|
||||
import { SETTINGS_FILE_NAME, PROJECT_SETTINGS_FILE_NAME } from 'lib/constants'
|
||||
import {
|
||||
TEST_SETTINGS_KEY,
|
||||
@ -15,7 +15,6 @@ import {
|
||||
TEST_SETTINGS,
|
||||
TEST_SETTINGS_DEFAULT_THEME,
|
||||
} from './storageStates'
|
||||
import * as TOML from '@iarna/toml'
|
||||
import { DeepPartial } from 'lib/types'
|
||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
||||
|
||||
@ -978,14 +977,9 @@ fn cube`
|
||||
/**
|
||||
* This test assumes that the default value of the "highlight edges" setting is "on".
|
||||
*/
|
||||
test(`Toggle stream settings multiple times`, async ({
|
||||
page,
|
||||
scene,
|
||||
homePage,
|
||||
context,
|
||||
toolbar,
|
||||
cmdBar,
|
||||
}, testInfo) => {
|
||||
test.fixme(
|
||||
`Toggle stream settings multiple times`,
|
||||
async ({ page, scene, homePage, context, toolbar, cmdBar }, testInfo) => {
|
||||
await context.folderSetupFn(async (dir) => {
|
||||
const projectDir = join(dir, 'project-000')
|
||||
await fsp.mkdir(projectDir, { recursive: true })
|
||||
@ -1006,11 +1000,6 @@ fn cube`
|
||||
page.getByText(
|
||||
`Set highlight edges to "${String(value)}" as a user default`
|
||||
)
|
||||
const initialPath = testInfo.snapshotPath('toggle-settings-initial.png')
|
||||
const initialScreenshot = await scene.streamWrapper.screenshot({
|
||||
path: initialPath,
|
||||
mask: [page.getByTestId('model-state-indicator')],
|
||||
})
|
||||
|
||||
await test.step(`Toggle highlightEdges off`, async () => {
|
||||
await cmdBar.openCmdBar()
|
||||
@ -1045,5 +1034,6 @@ fn cube`
|
||||
mask: [page.getByTestId('model-state-indicator')],
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
@ -619,7 +619,7 @@ async function sendPromptFromCommandBar(page: Page, promptStr: string) {
|
||||
})
|
||||
}
|
||||
|
||||
test(
|
||||
test.fixme(
|
||||
'Text-to-CAD functionality',
|
||||
{ tag: '@electron' },
|
||||
async ({ context, page }, testInfo) => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* eslint-disable react-hooks/rules-of-hooks */
|
||||
|
||||
import { test as playwrightTestFn, ElectronApplication } from '@playwright/test'
|
||||
import { test as playwrightTestFn } from '@playwright/test'
|
||||
|
||||
import {
|
||||
fixturesBasedOnProcessEnvPlatform,
|
||||
@ -8,8 +8,6 @@ import {
|
||||
ElectronZoo,
|
||||
} from './fixtures/fixtureSetup'
|
||||
|
||||
import { Settings } from '@rust/kcl-lib/bindings/Settings'
|
||||
import { DeepPartial } from 'lib/types'
|
||||
export { expect } from '@playwright/test'
|
||||
|
||||
declare module '@playwright/test' {
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
"@xstate/inspect": "^0.8.0",
|
||||
"@xstate/react": "^4.1.1",
|
||||
"bonjour-service": "^1.3.0",
|
||||
"bson": "^6.10.3",
|
||||
"chokidar": "^4.0.1",
|
||||
"codemirror": "^6.0.1",
|
||||
"decamelize": "^6.0.0",
|
||||
@ -71,7 +72,7 @@
|
||||
"scripts": {
|
||||
"install:rust": "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none && source \"$HOME/.cargo/env\" && (cd rust && (rustup show active-toolchain || rustup toolchain install))",
|
||||
"install:rust:windows": "winget install Microsoft.VisualStudio.2022.Community --silent --override \"--wait --quiet --add ProductLang En-us --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended\" && winget install Rustlang.Rustup",
|
||||
"install:wasm-pack:sh": ". $HOME/.cargo/env && curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -y",
|
||||
"install:wasm-pack:sh": ". $HOME/.cargo/env && curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f",
|
||||
"install:wasm-pack:cargo": "cargo install wasm-pack",
|
||||
"install:tools:windows": "winget install jqlang.jq MikeFarah.yq GitHub.cli",
|
||||
"start": "vite --port=3000 --host=0.0.0.0",
|
||||
@ -87,12 +88,13 @@
|
||||
"simpleserver:ci": "yarn pretest && http-server ./public --cors -p 3000 &",
|
||||
"simpleserver:bg": "yarn pretest && http-server ./public --cors -p 3000 &",
|
||||
"simpleserver:stop": "kill-port 3000",
|
||||
"fmt": "prettier --write ./src *.ts *.json *.js ./e2e ./packages ./rust/kcl-language-server",
|
||||
"fmt": "prettier --write ./src *.ts *.json *.js ./e2e ./packages ./rust/kcl-language-server ./rust/kcl-lib/bindings ./rust/kcl-wasm-lib/pkg",
|
||||
"fmt:generated": "prettier --write *.ts *.json *.js ./rust/kcl-lib/bindings ./rust/kcl-wasm-lib/pkg",
|
||||
"fmt-check": "prettier --check ./src *.ts *.json *.js ./e2e ./packages ./rust/kcl-language-server",
|
||||
"fetch:wasm": "./scripts/get-latest-wasm-bundle.sh",
|
||||
"fetch:wasm:windows": "./scripts/get-latest-wasm-bundle.ps1",
|
||||
"fetch:samples": "rm -rf public/kcl-samples* && curl -L -o public/kcl-samples.zip https://github.com/KittyCAD/kcl-samples/archive/refs/heads/achalmers/kw-args-xylineto.zip && unzip -o public/kcl-samples.zip -d public && mv public/kcl-samples-* public/kcl-samples",
|
||||
"build:wasm-dev": "yarn wasm-prep && (cd rust && wasm-pack build kcl-wasm-lib --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt",
|
||||
"build:wasm-dev": "yarn wasm-prep && (cd rust && wasm-pack build kcl-wasm-lib --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt:generated",
|
||||
"build:wasm": "./scripts/build-wasm.sh",
|
||||
"build:wasm:windows": "./scripts/build-wasm.ps1",
|
||||
"remove-importmeta": "sed -i 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\"; sed -i '' 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\" || echo \"sed for both mac and linux\"",
|
||||
@ -212,6 +214,7 @@
|
||||
"typescript-eslint": "^8.26.1",
|
||||
"vite": "^5.4.12",
|
||||
"vite-plugin-package-version": "^1.1.0",
|
||||
"vite-plugin-top-level-await": "^1.5.0",
|
||||
"vite-tsconfig-paths": "^4.3.2",
|
||||
"vitest": "^1.6.1",
|
||||
"vitest-webgl-canvas-mock": "^1.1.0",
|
||||
|
||||
@ -20,7 +20,7 @@ statement[@isGroup=Statement] {
|
||||
ImportStatement { kw<"import"> ImportItems ImportFrom String } |
|
||||
FunctionDeclaration { kw<"export">? kw<"fn"> VariableDefinition Equals? ParamList Arrow? Body } |
|
||||
VariableDeclaration { kw<"export">? (kw<"var"> | kw<"let"> | kw<"const">)? VariableDefinition Equals expression } |
|
||||
TypeDeclaration { kw<"export">? kw<"type"> identifier } |
|
||||
TypeDeclaration { kw<"export">? kw<"type"> identifier ("=" type)? } |
|
||||
ReturnStatement { kw<"return"> expression } |
|
||||
ExpressionStatement { expression } |
|
||||
Annotation { AnnotationName AnnotationList? }
|
||||
@ -75,11 +75,8 @@ LabeledArgument { ArgumentLabel Equals expression }
|
||||
ArgumentList { "(" commaSep<LabeledArgument | expression> ")" }
|
||||
|
||||
type[@isGroup=Type] {
|
||||
@specialize[@name=PrimitiveType]<
|
||||
identifier,
|
||||
"bool" | "number" | "string" | "tag" | "Sketch" | "SketchSurface" | "Solid" | "Plane"
|
||||
> |
|
||||
ArrayType { type !member "[" "]" } |
|
||||
PrimitiveType { identifier } |
|
||||
ArrayType { "[" type !member (";" Number "+"?)? "]" } |
|
||||
ObjectType { "{" commaSep<ObjectProperty { PropertyName ":" type }> "}" }
|
||||
}
|
||||
|
||||
@ -137,7 +134,7 @@ commaSep1NoTrailingComma<term> { term ("," term)* }
|
||||
"(" ")"
|
||||
"{" "}"
|
||||
"[" "]"
|
||||
"," "?" ":" "." ".."
|
||||
"," "?" ":" "." ".." ";"
|
||||
}
|
||||
|
||||
@external propSource kclHighlight from "./highlight"
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { defineConfig, devices } from '@playwright/test'
|
||||
import { platform } from 'os'
|
||||
|
||||
/**
|
||||
* See https://playwright.dev/docs/test-configuration.
|
||||
@ -13,7 +14,7 @@ export default defineConfig({
|
||||
/* Do not retry */
|
||||
retries: 0,
|
||||
/* Different amount of parallelism on CI and local. */
|
||||
workers: 1,
|
||||
workers: platform() === 'win32' ? 1 : 2,
|
||||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||
reporter: [
|
||||
['dot'],
|
||||
|
||||
@ -23,78 +23,80 @@ KCL samples conform to a set of style guidelines to ensure consistency and reada
|
||||
When you submit a PR to add or modify KCL samples, images and STEP files will be generated and added to the repository automatically.
|
||||
|
||||
---
|
||||
#### [80-20-rail](80-20-rail/main.kcl) ([step](step/80-20-rail.step)) ([screenshot](screenshots/80-20-rail.png))
|
||||
#### [80-20-rail](80-20-rail/main.kcl) ([screenshot](screenshots/80-20-rail.png))
|
||||
[](80-20-rail/main.kcl)
|
||||
#### [a-parametric-bearing-pillow-block](a-parametric-bearing-pillow-block/main.kcl) ([step](step/a-parametric-bearing-pillow-block.step)) ([screenshot](screenshots/a-parametric-bearing-pillow-block.png))
|
||||
#### [a-parametric-bearing-pillow-block](a-parametric-bearing-pillow-block/main.kcl) ([screenshot](screenshots/a-parametric-bearing-pillow-block.png))
|
||||
[](a-parametric-bearing-pillow-block/main.kcl)
|
||||
#### [ball-bearing](ball-bearing/main.kcl) ([step](step/ball-bearing.step)) ([screenshot](screenshots/ball-bearing.png))
|
||||
#### [ball-bearing](ball-bearing/main.kcl) ([screenshot](screenshots/ball-bearing.png))
|
||||
[](ball-bearing/main.kcl)
|
||||
#### [bench](bench/main.kcl) ([step](step/bench.step)) ([screenshot](screenshots/bench.png))
|
||||
#### [bench](bench/main.kcl) ([screenshot](screenshots/bench.png))
|
||||
[](bench/main.kcl)
|
||||
#### [bracket](bracket/main.kcl) ([step](step/bracket.step)) ([screenshot](screenshots/bracket.png))
|
||||
#### [bracket](bracket/main.kcl) ([screenshot](screenshots/bracket.png))
|
||||
[](bracket/main.kcl)
|
||||
#### [car-wheel-assembly](car-wheel-assembly/main.kcl) ([step](step/car-wheel-assembly.step)) ([screenshot](screenshots/car-wheel-assembly.png))
|
||||
#### [car-wheel-assembly](car-wheel-assembly/main.kcl) ([screenshot](screenshots/car-wheel-assembly.png))
|
||||
[](car-wheel-assembly/main.kcl)
|
||||
#### [color-cube](color-cube/main.kcl) ([step](step/color-cube.step)) ([screenshot](screenshots/color-cube.png))
|
||||
#### [color-cube](color-cube/main.kcl) ([screenshot](screenshots/color-cube.png))
|
||||
[](color-cube/main.kcl)
|
||||
#### [cycloidal-gear](cycloidal-gear/main.kcl) ([step](step/cycloidal-gear.step)) ([screenshot](screenshots/cycloidal-gear.png))
|
||||
#### [cycloidal-gear](cycloidal-gear/main.kcl) ([screenshot](screenshots/cycloidal-gear.png))
|
||||
[](cycloidal-gear/main.kcl)
|
||||
#### [dodecahedron](dodecahedron/main.kcl) ([step](step/dodecahedron.step)) ([screenshot](screenshots/dodecahedron.png))
|
||||
#### [dodecahedron](dodecahedron/main.kcl) ([screenshot](screenshots/dodecahedron.png))
|
||||
[](dodecahedron/main.kcl)
|
||||
#### [enclosure](enclosure/main.kcl) ([step](step/enclosure.step)) ([screenshot](screenshots/enclosure.png))
|
||||
#### [enclosure](enclosure/main.kcl) ([screenshot](screenshots/enclosure.png))
|
||||
[](enclosure/main.kcl)
|
||||
#### [exhaust-manifold](exhaust-manifold/main.kcl) ([step](step/exhaust-manifold.step)) ([screenshot](screenshots/exhaust-manifold.png))
|
||||
#### [exhaust-manifold](exhaust-manifold/main.kcl) ([screenshot](screenshots/exhaust-manifold.png))
|
||||
[](exhaust-manifold/main.kcl)
|
||||
#### [flange](flange/main.kcl) ([step](step/flange.step)) ([screenshot](screenshots/flange.png))
|
||||
#### [flange](flange/main.kcl) ([screenshot](screenshots/flange.png))
|
||||
[](flange/main.kcl)
|
||||
#### [focusrite-scarlett-mounting-bracket](focusrite-scarlett-mounting-bracket/main.kcl) ([step](step/focusrite-scarlett-mounting-bracket.step)) ([screenshot](screenshots/focusrite-scarlett-mounting-bracket.png))
|
||||
#### [focusrite-scarlett-mounting-bracket](focusrite-scarlett-mounting-bracket/main.kcl) ([screenshot](screenshots/focusrite-scarlett-mounting-bracket.png))
|
||||
[](focusrite-scarlett-mounting-bracket/main.kcl)
|
||||
#### [food-service-spatula](food-service-spatula/main.kcl) ([step](step/food-service-spatula.step)) ([screenshot](screenshots/food-service-spatula.png))
|
||||
#### [food-service-spatula](food-service-spatula/main.kcl) ([screenshot](screenshots/food-service-spatula.png))
|
||||
[](food-service-spatula/main.kcl)
|
||||
#### [french-press](french-press/main.kcl) ([step](step/french-press.step)) ([screenshot](screenshots/french-press.png))
|
||||
#### [french-press](french-press/main.kcl) ([screenshot](screenshots/french-press.png))
|
||||
[](french-press/main.kcl)
|
||||
#### [gear](gear/main.kcl) ([step](step/gear.step)) ([screenshot](screenshots/gear.png))
|
||||
#### [gear](gear/main.kcl) ([screenshot](screenshots/gear.png))
|
||||
[](gear/main.kcl)
|
||||
#### [gear-rack](gear-rack/main.kcl) ([step](step/gear-rack.step)) ([screenshot](screenshots/gear-rack.png))
|
||||
#### [gear-rack](gear-rack/main.kcl) ([screenshot](screenshots/gear-rack.png))
|
||||
[](gear-rack/main.kcl)
|
||||
#### [gridfinity-baseplate](gridfinity-baseplate/main.kcl) ([step](step/gridfinity-baseplate.step)) ([screenshot](screenshots/gridfinity-baseplate.png))
|
||||
#### [gridfinity-baseplate](gridfinity-baseplate/main.kcl) ([screenshot](screenshots/gridfinity-baseplate.png))
|
||||
[](gridfinity-baseplate/main.kcl)
|
||||
#### [gridfinity-baseplate-magnets](gridfinity-baseplate-magnets/main.kcl) ([step](step/gridfinity-baseplate-magnets.step)) ([screenshot](screenshots/gridfinity-baseplate-magnets.png))
|
||||
#### [gridfinity-baseplate-magnets](gridfinity-baseplate-magnets/main.kcl) ([screenshot](screenshots/gridfinity-baseplate-magnets.png))
|
||||
[](gridfinity-baseplate-magnets/main.kcl)
|
||||
#### [gridfinity-bins](gridfinity-bins/main.kcl) ([step](step/gridfinity-bins.step)) ([screenshot](screenshots/gridfinity-bins.png))
|
||||
#### [gridfinity-bins](gridfinity-bins/main.kcl) ([screenshot](screenshots/gridfinity-bins.png))
|
||||
[](gridfinity-bins/main.kcl)
|
||||
#### [gridfinity-bins-stacking-lip](gridfinity-bins-stacking-lip/main.kcl) ([step](step/gridfinity-bins-stacking-lip.step)) ([screenshot](screenshots/gridfinity-bins-stacking-lip.png))
|
||||
#### [gridfinity-bins-stacking-lip](gridfinity-bins-stacking-lip/main.kcl) ([screenshot](screenshots/gridfinity-bins-stacking-lip.png))
|
||||
[](gridfinity-bins-stacking-lip/main.kcl)
|
||||
#### [hex-nut](hex-nut/main.kcl) ([step](step/hex-nut.step)) ([screenshot](screenshots/hex-nut.png))
|
||||
#### [hex-nut](hex-nut/main.kcl) ([screenshot](screenshots/hex-nut.png))
|
||||
[](hex-nut/main.kcl)
|
||||
#### [i-beam](i-beam/main.kcl) ([step](step/i-beam.step)) ([screenshot](screenshots/i-beam.png))
|
||||
#### [i-beam](i-beam/main.kcl) ([screenshot](screenshots/i-beam.png))
|
||||
[](i-beam/main.kcl)
|
||||
#### [kitt](kitt/main.kcl) ([step](step/kitt.step)) ([screenshot](screenshots/kitt.png))
|
||||
#### [keyboard](keyboard/main.kcl) ([screenshot](screenshots/keyboard.png))
|
||||
[](keyboard/main.kcl)
|
||||
#### [kitt](kitt/main.kcl) ([screenshot](screenshots/kitt.png))
|
||||
[](kitt/main.kcl)
|
||||
#### [lego](lego/main.kcl) ([step](step/lego.step)) ([screenshot](screenshots/lego.png))
|
||||
#### [lego](lego/main.kcl) ([screenshot](screenshots/lego.png))
|
||||
[](lego/main.kcl)
|
||||
#### [mounting-plate](mounting-plate/main.kcl) ([step](step/mounting-plate.step)) ([screenshot](screenshots/mounting-plate.png))
|
||||
#### [mounting-plate](mounting-plate/main.kcl) ([screenshot](screenshots/mounting-plate.png))
|
||||
[](mounting-plate/main.kcl)
|
||||
#### [multi-axis-robot](multi-axis-robot/main.kcl) ([step](step/multi-axis-robot.step)) ([screenshot](screenshots/multi-axis-robot.png))
|
||||
#### [multi-axis-robot](multi-axis-robot/main.kcl) ([screenshot](screenshots/multi-axis-robot.png))
|
||||
[](multi-axis-robot/main.kcl)
|
||||
#### [pipe](pipe/main.kcl) ([step](step/pipe.step)) ([screenshot](screenshots/pipe.png))
|
||||
#### [pipe](pipe/main.kcl) ([screenshot](screenshots/pipe.png))
|
||||
[](pipe/main.kcl)
|
||||
#### [pipe-flange-assembly](pipe-flange-assembly/main.kcl) ([step](step/pipe-flange-assembly.step)) ([screenshot](screenshots/pipe-flange-assembly.png))
|
||||
#### [pipe-flange-assembly](pipe-flange-assembly/main.kcl) ([screenshot](screenshots/pipe-flange-assembly.png))
|
||||
[](pipe-flange-assembly/main.kcl)
|
||||
#### [pipe-with-bend](pipe-with-bend/main.kcl) ([step](step/pipe-with-bend.step)) ([screenshot](screenshots/pipe-with-bend.png))
|
||||
#### [pipe-with-bend](pipe-with-bend/main.kcl) ([screenshot](screenshots/pipe-with-bend.png))
|
||||
[](pipe-with-bend/main.kcl)
|
||||
#### [poopy-shoe](poopy-shoe/main.kcl) ([step](step/poopy-shoe.step)) ([screenshot](screenshots/poopy-shoe.png))
|
||||
#### [poopy-shoe](poopy-shoe/main.kcl) ([screenshot](screenshots/poopy-shoe.png))
|
||||
[](poopy-shoe/main.kcl)
|
||||
#### [router-template-cross-bar](router-template-cross-bar/main.kcl) ([step](step/router-template-cross-bar.step)) ([screenshot](screenshots/router-template-cross-bar.png))
|
||||
#### [router-template-cross-bar](router-template-cross-bar/main.kcl) ([screenshot](screenshots/router-template-cross-bar.png))
|
||||
[](router-template-cross-bar/main.kcl)
|
||||
#### [router-template-slate](router-template-slate/main.kcl) ([step](step/router-template-slate.step)) ([screenshot](screenshots/router-template-slate.png))
|
||||
#### [router-template-slate](router-template-slate/main.kcl) ([screenshot](screenshots/router-template-slate.png))
|
||||
[](router-template-slate/main.kcl)
|
||||
#### [sheet-metal-bracket](sheet-metal-bracket/main.kcl) ([step](step/sheet-metal-bracket.step)) ([screenshot](screenshots/sheet-metal-bracket.png))
|
||||
#### [sheet-metal-bracket](sheet-metal-bracket/main.kcl) ([screenshot](screenshots/sheet-metal-bracket.png))
|
||||
[](sheet-metal-bracket/main.kcl)
|
||||
#### [socket-head-cap-screw](socket-head-cap-screw/main.kcl) ([step](step/socket-head-cap-screw.step)) ([screenshot](screenshots/socket-head-cap-screw.png))
|
||||
#### [socket-head-cap-screw](socket-head-cap-screw/main.kcl) ([screenshot](screenshots/socket-head-cap-screw.png))
|
||||
[](socket-head-cap-screw/main.kcl)
|
||||
#### [walkie-talkie](walkie-talkie/main.kcl) ([step](step/walkie-talkie.step)) ([screenshot](screenshots/walkie-talkie.png))
|
||||
#### [walkie-talkie](walkie-talkie/main.kcl) ([screenshot](screenshots/walkie-talkie.png))
|
||||
[](walkie-talkie/main.kcl)
|
||||
#### [washer](washer/main.kcl) ([step](step/washer.step)) ([screenshot](screenshots/washer.png))
|
||||
#### [washer](washer/main.kcl) ([screenshot](screenshots/washer.png))
|
||||
[](washer/main.kcl)
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ ballsSketch = startSketchOn("XY")
|
||||
|> close()
|
||||
|
||||
// Revolve the ball to make a sphere and pattern around the inside wall
|
||||
balls = revolve({ axis = "X" }, ballsSketch)
|
||||
balls = revolve(ballsSketch, axis = "X")
|
||||
|> patternCircular3d(
|
||||
arcDegrees = 360,
|
||||
axis = [0, 0, 1],
|
||||
@ -66,7 +66,7 @@ chainSketch = startSketchOn("XY")
|
||||
|> close()
|
||||
|
||||
// Revolve the chain sketch
|
||||
chainHead = revolve({ axis = "X" }, chainSketch)
|
||||
chainHead = revolve(chainSketch, axis = "X")
|
||||
|> patternCircular3d(
|
||||
arcDegrees = 360,
|
||||
axis = [0, 0, 1],
|
||||
@ -86,7 +86,7 @@ linkSketch = startSketchOn("XZ")
|
||||
)
|
||||
|
||||
// Revolve the link sketch
|
||||
linkRevolve = revolve({ axis = 'Y', angle = 360 / nBalls }, linkSketch)
|
||||
linkRevolve = revolve(linkSketch, axis = 'Y', angle = 360 / nBalls)
|
||||
|> patternCircular3d(
|
||||
arcDegrees = 360,
|
||||
axis = [0, 0, 1],
|
||||
|
||||
@ -82,5 +82,5 @@ brakeCaliperSketch = startSketchOn('XY')
|
||||
|> close()
|
||||
|
||||
// Revolve the brake caliper sketch
|
||||
revolve({ axis = "Y", angle = -70 }, brakeCaliperSketch)
|
||||
revolve(brakeCaliperSketch, axis = "Y", angle = -70)
|
||||
|> appearance(color = "#c82d2d", metalness = 90, roughness = 90)
|
||||
|
||||
@ -40,5 +40,5 @@ tireSketch = startSketchOn("XY")
|
||||
|> close()
|
||||
|
||||
// Revolve the sketch to create the tire
|
||||
revolve({ axis = "Y" }, tireSketch)
|
||||
revolve(tireSketch, axis = "Y")
|
||||
|> appearance(color = "#0f0f0f", roughness = 80)
|
||||
|
||||
@ -74,7 +74,7 @@ wheelCenterInner = startSketchOn('XY')
|
||||
|> yLine(endAbsolute = 0)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> revolve({ axis = 'y' }, %)
|
||||
|> revolve(axis = 'y')
|
||||
|> appearance(color = "#ffffff", metalness = 0, roughness = 0)
|
||||
|
||||
wheelCenterOuter = startSketchOn('XY')
|
||||
@ -88,7 +88,7 @@ wheelCenterOuter = startSketchOn('XY')
|
||||
|> yLine(endAbsolute = -wheelWidth / 20)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> revolve({ axis = 'y' }, %)
|
||||
|> revolve(axis = 'y')
|
||||
|> appearance(color = "#ffffff", metalness = 0, roughness = 0)
|
||||
|
||||
// Write a function that defines the spoke geometry, patterns and extrudes it
|
||||
@ -193,5 +193,5 @@ startSketchOn('XY')
|
||||
|> xLine(length = wheelWidth * 0.03)
|
||||
|> yLine(length = wheelWidth * 0.05)
|
||||
|> close()
|
||||
|> revolve({ axis = 'y' }, %)
|
||||
|> revolve(axis = 'y')
|
||||
|> appearance(color = "#ffffff", metalness = 0, roughness = 0)
|
||||
|
||||
@ -34,7 +34,7 @@ fn lug(plane, length, diameter) {
|
||||
|> xLine(endAbsolute = lugThreadDiameter)
|
||||
|> yLine(endAbsolute = 0)
|
||||
|> close()
|
||||
|> revolve({ axis = "Y" }, %)
|
||||
|> revolve(axis = "Y")
|
||||
|> appearance(color = "#dbcd70", roughness = 90, metalness = 90)
|
||||
return lugSketch
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ sketch001 = startSketchOn('XZ')
|
||||
], %, $rectangleSegmentC001)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> revolve({ angle = 360, axis = 'Y' }, %)
|
||||
|> revolve(angle = 360, axis = 'Y')
|
||||
|
||||
// Create an angled plane to sketch the supports
|
||||
plane001 = {
|
||||
@ -135,7 +135,7 @@ sketch005 = startSketchOn('XZ')
|
||||
|> xLine(endAbsolute = 0.15)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> revolve({ axis = 'y' }, %)
|
||||
|> revolve(axis = 'y')
|
||||
|
||||
// Plunger and stem
|
||||
sketch006 = startSketchOn('XZ')
|
||||
@ -148,7 +148,7 @@ sketch006 = startSketchOn('XZ')
|
||||
|> tangentialArc({ radius = 0.6, offset = -90 }, %)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> revolve({ axis = 'y' }, %)
|
||||
|> revolve(axis = 'y')
|
||||
|
||||
// Spiral plate
|
||||
sketch007 = startSketchOn(offsetPlane('XY', offset = 1.12))
|
||||
@ -210,7 +210,7 @@ sketch011 = startSketchOn('XZ')
|
||||
}, %)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> revolve({ axis = 'y' }, %)
|
||||
|> revolve(axis = 'y')
|
||||
|
||||
// Draw and extrude handle
|
||||
sketch012 = startSketchOn(offsetPlane('XZ', offset = handleThickness / 2))
|
||||
|
||||
@ -55,7 +55,7 @@ axis000 = {
|
||||
}
|
||||
|
||||
// create a single corner of the bin
|
||||
singleCorner = revolve({ angle = -90, axis = axis000 }, face(offsetPlane("YZ", offset = cornerRadius)))
|
||||
singleCorner = revolve(face(offsetPlane("YZ", offset = cornerRadius)), angle = -90, axis = axis000)
|
||||
|
||||
// create the corners of the bin
|
||||
corners = patternCircular3d(
|
||||
|
||||
@ -52,7 +52,7 @@ axis000 = {
|
||||
}
|
||||
|
||||
// create a single corner of the bin
|
||||
singleCorner = revolve({ angle = -90, axis = axis000 }, face(offsetPlane("YZ", offset = cornerRadius)))
|
||||
singleCorner = revolve(face(offsetPlane("YZ", offset = cornerRadius)), angle = -90, axis = axis000)
|
||||
|
||||
// create the corners of the bin
|
||||
corners = patternCircular3d(
|
||||
|
||||
@ -75,7 +75,7 @@ axis000 = {
|
||||
}
|
||||
|
||||
// create a single corner of the bin
|
||||
singleCorner = revolve({ angle = -90, axis = axis000 }, face(offsetPlane("YZ", offset = cornerRadius + binTol)))
|
||||
singleCorner = revolve(face(offsetPlane("YZ", offset = cornerRadius + binTol)), angle = -90, axis = axis000)
|
||||
|
||||
// create the corners of the bin
|
||||
corners = patternCircular3d(
|
||||
@ -291,10 +291,10 @@ axis001 = {
|
||||
}
|
||||
|
||||
// create a single corner of the bin
|
||||
lipSingleLengthCorner = revolve({ angle = -90, axis = axis001 }, lipFace(plane000))
|
||||
lipSingleLengthCorner = revolve(lipFace(plane000), angle = -90, axis = axis001)
|
||||
|
||||
// create a single corner of the bin
|
||||
lipSingleWidthCorner = revolve({ angle = 90, axis = axis001 }, lipFace(plane002))
|
||||
lipSingleWidthCorner = revolve(lipFace(plane002), angle = 90, axis = axis001)
|
||||
|
||||
// create the corners of the bin
|
||||
lipCorners000 = patternCircular3d(
|
||||
|
||||
@ -68,7 +68,7 @@ axis000 = {
|
||||
}
|
||||
|
||||
// create a single corner of the bin
|
||||
singleCorner = revolve({ angle = -90, axis = axis000 }, face(offsetPlane("YZ", offset = cornerRadius + binTol)))
|
||||
singleCorner = revolve(face(offsetPlane("YZ", offset = cornerRadius + binTol)), angle = -90, axis = axis000)
|
||||
|
||||
// create the corners of the bin
|
||||
corners = patternCircular3d(
|
||||
|
||||
233
public/kcl-samples/keyboard/main.kcl
Normal file
@ -0,0 +1,233 @@
|
||||
// Zoo Keyboard
|
||||
// A custom keyboard with Zoo brand lettering
|
||||
|
||||
// Set Units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
// Define constants
|
||||
baseColor = "#0f0f0f"
|
||||
highlightColor1 = "#b0b0b0"
|
||||
highlightColor2 = "#23af93"
|
||||
keyHeight = 0.8
|
||||
keyDepth = 0.1
|
||||
spacing = 0.1
|
||||
row1 = spacing * 3
|
||||
row2 = row1 + keyHeight + spacing
|
||||
row3 = row2 + keyHeight + spacing
|
||||
row4 = row3 + keyHeight + spacing
|
||||
row5 = row4 + keyHeight + spacing
|
||||
row6 = row5 + keyHeight + spacing
|
||||
|
||||
// Sketch the side profile of the keyboard base and extrude to total width
|
||||
sketch001 = startSketchOn('YZ')
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(end = [-0.14, 0.68], tag = $seg01)
|
||||
|> angledLine([7, row6 + 3 * spacing + keyHeight], %, $seg02)
|
||||
|> line(endAbsolute = [5.13, 0], tag = $seg03)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg04)
|
||||
|> close()
|
||||
|> extrude(length = 13.6)
|
||||
|> appearance(color = baseColor)
|
||||
|> fillet(
|
||||
radius = .6,
|
||||
tags = [
|
||||
getOppositeEdge(seg01),
|
||||
getOppositeEdge(seg03),
|
||||
seg01,
|
||||
seg03
|
||||
],
|
||||
)
|
||||
|
||||
// Create a short cylindrical foot at each corner of the keyboard
|
||||
sketch003 = startSketchOn(sketch001, seg04)
|
||||
profile001 = circle(sketch003, center = [0.75, 0.75], radius = 0.4)
|
||||
profile003 = circle(sketch003, center = [4.4, 0.75], radius = 0.4)
|
||||
profile004 = circle(sketch003, center = [0.73, 13.6 - .75], radius = 0.4)
|
||||
profile005 = circle(sketch003, center = [4.4, 13.6 - .75], radius = 0.4)
|
||||
extrude(
|
||||
[
|
||||
profile001,
|
||||
profile003,
|
||||
profile004,
|
||||
profile005
|
||||
],
|
||||
length = .15,
|
||||
)
|
||||
|
||||
// Define the plane to sketch keyboard keys on
|
||||
plane001 = {
|
||||
plane = {
|
||||
origin = [0.0, 0.0, 0.7],
|
||||
xAxis = [1.0, 0.0, 0.0],
|
||||
yAxis = [0.0, 1.0, sin(toRadians(7))],
|
||||
zAxis = [0.0, 0.0, 1.0]
|
||||
}
|
||||
}
|
||||
|
||||
// Create a function to build a key. Parameterize for position, width, height, number of instances, and appearance color.
|
||||
fn keyFn(originStart, keyWidth, keyHeight, repeats, color) {
|
||||
sketch002 = startSketchOn(plane001)
|
||||
profile002 = startProfileAt([originStart[0], originStart[1]], sketch002)
|
||||
|> arc({
|
||||
angleStart = 180,
|
||||
angleEnd = 270,
|
||||
radius = 0.1
|
||||
}, %)
|
||||
|> angledLine([0, keyWidth - .2], %, $rectangleSegmentA001)
|
||||
|> tangentialArc({ radius = 0.1, offset = 90 }, %)
|
||||
|> angledLine([
|
||||
segAng(rectangleSegmentA001) + 90,
|
||||
keyHeight - .2
|
||||
], %, $rectangleSegmentB001)
|
||||
|> tangentialArc({ radius = 0.1, offset = 90 }, %)
|
||||
|> angledLine([
|
||||
segAng(rectangleSegmentA001),
|
||||
-segLen(rectangleSegmentA001)
|
||||
], %, $rectangleSegmentC001)
|
||||
|> tangentialArc({ radius = 0.1, offset = 90 }, %)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $rectangleSegmentD001)
|
||||
|> close()
|
||||
|> extrude(length = keyDepth)
|
||||
|> appearance(color = color)
|
||||
// Repeat key when desired. This will default to zero
|
||||
|> patternLinear3d(
|
||||
%,
|
||||
instances = repeats + 1,
|
||||
distance = keyWidth + spacing,
|
||||
axis = [1, 0, 0],
|
||||
)
|
||||
return sketch001
|
||||
}
|
||||
|
||||
// Build the first row of keys
|
||||
keyFn([0.3, row1], 1.1, keyHeight, 0, highlightColor2)
|
||||
keyFn([1.5, row1], 0.8, keyHeight, 2, highlightColor1)
|
||||
keyFn([spacing * 7 + 3.5, row1], 5.2, keyHeight, 0, highlightColor2)
|
||||
keyFn([spacing * 8 + 8.7, row1], 0.8, keyHeight, 0, highlightColor1)
|
||||
keyFn([spacing * 8 + 9.6, row1], 0.8, keyHeight, 0, highlightColor1)
|
||||
keyFn([spacing * 10 + 10.3, row1], 1.1, keyHeight, 0, highlightColor1)
|
||||
keyFn([spacing * 12 + 10.3 + 1, row1], 0.8, keyHeight, 0, highlightColor2)
|
||||
|
||||
// Build the second row of keys
|
||||
keyFn([spacing * 3, row2], 1.7, keyHeight, 0, highlightColor2)
|
||||
keyFn([spacing * 4 + 1.7, row2], 0.8, keyHeight, 9, highlightColor1)
|
||||
keyFn([spacing * 14 + 1.7 + 0.8 * 10, row2], 2.2, keyHeight, 0, highlightColor2)
|
||||
|
||||
// Build the third row of keys
|
||||
keyFn([spacing * 3, row3], 1.1 + .1, keyHeight, 0, highlightColor1)
|
||||
keyFn([spacing * 4 + 1.1 + .1, row3], 0.8, keyHeight, 10, highlightColor1)
|
||||
keyFn([spacing * 3 + 11.1 + .1, row3], 1.4 + .4, keyHeight, 0, highlightColor2)
|
||||
|
||||
// Build the fourth row of keys
|
||||
keyFn([spacing * 3, row4], 0.9, keyHeight, 0, highlightColor1)
|
||||
keyFn([spacing * 4 + 0.9, row4], 0.8, keyHeight, 11, highlightColor1)
|
||||
keyFn([spacing * 3 + 11.8, row4], 1.2, keyHeight, 0, highlightColor1)
|
||||
|
||||
// Build the fifth row of keys
|
||||
keyFn([spacing * 3, row5], 0.8, keyHeight, 12, highlightColor1)
|
||||
keyFn([spacing * 3 + 11.7, row5], 1.3, keyHeight, 0, highlightColor2)
|
||||
|
||||
// Build the sixth row of keys
|
||||
keyFn([spacing * 3, row6], 1.1, keyHeight * .6, 0, highlightColor2)
|
||||
keyFn([spacing * 4 + 1.1, row6], 0.8, keyHeight * .6, 11, highlightColor1)
|
||||
keyFn([spacing * 3 + 12, row6], 1, keyHeight * .6, 0, highlightColor2)
|
||||
|
||||
// Create a plane to sketch ZOO brand letters on
|
||||
plane002 = {
|
||||
plane = {
|
||||
origin = [0.0, 0.0, .81],
|
||||
xAxis = [1.0, 0.0, 0.0],
|
||||
yAxis = [0.0, 1.0, sin(toRadians(7))],
|
||||
zAxis = [0.0, 0.0, 1.0]
|
||||
}
|
||||
}
|
||||
|
||||
// Define a function to draw the ZOO 'Z'
|
||||
fn z(origin, scale, depth) {
|
||||
z = startSketchOn(plane002)
|
||||
|> startProfileAt([
|
||||
0 + origin[0],
|
||||
0.15 * scale + origin[1]
|
||||
], %)
|
||||
|> yLine(length = -0.15 * scale)
|
||||
|> xLine(length = 0.15 * scale)
|
||||
|> angledLineToX({
|
||||
angle = 47.15,
|
||||
to = 0.3 * scale + origin[0]
|
||||
}, %, $seg1)
|
||||
|> yLine(endAbsolute = 0 + origin[1], tag = $seg3)
|
||||
|> xLine(length = 0.63 * scale)
|
||||
|> yLine(length = 0.225 * scale)
|
||||
|> xLine(length = -0.57 * scale)
|
||||
|> angledLineToX({
|
||||
angle = 47.15,
|
||||
to = 0.93 * scale + origin[0]
|
||||
}, %)
|
||||
|> yLine(length = 0.15 * scale)
|
||||
|> xLine(length = -0.15 * scale)
|
||||
|> angledLine({
|
||||
angle = 47.15,
|
||||
length = -segLen(seg1)
|
||||
}, %, $seg2)
|
||||
|> yLine(length = segLen(seg3))
|
||||
|> xLine(endAbsolute = 0 + origin[0])
|
||||
|> yLine(length = -0.225 * scale)
|
||||
|> angledLineThatIntersects({
|
||||
angle = 0,
|
||||
intersectTag = seg2,
|
||||
offset = 0
|
||||
}, %)
|
||||
|> close()
|
||||
|> extrude(length = -depth)
|
||||
|> appearance(color = baseColor)
|
||||
return z
|
||||
}
|
||||
|
||||
// Define a function to draw the ZOO 'O'
|
||||
fn o(origin, scale, depth) {
|
||||
oSketch001 = startSketchOn(plane002)
|
||||
|> startProfileAt([
|
||||
.788 * scale + origin[0],
|
||||
.921 * scale + origin[1]
|
||||
], %)
|
||||
|> arc({
|
||||
angleStart = 47.15 + 6,
|
||||
angleEnd = 47.15 - 6 + 180,
|
||||
radius = .525 * scale
|
||||
}, %)
|
||||
|> angledLine({ angle = 47.15, length = .24 * scale }, %)
|
||||
|> arc({
|
||||
angleStart = 47.15 - 11 + 180,
|
||||
angleEnd = 47.15 + 11,
|
||||
radius = .288 * scale
|
||||
}, %)
|
||||
|> close()
|
||||
|> extrude(length = -depth)
|
||||
|> appearance(color = baseColor)
|
||||
|
||||
o = startSketchOn(plane002)
|
||||
|> startProfileAt([
|
||||
.16 * scale + origin[0],
|
||||
.079 * scale + origin[1]
|
||||
], %)
|
||||
|> arc({
|
||||
angleStart = 47.15 + 6 - 180,
|
||||
angleEnd = 47.15 - 6,
|
||||
radius = .525 * scale
|
||||
}, %)
|
||||
|> angledLine({ angle = 47.15, length = -.24 * scale }, %)
|
||||
|> arc({
|
||||
angleStart = 47.15 - 11,
|
||||
angleEnd = 47.15 + 11 - 180,
|
||||
radius = .288 * scale
|
||||
}, %)
|
||||
|> close()
|
||||
|> extrude(length = -depth)
|
||||
|> appearance(color = baseColor)
|
||||
return o
|
||||
}
|
||||
|
||||
// Place the Z logo on the Z key. Place the O logo on the O and P keys
|
||||
z([2.3, 1.3], .4, 0.03)
|
||||
o([8.71, row4 + .08], 0.4, 0.03)
|
||||
o([8.71 + 0.9, row4 + .08], 0.4, 0.03)
|
||||
@ -160,6 +160,13 @@
|
||||
"title": "I-beam",
|
||||
"description": "A structural metal beam with an I shaped cross section. Often used in construction"
|
||||
},
|
||||
{
|
||||
"file": "main.kcl",
|
||||
"pathFromProjectDirectoryToFirstFile": "keyboard/main.kcl",
|
||||
"multipleFiles": false,
|
||||
"title": "Zoo Keyboard",
|
||||
"description": "A custom keyboard with Zoo brand lettering"
|
||||
},
|
||||
{
|
||||
"file": "main.kcl",
|
||||
"pathFromProjectDirectoryToFirstFile": "kitt/main.kcl",
|
||||
@ -198,7 +205,7 @@
|
||||
{
|
||||
"file": "main.kcl",
|
||||
"pathFromProjectDirectoryToFirstFile": "pipe-flange-assembly/main.kcl",
|
||||
"multipleFiles": false,
|
||||
"multipleFiles": true,
|
||||
"title": "Pipe and Flange Assembly",
|
||||
"description": "A crucial component in various piping systems, designed to facilitate the connection, disconnection, and access to piping for inspection, cleaning, and modifications. This assembly combines pipes (long cylindrical conduits) with flanges (plate-like fittings) to create a secure yet detachable joint."
|
||||
},
|
||||
|
||||