Compare commits

..

1 Commits

Author SHA1 Message Date
f8f9bae4b5 Use kcl-samples 'next' branch 2025-02-18 10:21:11 -06:00
742 changed files with 41135 additions and 70620 deletions

13
.gitattributes vendored
View File

@ -1,13 +0,0 @@
# Set default behavior to automatically normalize line endings.
* text=auto
# Force batch scripts to always use CRLF line endings so that if a repo is accessed
# in Windows via a file share from Linux, the scripts will work.
*.{cmd,[cC][mM][dD]} text working-tree-encoding=UTF-16LE eol=CRLF
*.{bat,[bB][aA][tT]} text working-tree-encoding=UTF-16LE eol=CRLF
*.{ics,[iI][cC][sS]} text working-tree-encoding=UTF-16LE eol=CRLF
*.{ps1,[iP][sS][1]} text working-tree-encoding=UTF-16LE eol=CRLF
# Force bash scripts to always use LF line endings so that if a repo is accessed
# in Unix via a file share from Windows, the scripts will work.
*.sh text eol=lfol=lf

View File

@ -21,7 +21,7 @@ if [[ ! -f "test-results/.last-run.json" ]]; then
fi fi
retry=1 retry=1
max_retrys=1 max_retrys=5
# retry failed tests, doing our own retries because using inbuilt playwright retries causes connection issues # retry failed tests, doing our own retries because using inbuilt playwright retries causes connection issues
while [[ $retry -le $max_retrys ]]; do while [[ $retry -le $max_retrys ]]; do

View File

@ -22,9 +22,6 @@ jobs:
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
with: with:
workspaces: './src/wasm-lib' workspaces: './src/wasm-lib'
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with:
tool: wasm-pack
- name: build wasm - name: build wasm
run: yarn build:wasm run: yarn build:wasm

View File

@ -32,6 +32,7 @@ jobs:
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn install - run: yarn install
@ -43,10 +44,6 @@ jobs:
workspaces: './src/wasm-lib' workspaces: './src/wasm-lib'
# TODO: see if we can fetch from main instead if no diff at src/wasm-lib # TODO: see if we can fetch from main instead if no diff at src/wasm-lib
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with:
tool: wasm-pack
- name: Run build:wasm - name: Run build:wasm
run: "yarn build:wasm" run: "yarn build:wasm"
@ -123,13 +120,15 @@ jobs:
cp prepared-files/assets/icon.ico assets/icon.ico cp prepared-files/assets/icon.ico assets/icon.ico
cp prepared-files/assets/icon.png assets/icon.png cp prepared-files/assets/icon.png assets/icon.png
- uses: actions/setup-node@v4 - name: Sync node version and setup cache
uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' # Set this to npm, yarn or pnpm.
- name: yarn install - name: yarn install
# Windows is picky sometimes and fails on fetch. Step takes about ~30s # Windows is picky sometimes and fails on fetch. Step takes about ~30s
uses: nick-fields/retry@v3.0.1 uses: nick-fields/retry@v3.0.0
with: with:
timeout_minutes: 2 timeout_minutes: 2
max_attempts: 3 max_attempts: 3
@ -180,7 +179,7 @@ jobs:
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }} WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
DEBUG: "electron-notarize*" DEBUG: "electron-notarize*"
# TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures # TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures
uses: nick-fields/retry@v3.0.1 uses: nick-fields/retry@v3.0.0
with: with:
timeout_minutes: 10 timeout_minutes: 10
max_attempts: 3 max_attempts: 3
@ -241,7 +240,7 @@ jobs:
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }} WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
DEBUG: "electron-notarize*" DEBUG: "electron-notarize*"
# TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures # TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures
uses: nick-fields/retry@v3.0.1 uses: nick-fields/retry@v3.0.0
with: with:
timeout_minutes: 10 timeout_minutes: 10
max_attempts: 3 max_attempts: 3

View File

@ -46,7 +46,7 @@ jobs:
shell: bash shell: bash
run: |- run: |-
cd "${{ matrix.dir }}" cd "${{ matrix.dir }}"
cargo llvm-cov nextest --workspace --lcov --output-path lcov.info --test-threads=1 --retries=2 --no-fail-fast -P ci 2>&1 | tee /tmp/github-actions.log cargo llvm-cov nextest --workspace --lcov --output-path lcov.info --test-threads=1 --no-fail-fast -P ci 2>&1 | tee /tmp/github-actions.log
env: env:
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}} KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
RUST_MIN_STACK: 10485760000 RUST_MIN_STACK: 10485760000

View File

@ -27,20 +27,10 @@ jobs:
const owner = context.repo.owner; const owner = context.repo.owner;
const repo = context.repo.repo; const repo = context.repo.repo;
const { data: comments } = await github.rest.issues.listComments({ // Post a comment on the PR
await github.rest.issues.createComment({
owner, owner,
repo, repo,
issue_number issue_number,
body: message,
}); });
const commentExists = comments.some(comment => comment.body === message);
if (!commentExists) {
// Post a comment on the PR
await github.rest.issues.createComment({
owner,
repo,
issue_number,
body: message,
});
}

View File

@ -89,9 +89,6 @@ jobs:
continue-on-error: true continue-on-error: true
- name: Setup Rust - name: Setup Rust
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with:
tool: wasm-pack
- name: Cache Wasm (because rust diff) - name: Cache Wasm (because rust diff)
if: needs.check-rust-changes.outputs.rust-changed == 'true' if: needs.check-rust-changes.outputs.rust-changed == 'true'
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
@ -203,11 +200,9 @@ jobs:
- name: Run playwright/electron flow (with retries) - name: Run playwright/electron flow (with retries)
id: retry id: retry
if: ${{ !cancelled() && (success() || failure()) }} if: ${{ !cancelled() && (success() || failure()) }}
uses: nick-fields/retry@v3.0.1 shell: bash
with: run: |
command: .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}} .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}}
timeout_minutes: 30
max_attempts: 25
env: env:
CI: true CI: true
FAIL_ON_CONSOLE_ERRORS: true FAIL_ON_CONSOLE_ERRORS: true

View File

@ -37,9 +37,6 @@ jobs:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
cache: 'yarn' cache: 'yarn'
- run: yarn install - run: yarn install
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with:
tool: wasm-pack
- run: yarn build:wasm - run: yarn build:wasm
yarn-tsc: yarn-tsc:
@ -56,9 +53,6 @@ jobs:
with: with:
workspaces: './src/wasm-lib' workspaces: './src/wasm-lib'
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with:
tool: wasm-pack
- run: yarn build:wasm - run: yarn build:wasm
- run: yarn tsc - run: yarn tsc
@ -98,9 +92,6 @@ jobs:
cache: 'yarn' cache: 'yarn'
- run: yarn install - run: yarn install
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with:
tool: wasm-pack
- run: yarn build:wasm - run: yarn build:wasm
- run: yarn simpleserver:bg - run: yarn simpleserver:bg
@ -127,9 +118,6 @@ jobs:
cache: 'yarn' cache: 'yarn'
- run: yarn install - run: yarn install
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with:
tool: wasm-pack
- run: yarn build:wasm - run: yarn build:wasm
- run: yarn simpleserver:bg - run: yarn simpleserver:bg

5
.gitignore vendored
View File

@ -24,7 +24,7 @@ yarn-debug.log*
yarn-error.log* yarn-error.log*
.idea .idea
# .vscode .vscode
.helix .helix
src/wasm-lib/.idea src/wasm-lib/.idea
src/wasm-lib/.vscode src/wasm-lib/.vscode
@ -41,12 +41,9 @@ e2e/playwright/playwright-secrets.env
e2e/playwright/temp1.png e2e/playwright/temp1.png
e2e/playwright/temp2.png e2e/playwright/temp2.png
e2e/playwright/temp3.png e2e/playwright/temp3.png
# this will be overridden for specific directories
e2e/playwright/**/*.png
# exports from snapshot-tests.spec.ts "exports of each format should work" # exports from snapshot-tests.spec.ts "exports of each format should work"
e2e/playwright/export-snapshots/* e2e/playwright/export-snapshots/*
!e2e/playwright/export-snapshots/*.png !e2e/playwright/export-snapshots/*.png
!e2e/playwright/snapshot-tests.spec.ts-snapshots/*.png
/kcl-samples /kcl-samples
/test-results/ /test-results/

View File

@ -1,5 +0,0 @@
{
"rust-analyzer.linkedProjects": [
"src/wasm-lib/Cargo.toml"
]
}

View File

@ -48,49 +48,22 @@ We recommend downloading the latest application binary from [our Releases page](
## Running a development build ## Running a development build
Install a node version manager such as [fnm](https://github.com/Schniz/fnm?tab=readme-ov-#installation). First, [install Rust via `rustup`](https://www.rust-lang.org/tools/install). This project uses a lot of Rust compiled to [WASM](https://webassembly.org/) within it. We always use the latest stable version of Rust, so you may need to run `rustup update stable`. Then, run:
On Windows, it's also recommended to [upgrade your PowerShell version](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.5#winget), we're using 7.
Then in the repo run the following to install and use the node version specified in `.nvmrc`. You might need to specify your processor architecture with `--arch arm64` or `--arch x64` if it's not autodetected.
```
fnm install --corepack-enabled
fnm use
```
Install the NPM dependencies with:
``` ```
yarn install yarn install
``` ```
This project uses a lot of Rust compiled to [WASM](https://webassembly.org/) within it. We have package scripts to run rustup, see `package.json` for reference: followed by:
```
# macOS/Linux
yarn install:rust
yarn install:wasm-pack:sh
# Windows
yarn install:rust:windows
yarn install:wasm-pack:cargo
``` ```
Then to build the WASM layer, run:
```
# macOS/Linux
yarn build:wasm yarn build:wasm
# Windows
yarn build:wasm:windows
``` ```
Or if you have the `gh` cli installed and want to download the latest main wasm bundle. Note that on Windows, you need to associate .ps1 files with PowerShell, which can be done via the right click menu, selecting `C:\Program Files\PowerShell\7\pwsh.exe`, and you can install tools like `gh` via `yarn install:tools:windows`. or if you have the gh cli installed
``` ```
# macOS/Linux ./get-latest-wasm-bundle.sh # this will download the latest main wasm bundle
yarn fetch:wasm
# Windows
yarn fetch:wasm:windows
``` ```
That will build the WASM binary and put in the `public` dir (though gitignored). That will build the WASM binary and put in the `public` dir (though gitignored).
@ -101,7 +74,7 @@ Finally, to run the web app only, run:
yarn start 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 an KittyCAD 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.
### Development environment variables ### Development environment variables
@ -128,7 +101,7 @@ 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 Cmd-Opt-I (Mac) 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 build with electron-builder, run `yarn tronb:package:dev` (or `yarn tronb:package:prod` to point to the .env.production variables)
## Checking out commits / Bisecting ## Checking out commits / Bisecting

View File

@ -1,15 +0,0 @@
---
title: "HALF_TURN"
excerpt: ""
layout: manual
---
```js
HALF_TURN: number(deg) = 180deg
```

View File

@ -1,15 +0,0 @@
---
title: "QUARTER_TURN"
excerpt: ""
layout: manual
---
```js
QUARTER_TURN: number(deg) = 90deg
```

View File

@ -1,15 +0,0 @@
---
title: "THREE_QUARTER_TURN"
excerpt: ""
layout: manual
---
```js
THREE_QUARTER_TURN: number(deg) = 270deg
```

View File

@ -1,15 +0,0 @@
---
title: "ZERO"
excerpt: ""
layout: manual
---
```js
ZERO: number = 0
```

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,15 +0,0 @@
---
title: "HALF_TURN"
excerpt: ""
layout: manual
---
```js
HALF_TURN: number(deg) = 180deg
```

File diff suppressed because one or more lines are too long

View File

@ -1,15 +0,0 @@
---
title: "QUARTER_TURN"
excerpt: ""
layout: manual
---
```js
QUARTER_TURN: number(deg) = 90deg
```

File diff suppressed because one or more lines are too long

View File

@ -1,15 +0,0 @@
---
title: "THREE_QUARTER_TURN"
excerpt: ""
layout: manual
---
```js
THREE_QUARTER_TURN: number(deg) = 270deg
```

View File

@ -1,15 +0,0 @@
---
title: "ZERO"
excerpt: ""
layout: manual
---
```js
ZERO: number = 0
```

View File

@ -1,15 +0,0 @@
---
title: "std::HALF_TURN"
excerpt: ""
layout: manual
---
```js
std::HALF_TURN: number(deg) = 180deg
```

View File

@ -1,15 +0,0 @@
---
title: "std::QUARTER_TURN"
excerpt: ""
layout: manual
---
```js
std::QUARTER_TURN: number(deg) = 90deg
```

View File

@ -1,15 +0,0 @@
---
title: "std::THREE_QUARTER_TURN"
excerpt: ""
layout: manual
---
```js
std::THREE_QUARTER_TURN: number(deg) = 270deg
```

View File

@ -1,15 +0,0 @@
---
title: "std::ZERO"
excerpt: ""
layout: manual
---
```js
std::ZERO: number = 0
```

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

48
docs/kcl/cos.md Normal file

File diff suppressed because one or more lines are too long

View File

@ -4,11 +4,9 @@ excerpt: "Return the value of Eulers number `e`."
layout: manual layout: manual
--- ---
**WARNING:** This function is deprecated.
Return the value of Eulers number `e`. Return the value of Eulers number `e`.
**DEPRECATED** use the constant E
```js ```js
e() -> number e() -> number

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -9,116 +9,110 @@ layout: manual
* [Types](kcl/types) * [Types](kcl/types)
* [Modules](kcl/modules) * [Modules](kcl/modules)
* [Known Issues](kcl/KNOWN-ISSUES) * [Known Issues](kcl/KNOWN-ISSUES)
* **`std`** * [`abs`](kcl/abs)
* [`HALF_TURN`](kcl/const_std-HALF_TURN) * [`acos`](kcl/acos)
* [`QUARTER_TURN`](kcl/const_std-QUARTER_TURN) * [`angleToMatchLengthX`](kcl/angleToMatchLengthX)
* [`THREE_QUARTER_TURN`](kcl/const_std-THREE_QUARTER_TURN) * [`angleToMatchLengthY`](kcl/angleToMatchLengthY)
* [`ZERO`](kcl/const_std-ZERO) * [`angledLine`](kcl/angledLine)
* [`abs`](kcl/abs) * [`angledLineOfXLength`](kcl/angledLineOfXLength)
* [`acos`](kcl/acos) * [`angledLineOfYLength`](kcl/angledLineOfYLength)
* [`angleToMatchLengthX`](kcl/angleToMatchLengthX) * [`angledLineThatIntersects`](kcl/angledLineThatIntersects)
* [`angleToMatchLengthY`](kcl/angleToMatchLengthY) * [`angledLineToX`](kcl/angledLineToX)
* [`angledLine`](kcl/angledLine) * [`angledLineToY`](kcl/angledLineToY)
* [`angledLineOfXLength`](kcl/angledLineOfXLength) * [`appearance`](kcl/appearance)
* [`angledLineOfYLength`](kcl/angledLineOfYLength) * [`arc`](kcl/arc)
* [`angledLineThatIntersects`](kcl/angledLineThatIntersects) * [`arcTo`](kcl/arcTo)
* [`angledLineToX`](kcl/angledLineToX) * [`asin`](kcl/asin)
* [`angledLineToY`](kcl/angledLineToY) * [`assert`](kcl/assert)
* [`appearance`](kcl/appearance) * [`assertEqual`](kcl/assertEqual)
* [`arc`](kcl/arc) * [`assertGreaterThan`](kcl/assertGreaterThan)
* [`arcTo`](kcl/arcTo) * [`assertGreaterThanOrEq`](kcl/assertGreaterThanOrEq)
* [`asin`](kcl/asin) * [`assertLessThan`](kcl/assertLessThan)
* [`assert`](kcl/assert) * [`assertLessThanOrEq`](kcl/assertLessThanOrEq)
* [`assertEqual`](kcl/assertEqual) * [`atan`](kcl/atan)
* [`assertGreaterThan`](kcl/assertGreaterThan) * [`atan2`](kcl/atan2)
* [`assertGreaterThanOrEq`](kcl/assertGreaterThanOrEq) * [`bezierCurve`](kcl/bezierCurve)
* [`assertLessThan`](kcl/assertLessThan) * [`ceil`](kcl/ceil)
* [`assertLessThanOrEq`](kcl/assertLessThanOrEq) * [`chamfer`](kcl/chamfer)
* [`atan`](kcl/atan) * [`circle`](kcl/circle)
* [`atan2`](kcl/atan2) * [`circleThreePoint`](kcl/circleThreePoint)
* [`bezierCurve`](kcl/bezierCurve) * [`close`](kcl/close)
* [`ceil`](kcl/ceil) * [`cm`](kcl/cm)
* [`chamfer`](kcl/chamfer) * [`cos`](kcl/cos)
* [`circle`](kcl/circle) * [`e`](kcl/e)
* [`circleThreePoint`](kcl/circleThreePoint) * [`extrude`](kcl/extrude)
* [`close`](kcl/close) * [`fillet`](kcl/fillet)
* [`cm`](kcl/cm) * [`floor`](kcl/floor)
* [`extrude`](kcl/extrude) * [`ft`](kcl/ft)
* [`fillet`](kcl/fillet) * [`getNextAdjacentEdge`](kcl/getNextAdjacentEdge)
* [`floor`](kcl/floor) * [`getOppositeEdge`](kcl/getOppositeEdge)
* [`ft`](kcl/ft) * [`getPreviousAdjacentEdge`](kcl/getPreviousAdjacentEdge)
* [`getNextAdjacentEdge`](kcl/getNextAdjacentEdge) * [`helix`](kcl/helix)
* [`getOppositeEdge`](kcl/getOppositeEdge) * [`helixRevolutions`](kcl/helixRevolutions)
* [`getPreviousAdjacentEdge`](kcl/getPreviousAdjacentEdge) * [`hole`](kcl/hole)
* [`helix`](kcl/helix) * [`hollow`](kcl/hollow)
* [`helixRevolutions`](kcl/helixRevolutions) * [`inch`](kcl/inch)
* [`hole`](kcl/hole) * [`lastSegX`](kcl/lastSegX)
* [`hollow`](kcl/hollow) * [`lastSegY`](kcl/lastSegY)
* [`inch`](kcl/inch) * [`legAngX`](kcl/legAngX)
* [`lastSegX`](kcl/lastSegX) * [`legAngY`](kcl/legAngY)
* [`lastSegY`](kcl/lastSegY) * [`legLen`](kcl/legLen)
* [`legAngX`](kcl/legAngX) * [`line`](kcl/line)
* [`legAngY`](kcl/legAngY) * [`ln`](kcl/ln)
* [`legLen`](kcl/legLen) * [`loft`](kcl/loft)
* [`line`](kcl/line) * [`log`](kcl/log)
* [`ln`](kcl/ln) * [`log10`](kcl/log10)
* [`loft`](kcl/loft) * [`log2`](kcl/log2)
* [`log`](kcl/log) * [`m`](kcl/m)
* [`log10`](kcl/log10) * [`map`](kcl/map)
* [`log2`](kcl/log2) * [`max`](kcl/max)
* [`m`](kcl/m) * [`min`](kcl/min)
* [`map`](kcl/map) * [`mirror2d`](kcl/mirror2d)
* [`max`](kcl/max) * [`mm`](kcl/mm)
* [`min`](kcl/min) * [`offsetPlane`](kcl/offsetPlane)
* [`mirror2d`](kcl/mirror2d) * [`patternCircular2d`](kcl/patternCircular2d)
* [`mm`](kcl/mm) * [`patternCircular3d`](kcl/patternCircular3d)
* [`offsetPlane`](kcl/offsetPlane) * [`patternLinear2d`](kcl/patternLinear2d)
* [`patternCircular2d`](kcl/patternCircular2d) * [`patternLinear3d`](kcl/patternLinear3d)
* [`patternCircular3d`](kcl/patternCircular3d) * [`patternTransform`](kcl/patternTransform)
* [`patternLinear2d`](kcl/patternLinear2d) * [`patternTransform2d`](kcl/patternTransform2d)
* [`patternLinear3d`](kcl/patternLinear3d) * [`pi`](kcl/pi)
* [`patternTransform`](kcl/patternTransform) * [`polar`](kcl/polar)
* [`patternTransform2d`](kcl/patternTransform2d) * [`polygon`](kcl/polygon)
* [`polar`](kcl/polar) * [`pop`](kcl/pop)
* [`polygon`](kcl/polygon) * [`pow`](kcl/pow)
* [`pop`](kcl/pop) * [`profileStart`](kcl/profileStart)
* [`pow`](kcl/pow) * [`profileStartX`](kcl/profileStartX)
* [`profileStart`](kcl/profileStart) * [`profileStartY`](kcl/profileStartY)
* [`profileStartX`](kcl/profileStartX) * [`push`](kcl/push)
* [`profileStartY`](kcl/profileStartY) * [`reduce`](kcl/reduce)
* [`push`](kcl/push) * [`rem`](kcl/rem)
* [`reduce`](kcl/reduce) * [`revolve`](kcl/revolve)
* [`rem`](kcl/rem) * [`round`](kcl/round)
* [`revolve`](kcl/revolve) * [`segAng`](kcl/segAng)
* [`round`](kcl/round) * [`segEnd`](kcl/segEnd)
* [`segAng`](kcl/segAng) * [`segEndX`](kcl/segEndX)
* [`segEnd`](kcl/segEnd) * [`segEndY`](kcl/segEndY)
* [`segEndX`](kcl/segEndX) * [`segLen`](kcl/segLen)
* [`segEndY`](kcl/segEndY) * [`segStart`](kcl/segStart)
* [`segLen`](kcl/segLen) * [`segStartX`](kcl/segStartX)
* [`segStart`](kcl/segStart) * [`segStartY`](kcl/segStartY)
* [`segStartX`](kcl/segStartX) * [`shell`](kcl/shell)
* [`segStartY`](kcl/segStartY) * [`sin`](kcl/sin)
* [`shell`](kcl/shell) * [`sqrt`](kcl/sqrt)
* [`sqrt`](kcl/sqrt) * [`startProfileAt`](kcl/startProfileAt)
* [`startProfileAt`](kcl/startProfileAt) * [`startSketchOn`](kcl/startSketchOn)
* [`startSketchOn`](kcl/startSketchOn) * [`sweep`](kcl/sweep)
* [`sweep`](kcl/sweep) * [`tan`](kcl/tan)
* [`tangentToEnd`](kcl/tangentToEnd) * [`tangentToEnd`](kcl/tangentToEnd)
* [`tangentialArc`](kcl/tangentialArc) * [`tangentialArc`](kcl/tangentialArc)
* [`tangentialArcTo`](kcl/tangentialArcTo) * [`tangentialArcTo`](kcl/tangentialArcTo)
* [`tangentialArcToRelative`](kcl/tangentialArcToRelative) * [`tangentialArcToRelative`](kcl/tangentialArcToRelative)
* [`toDegrees`](kcl/toDegrees) * [`tau`](kcl/tau)
* [`toRadians`](kcl/toRadians) * [`toDegrees`](kcl/toDegrees)
* [`xLine`](kcl/xLine) * [`toRadians`](kcl/toRadians)
* [`xLineTo`](kcl/xLineTo) * [`xLine`](kcl/xLine)
* [`yLine`](kcl/yLine) * [`xLineTo`](kcl/xLineTo)
* [`yLineTo`](kcl/yLineTo) * [`yLine`](kcl/yLine)
* [`yd`](kcl/yd) * [`yLineTo`](kcl/yLineTo)
* **`std::math`** * [`yd`](kcl/yd)
* [`E`](kcl/const_std-math-E)
* [`PI`](kcl/const_std-math-PI)
* [`TAU`](kcl/const_std-math-TAU)
* [`cos`](kcl/std-math-cos)
* [`sin`](kcl/std-math-sin)
* [`tan`](kcl/std-math-tan)

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ Extend the current sketch with a new straight line.
```js ```js
line(sketch: Sketch, endAbsolute?: [number], end?: [number], tag?: TagDeclarator) -> Sketch line(sketch: Sketch, end_absolute?: [number], end?: [number], tag?: TagDeclarator) -> Sketch
``` ```
@ -18,7 +18,7 @@ line(sketch: Sketch, endAbsolute?: [number], end?: [number], tag?: TagDeclarator
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes | | `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
| `endAbsolute` | `[number]` | Which absolute point should this line go to? Incompatible with `end`. | No | | `end_absolute` | `[number]` | Which absolute point should this line go to? Incompatible with `end`. | No |
| `end` | `[number]` | How far away (along the X and Y axes) should this line go? Incompatible with `endAbsolute`. | No | | `end` | `[number]` | How far away (along the X and Y axes) should this line go? Incompatible with `endAbsolute`. | No |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No | | `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ Apply a function to every element of a list.
Given a list like `[a, b, c]`, and a function like `f`, returns `[f(a), f(b), f(c)]` Given a list like `[a, b, c]`, and a function like `f`, returns `[f(a), f(b), f(c)]`
```js ```js
map(array: [KclValue], mapFn: FunctionSource) -> [KclValue] map(array: [KclValue], map_fn: FunctionParam) -> [KclValue]
``` ```
@ -18,7 +18,7 @@ map(array: [KclValue], mapFn: FunctionSource) -> [KclValue]
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | | Yes | | `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | | Yes |
| `mapFn` | `FunctionSource` | | Yes | | `map_fn` | `FunctionParam` | | Yes |
### Returns ### Returns

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ Repeat a 2-dimensional sketch some number of times along a partial or
complete circle some specified number of times. Each object may additionally be rotated along the circle, ensuring orentation of the solid with respect to the center of the circle is maintained. complete circle some specified number of times. Each object may additionally be rotated along the circle, ensuring orentation of the solid with respect to the center of the circle is maintained.
```js ```js
patternCircular2d(sketchSet: SketchSet, instances: integer, center: [number], arcDegrees: number, rotateDuplicates: bool, useOriginal?: bool) -> [Sketch] patternCircular2d(sketch_set: SketchSet, instances: integer, center: [number], arc_degrees: number, rotate_duplicates: bool, use_original?: bool) -> [Sketch]
``` ```
@ -17,12 +17,12 @@ patternCircular2d(sketchSet: SketchSet, instances: integer, center: [number], ar
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketch(es) to pattern | Yes | | `sketch_set` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketch(es) to pattern | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes | | `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `center` | `[number]` | The center about which to make the pattern. This is a 2D vector. | Yes | | `center` | `[number]` | The center about which to make the pattern. This is a 2D vector. | Yes |
| `arcDegrees` | `number` | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes | | `arc_degrees` | `number` | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes |
| `rotateDuplicates` | `bool` | Whether or not to rotate the duplicates as they are copied. | Yes | | `rotate_duplicates` | `bool` | Whether or not to rotate the duplicates as they are copied. | Yes |
| `useOriginal` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No | | `use_original` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
### Returns ### Returns

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ Repeat a 3-dimensional solid along a linear path, with a dynamic amount
of distance between each repetition, some specified number of times. of distance between each repetition, some specified number of times.
```js ```js
patternLinear3d(solidSet: SolidSet, instances: integer, distance: number, axis: [number], useOriginal?: bool) -> [Solid] patternLinear3d(solid_set: SolidSet, instances: integer, distance: number, axis: [number], use_original?: bool) -> [Solid]
``` ```
@ -17,11 +17,11 @@ patternLinear3d(solidSet: SolidSet, instances: integer, distance: number, axis:
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `solidSet` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) to duplicate | Yes | | `solid_set` | [`SolidSet`](/docs/kcl/types/SolidSet) | The solid(s) to duplicate | Yes |
| `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes | | `instances` | `integer` | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
| `distance` | `number` | Distance between each repetition. Also known as 'spacing'. | Yes | | `distance` | `number` | Distance between each repetition. Also known as 'spacing'. | Yes |
| `axis` | `[number]` | The axis of the pattern. A 2D vector. | Yes | | `axis` | `[number]` | The axis of the pattern. A 2D vector. | Yes |
| `useOriginal` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No | | `use_original` | `bool` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. Defaults to false. | No |
### Returns ### Returns

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,11 +4,9 @@ excerpt: "Return the value of `pi`. Archimedes constant (π)."
layout: manual layout: manual
--- ---
**WARNING:** This function is deprecated.
Return the value of `pi`. Archimedes constant (π). Return the value of `pi`. Archimedes constant (π).
**DEPRECATED** use the constant PI
```js ```js
pi() -> number pi() -> number

View File

@ -9,7 +9,7 @@ Create a regular polygon with the specified number of sides that is either inscr
```js ```js
polygon(data: PolygonData, sketchSurfaceOrGroup: SketchOrSurface, tag?: TagDeclarator) -> Sketch polygon(data: PolygonData, sketch_surface_or_group: SketchOrSurface, tag?: TagDeclarator) -> Sketch
``` ```
@ -18,7 +18,7 @@ polygon(data: PolygonData, sketchSurfaceOrGroup: SketchOrSurface, tag?: TagDecla
| Name | Type | Description | Required | | Name | Type | Description | Required |
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `data` | [`PolygonData`](/docs/kcl/types/PolygonData) | Data for drawing a polygon | Yes | | `data` | [`PolygonData`](/docs/kcl/types/PolygonData) | Data for drawing a polygon | Yes |
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes | | `sketch_surface_or_group` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes |
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No | | `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
### Returns ### Returns

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ Take a starting value. Then, for each element of an array, calculate the next va
using the previous value and the element. using the previous value and the element.
```js ```js
reduce(array: [KclValue], start: KclValue, reduceFn: FunctionSource) -> KclValue reduce(array: [KclValue], start: KclValue, reduce_fn: FunctionParam) -> KclValue
``` ```
@ -19,7 +19,7 @@ reduce(array: [KclValue], start: KclValue, reduceFn: FunctionSource) -> KclValue
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | | Yes | | `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | | Yes |
| `start` | [`KclValue`](/docs/kcl/types/KclValue) | Any KCL value. | Yes | | `start` | [`KclValue`](/docs/kcl/types/KclValue) | Any KCL value. | Yes |
| `reduceFn` | `FunctionSource` | | Yes | | `reduce_fn` | `FunctionParam` | | Yes |
### Returns ### Returns
@ -76,7 +76,7 @@ assertEqual(sum, 6, 0.00001, "1 + 2 + 3 summed is 6")
// Declare a function that sketches a decagon. // Declare a function that sketches a decagon.
fn decagon(radius) { fn decagon(radius) {
// Each side of the decagon is turned this many degrees from the previous angle. // Each side of the decagon is turned this many degrees from the previous angle.
stepAngle = 1 / 10 * TAU stepAngle = 1 / 10 * tau()
// Start the decagon sketch at this point. // Start the decagon sketch at this point.
startOfDecagonSketch = startSketchOn('XY') startOfDecagonSketch = startSketchOn('XY')
@ -97,7 +97,7 @@ fn decagon(radius) {
/* The `decagon` above is basically like this pseudo-code: /* The `decagon` above is basically like this pseudo-code:
fn decagon(radius): fn decagon(radius):
stepAngle = (1/10) * TAU stepAngle = (1/10) * tau()
plane = startSketchOn('XY') plane = startSketchOn('XY')
startOfDecagonSketch = startProfileAt([(cos(0)*radius), (sin(0) * radius)], plane) startOfDecagonSketch = startProfileAt([(cos(0)*radius), (sin(0) * radius)], plane)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

48
docs/kcl/sin.md Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

45
docs/kcl/tan.md Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -266,10 +266,10 @@ myRect = rect([20, 0])
myRect myRect
|> extrude(10, %) |> extrude(10, %)
|> fillet( |> fillet({
radius = 0.5, radius = 0.5,
tags = [myRect.tags.rectangleSegmentA001] tags = [myRect.tags.rectangleSegmentA001]
) }, %)
``` ```
See how we use the tag `rectangleSegmentA001` in the `fillet` function outside See how we use the tag `rectangleSegmentA001` in the `fillet` function outside

View File

@ -18,7 +18,6 @@ A base path.
|----------|------|-------------|----------| |----------|------|-------------|----------|
| `from` |`[number, number]`| The from point. | No | | `from` |`[number, number]`| The from point. | No |
| `to` |`[number, number]`| The to point. | No | | `to` |`[number, number]`| The to point. | No |
| `units` |[`UnitLen`](/docs/kcl/types/UnitLen)| A unit of length. | No |
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No | | `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No | | `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |

Some files were not shown because too many files have changed in this diff Show More