Compare commits
110 Commits
franknoiro
...
v0.46.0
Author | SHA1 | Date | |
---|---|---|---|
3811c88b5c | |||
69a1473197 | |||
1f1e996cfa | |||
58167deda7 | |||
83d22a4f5f | |||
7003b19a70 | |||
687ef1429d | |||
b1b00a9a22 | |||
a0924bcfa3 | |||
5ce22e2de8 | |||
850c5c62d1 | |||
b31786c9ab | |||
936549d60f | |||
0babbcff49 | |||
02c2e80b31 | |||
da236d9a3e | |||
1104d908c0 | |||
2efea3ec06 | |||
775007ef0d | |||
f490e7d6fe | |||
89bc93e4cd | |||
12edb6375d | |||
8d9bba02d6 | |||
56e100fad7 | |||
38f7a4089e | |||
91f5465e2d | |||
58a9c60d0b | |||
725c4d95f8 | |||
615b7feabb | |||
5743b9ced0 | |||
8896d06028 | |||
1f217ef50b | |||
5ef5c6280c | |||
aac95e1e2e | |||
18f4a1303c | |||
ded97eda61 | |||
f6b06520ee | |||
dcfcdc98ce | |||
9ab3325580 | |||
cb5ad3ab27 | |||
1e539cc134 | |||
4297dc43ae | |||
935b4ee7f5 | |||
2523242bb1 | |||
309e4fadf0 | |||
842054de09 | |||
af146284b6 | |||
5ac40e6849 | |||
d3e0625e8a | |||
484da28374 | |||
fa9e6ccea9 | |||
77fbb68419 | |||
253a7910b0 | |||
88c6be810f | |||
2860926571 | |||
fb81c02877 | |||
d78648f0f8 | |||
fe31769be5 | |||
388371b05d | |||
9db69007e5 | |||
f2a6492ab7 | |||
3ddce116e5 | |||
57f7d022ca | |||
cbc12559c7 | |||
b3cd5ef3ba | |||
a094995730 | |||
46b4b01d23 | |||
4d1eaf9381 | |||
df3668adc8 | |||
270781d5cd | |||
96b93f8d51 | |||
59b1c414f0 | |||
fd07b8cff5 | |||
21efb2c0bd | |||
30029a63a1 | |||
9f5003cafc | |||
5232e1d40a | |||
23c25c2b50 | |||
50273c0edc | |||
8a03bf50e3 | |||
7500ef0065 | |||
099c48cd63 | |||
f35cd3ef26 | |||
695c432d1e | |||
2835665a6a | |||
45707d2974 | |||
b2e1d21d45 | |||
b98f5605b6 | |||
c050e03df1 | |||
b6fa4325f0 | |||
0804aecc63 | |||
3dfc2c86e1 | |||
71647ede29 | |||
cd679f4be3 | |||
18d87b99bd | |||
70a2202877 | |||
f5c9f84ae9 | |||
71f701dec7 | |||
bffbed1d42 | |||
9f60ed8e75 | |||
57b366b2d0 | |||
6f3f5dbda9 | |||
8dd25715fb | |||
834f7133d8 | |||
8c5662e458 | |||
f37fc357af | |||
e27e9ecc63 | |||
78b42ea191 | |||
5d02a27122 | |||
49d52ce94b |
@ -1,3 +1,4 @@
|
|||||||
src/wasm-lib/*
|
src/wasm-lib/*
|
||||||
*.typegen.ts
|
*.typegen.ts
|
||||||
packages/codemirror-lsp-client/dist/*
|
packages/codemirror-lsp-client/dist/*
|
||||||
|
e2e/playwright/snapshots/prompt-to-edit/*
|
||||||
|
13
.gitattributes
vendored
Normal file
13
.gitattributes
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# 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
|
2
.github/ci-cd-scripts/playwright-electron.sh
vendored
2
.github/ci-cd-scripts/playwright-electron.sh
vendored
@ -21,7 +21,7 @@ if [[ ! -f "test-results/.last-run.json" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
retry=1
|
retry=1
|
||||||
max_retrys=5
|
max_retrys=1
|
||||||
|
|
||||||
# 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
|
||||||
|
3
.github/workflows/build-and-store-wasm.yml
vendored
3
.github/workflows/build-and-store-wasm.yml
vendored
@ -22,6 +22,9 @@ 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
|
||||||
|
|
||||||
|
43
.github/workflows/build-apps.yml
vendored
43
.github/workflows/build-apps.yml
vendored
@ -7,14 +7,11 @@ on:
|
|||||||
- main
|
- main
|
||||||
tags:
|
tags:
|
||||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||||
schedule:
|
- 'nightly-v[0-9]+.[0-9]+.[0-9]+'
|
||||||
- cron: '0 4 * * *'
|
|
||||||
# Daily at 04:00 AM UTC
|
|
||||||
# Will checkout the last commit from the default branch (main as of 2023-10-04)
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
IS_RELEASE: ${{ github.ref_type == 'tag' }}
|
IS_RELEASE: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
|
||||||
IS_NIGHTLY: ${{ github.event_name == 'schedule' }}
|
IS_NIGHTLY: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'nightly-v') }}
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
@ -44,12 +41,19 @@ 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"
|
||||||
|
|
||||||
- name: Set nightly version, product name, release notes, and icons
|
- name: Set nightly version, product name, release notes, and icons
|
||||||
if: ${{ env.IS_NIGHTLY == 'true' }}
|
if: ${{ env.IS_NIGHTLY == 'true' }}
|
||||||
run: yarn files:flip-to-nightly
|
run: |
|
||||||
|
export VERSION=${GITHUB_REF_NAME#nightly-v}
|
||||||
|
yarn files:set-version
|
||||||
|
yarn files:flip-to-nightly
|
||||||
|
|
||||||
- name: Set release version
|
- name: Set release version
|
||||||
if: ${{ env.IS_RELEASE == 'true' }}
|
if: ${{ env.IS_RELEASE == 'true' }}
|
||||||
@ -128,7 +132,7 @@ jobs:
|
|||||||
|
|
||||||
- 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.0
|
uses: nick-fields/retry@v3.0.1
|
||||||
with:
|
with:
|
||||||
timeout_minutes: 2
|
timeout_minutes: 2
|
||||||
max_attempts: 3
|
max_attempts: 3
|
||||||
@ -179,7 +183,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.0
|
uses: nick-fields/retry@v3.0.1
|
||||||
with:
|
with:
|
||||||
timeout_minutes: 10
|
timeout_minutes: 10
|
||||||
max_attempts: 3
|
max_attempts: 3
|
||||||
@ -240,7 +244,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.0
|
uses: nick-fields/retry@v3.0.1
|
||||||
with:
|
with:
|
||||||
timeout_minutes: 10
|
timeout_minutes: 10
|
||||||
max_attempts: 3
|
max_attempts: 3
|
||||||
@ -269,7 +273,7 @@ jobs:
|
|||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
if: ${{ github.ref_type == 'tag' || github.event_name == 'schedule' }}
|
if: ${{ github.ref_type == 'tag' }}
|
||||||
env:
|
env:
|
||||||
VERSION_NO_V: ${{ needs.prepare-files.outputs.version }}
|
VERSION_NO_V: ${{ needs.prepare-files.outputs.version }}
|
||||||
VERSION: ${{ format('v{0}', needs.prepare-files.outputs.version) }}
|
VERSION: ${{ format('v{0}', needs.prepare-files.outputs.version) }}
|
||||||
@ -326,8 +330,8 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
NOTES: ${{ needs.prepare-files.outputs.notes }}
|
NOTES: ${{ needs.prepare-files.outputs.notes }}
|
||||||
PUB_DATE: ${{ github.event.repository.updated_at }}
|
PUB_DATE: ${{ github.event.repository.updated_at }}
|
||||||
WEBSITE_DIR: ${{ github.event_name == 'schedule' && 'dl.zoo.dev/releases/modeling-app/nightly' || 'dl.zoo.dev/releases/modeling-app' }}
|
WEBSITE_DIR: ${{ env.IS_NIGHTLY == 'true' && 'dl.zoo.dev/releases/modeling-app/nightly' || 'dl.zoo.dev/releases/modeling-app' }}
|
||||||
URL_CODED_NAME: ${{ github.event_name == 'schedule' && 'Zoo%20Modeling%20App%20%28Nightly%29' || 'Zoo%20Modeling%20App' }}
|
URL_CODED_NAME: ${{ env.IS_NIGHTLY == 'true' && 'Zoo%20Modeling%20App%20%28Nightly%29' || 'Zoo%20Modeling%20App' }}
|
||||||
run: |
|
run: |
|
||||||
RELEASE_DIR=https://${WEBSITE_DIR}
|
RELEASE_DIR=https://${WEBSITE_DIR}
|
||||||
jq --null-input \
|
jq --null-input \
|
||||||
@ -382,7 +386,7 @@ jobs:
|
|||||||
# see https://github.com/actions/checkout/issues/1471
|
# see https://github.com/actions/checkout/issues/1471
|
||||||
git fetch --prune --unshallow --tags
|
git fetch --prune --unshallow --tags
|
||||||
export TAG="nightly-${VERSION}"
|
export TAG="nightly-${VERSION}"
|
||||||
export PREVIOUS_TAG=$(git describe --tags --match="nightly-v[0-9]*" --abbrev=0)
|
export PREVIOUS_TAG=$(git tag --list --sort=-committerdate "nightly-v[0-9]*" | head -n2 | tail -n1)
|
||||||
export NOTES=$(./scripts/get-nightly-changelog.sh)
|
export NOTES=$(./scripts/get-nightly-changelog.sh)
|
||||||
yarn files:set-notes
|
yarn files:set-notes
|
||||||
|
|
||||||
@ -410,14 +414,3 @@ jobs:
|
|||||||
- name: Invalidate bucket cache on latest*.yml and last_download.json files
|
- name: Invalidate bucket cache on latest*.yml and last_download.json files
|
||||||
if: ${{ env.IS_NIGHTLY == 'true' }}
|
if: ${{ env.IS_NIGHTLY == 'true' }}
|
||||||
run: yarn files:invalidate-bucket:nightly
|
run: yarn files:invalidate-bucket:nightly
|
||||||
|
|
||||||
- name: Tag nightly commit
|
|
||||||
if: ${{ env.IS_NIGHTLY == 'true' }}
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
const { VERSION } = process.env
|
|
||||||
const { owner, repo } = context.repo
|
|
||||||
const { sha } = context
|
|
||||||
const ref = `refs/tags/nightly-${VERSION}`
|
|
||||||
github.rest.git.createRef({ owner, repo, sha, ref })
|
|
||||||
|
2
.github/workflows/cargo-test.yml
vendored
2
.github/workflows/cargo-test.yml
vendored
@ -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 --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 --retries=2 --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
|
||||||
|
10
.github/workflows/check-exampleKcl.yml
vendored
10
.github/workflows/check-exampleKcl.yml
vendored
@ -27,6 +27,15 @@ 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({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number
|
||||||
|
});
|
||||||
|
|
||||||
|
const commentExists = comments.some(comment => comment.body === message);
|
||||||
|
|
||||||
|
if (!commentExists) {
|
||||||
// Post a comment on the PR
|
// Post a comment on the PR
|
||||||
await github.rest.issues.createComment({
|
await github.rest.issues.createComment({
|
||||||
owner,
|
owner,
|
||||||
@ -34,3 +43,4 @@ jobs:
|
|||||||
issue_number,
|
issue_number,
|
||||||
body: message,
|
body: message,
|
||||||
});
|
});
|
||||||
|
}
|
55
.github/workflows/e2e-tests.yml
vendored
55
.github/workflows/e2e-tests.yml
vendored
@ -3,6 +3,8 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
pull_request:
|
pull_request:
|
||||||
|
schedule:
|
||||||
|
- cron: 0 * * * * # hourly
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
@ -15,23 +17,6 @@ permissions:
|
|||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
check-rust-changes:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
rust-changed: ${{ steps.filter.outputs.rust }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- id: filter
|
|
||||||
name: Check for Rust changes
|
|
||||||
uses: dorny/paths-filter@v3
|
|
||||||
with:
|
|
||||||
filters: |
|
|
||||||
rust:
|
|
||||||
- 'src/wasm-lib/**'
|
|
||||||
|
|
||||||
electron:
|
electron:
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
name: playwright:electron:${{ matrix.os }} ${{ matrix.shardIndex }} ${{ matrix.shardTotal }}
|
name: playwright:electron:${{ matrix.os }} ${{ matrix.shardIndex }} ${{ matrix.shardTotal }}
|
||||||
@ -42,8 +27,8 @@ jobs:
|
|||||||
os: [namespace-profile-ubuntu-8-cores, namespace-profile-macos-8-cores, windows-16-cores]
|
os: [namespace-profile-ubuntu-8-cores, namespace-profile-macos-8-cores, windows-16-cores]
|
||||||
shardIndex: [1, 2, 3, 4]
|
shardIndex: [1, 2, 3, 4]
|
||||||
shardTotal: [4]
|
shardTotal: [4]
|
||||||
|
# TODO: add ref here for main and latest release tag
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
needs: check-rust-changes
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/create-github-app-token@v1
|
- uses: actions/create-github-app-token@v1
|
||||||
id: app-token
|
id: app-token
|
||||||
@ -54,6 +39,13 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
|
- id: filter
|
||||||
|
name: Check for Rust changes
|
||||||
|
uses: dorny/paths-filter@v3
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
rust:
|
||||||
|
- 'src/wasm-lib/**'
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
@ -73,7 +65,7 @@ jobs:
|
|||||||
run: yarn playwright install --with-deps
|
run: yarn playwright install --with-deps
|
||||||
- name: Download Wasm Cache
|
- name: Download Wasm Cache
|
||||||
id: download-wasm
|
id: download-wasm
|
||||||
if: needs.check-rust-changes.outputs.rust-changed == 'false'
|
if: github.event_name != 'schedule' && steps.filter.outputs.rust == 'false'
|
||||||
uses: dawidd6/action-download-artifact@v7
|
uses: dawidd6/action-download-artifact@v7
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
@ -83,14 +75,17 @@ jobs:
|
|||||||
branch: main
|
branch: main
|
||||||
path: src/wasm-lib/pkg
|
path: src/wasm-lib/pkg
|
||||||
- name: copy wasm blob
|
- name: copy wasm blob
|
||||||
if: needs.check-rust-changes.outputs.rust-changed == 'false'
|
if: github.event_name != 'schedule' && steps.filter.outputs.rust == 'false'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cp src/wasm-lib/pkg/wasm_lib_bg.wasm public
|
run: cp src/wasm-lib/pkg/wasm_lib_bg.wasm public
|
||||||
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: github.event_name == 'schedule' || steps.filter.outputs.rust == 'true'
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
workspaces: './src/wasm-lib'
|
workspaces: './src/wasm-lib'
|
||||||
@ -123,7 +118,7 @@ jobs:
|
|||||||
cat /tmp/vector.toml
|
cat /tmp/vector.toml
|
||||||
${HOME}/.vector/bin/vector --config /tmp/vector.toml &
|
${HOME}/.vector/bin/vector --config /tmp/vector.toml &
|
||||||
- name: Build Wasm (because rust diff)
|
- name: Build Wasm (because rust diff)
|
||||||
if: needs.check-rust-changes.outputs.rust-changed == 'true'
|
if: github.event_name == 'schedule' || steps.filter.outputs.rust == 'true'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: yarn build:wasm
|
run: yarn build:wasm
|
||||||
- name: OR Build Wasm (because wasm cache failed)
|
- name: OR Build Wasm (because wasm cache failed)
|
||||||
@ -139,7 +134,7 @@ jobs:
|
|||||||
# TODO: break this in its own job, for now it's not slowing down the overall execution as ubuntu is the quickest,
|
# TODO: break this in its own job, for now it's not slowing down the overall execution as ubuntu is the quickest,
|
||||||
# but we could do better. This forces a large 1/1 shard of all 20 snapshot tests that runs in about 3 minutes.
|
# but we could do better. This forces a large 1/1 shard of all 20 snapshot tests that runs in about 3 minutes.
|
||||||
run: |
|
run: |
|
||||||
PLATFORM=web yarn playwright test --config=playwright.config.ts --retries="3" --update-snapshots --grep=@snapshot --shard=1/1
|
PLATFORM=web yarn playwright test --config=playwright.config.ts --retries="3" --update-snapshots --grep=@snapshot --trace=on --shard=1/1
|
||||||
env:
|
env:
|
||||||
CI: true
|
CI: true
|
||||||
NODE_ENV: development
|
NODE_ENV: development
|
||||||
@ -150,7 +145,7 @@ jobs:
|
|||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: ${{ !cancelled() && (success() || failure()) }}
|
if: ${{ !cancelled() && (success() || failure()) }}
|
||||||
with:
|
with:
|
||||||
name: playwright-report-${{ matrix.os }}-snapshot-${{ matrix.shardIndex }}-${{ github.sha }}
|
name: playwright-report-snapshots-${{ matrix.os }}-snapshot-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||||
path: playwright-report/
|
path: playwright-report/
|
||||||
include-hidden-files: true
|
include-hidden-files: true
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
@ -164,7 +159,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
id: git-check
|
id: git-check
|
||||||
run: |
|
run: |
|
||||||
git add e2e/playwright/snapshot-tests.spec.ts-snapshots
|
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
|
||||||
if git status | grep -q "Changes to be committed"
|
if git status | grep -q "Changes to be committed"
|
||||||
then echo "modified=true" >> $GITHUB_OUTPUT
|
then echo "modified=true" >> $GITHUB_OUTPUT
|
||||||
else echo "modified=false" >> $GITHUB_OUTPUT
|
else echo "modified=false" >> $GITHUB_OUTPUT
|
||||||
@ -173,7 +168,7 @@ jobs:
|
|||||||
if: steps.git-check.outputs.modified == 'true'
|
if: steps.git-check.outputs.modified == 'true'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
git add e2e/playwright/snapshot-tests.spec.ts-snapshots
|
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
|
||||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git config --local user.name "github-actions[bot]"
|
git config --local user.name "github-actions[bot]"
|
||||||
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
|
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
|
||||||
@ -200,9 +195,11 @@ 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()) }}
|
||||||
shell: bash
|
uses: nick-fields/retry@v3.0.1
|
||||||
run: |
|
with:
|
||||||
.github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}}
|
command: .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
|
||||||
|
12
.github/workflows/static-analysis.yml
vendored
12
.github/workflows/static-analysis.yml
vendored
@ -37,6 +37,9 @@ 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:
|
||||||
@ -53,6 +56,9 @@ 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
|
||||||
|
|
||||||
@ -92,6 +98,9 @@ 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
|
||||||
@ -118,6 +127,9 @@ 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
|
||||||
|
39
.github/workflows/tag-nightly.yml
vendored
Normal file
39
.github/workflows/tag-nightly.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
name: tag-nightly
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 4 * * *'
|
||||||
|
# Daily at 04:00 AM UTC
|
||||||
|
# Will checkout the last commit from the default branch (main as of 2023-10-04)
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tag-nightly:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/create-github-app-token@v1
|
||||||
|
id: app-token
|
||||||
|
with:
|
||||||
|
app-id: ${{ secrets.MODELING_APP_GH_APP_ID }}
|
||||||
|
private-key: ${{ secrets.MODELING_APP_GH_APP_PRIVATE_KEY }}
|
||||||
|
owner: ${{ github.repository_owner }}
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
|
||||||
|
- run: yarn install
|
||||||
|
|
||||||
|
- name: Push tag
|
||||||
|
run: |
|
||||||
|
VERSION_NO_V=$(date +'%-y.%-m.%-d')
|
||||||
|
TAG="nightly-v$VERSION_NO_V"
|
||||||
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git config --local user.name "github-actions[bot]"
|
||||||
|
git tag $TAG
|
||||||
|
git push origin tag $TAG
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -41,9 +41,12 @@ 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/
|
||||||
@ -68,3 +71,4 @@ venv
|
|||||||
|
|
||||||
# electron
|
# electron
|
||||||
out/
|
out/
|
||||||
|
*.snap.new
|
||||||
|
@ -10,6 +10,7 @@ target
|
|||||||
src/wasm-lib/pkg
|
src/wasm-lib/pkg
|
||||||
src/wasm-lib/kcl/bindings
|
src/wasm-lib/kcl/bindings
|
||||||
e2e/playwright/export-snapshots
|
e2e/playwright/export-snapshots
|
||||||
|
e2e/playwright/snapshots/prompt-to-edit
|
||||||
|
|
||||||
|
|
||||||
# XState generated files
|
# XState generated files
|
||||||
|
41
README.md
41
README.md
@ -48,22 +48,49 @@ We recommend downloading the latest application binary from [our Releases page](
|
|||||||
|
|
||||||
## Running a development build
|
## Running a development build
|
||||||
|
|
||||||
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:
|
Install a node version manager such as [fnm](https://github.com/Schniz/fnm?tab=readme-ov-#installation).
|
||||||
|
|
||||||
|
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
|
||||||
```
|
```
|
||||||
|
|
||||||
followed by:
|
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:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
# 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
|
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`.
|
||||||
|
|
||||||
```
|
```
|
||||||
./get-latest-wasm-bundle.sh # this will download the latest main wasm bundle
|
# macOS/Linux
|
||||||
|
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).
|
||||||
@ -74,7 +101,7 @@ Finally, to run the web app only, run:
|
|||||||
yarn start
|
yarn start
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
### Development environment variables
|
### Development environment variables
|
||||||
|
|
||||||
@ -101,7 +128,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 build 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
|
## Checking out commits / Bisecting
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -9,7 +9,11 @@ Draw a line segment relative to the current origin using the polar
|
|||||||
measure of some angle and distance.
|
measure of some angle and distance.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLine(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
angledLine(
|
||||||
|
data: AngledLineData,
|
||||||
|
sketch: Sketch,
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -29,7 +33,7 @@ angledLine(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> yLineTo(15, %)
|
|> yLineTo(15, %)
|
||||||
|> angledLine({ angle = 30, length = 15 }, %)
|
|> angledLine({ angle = 30, length = 15 }, %)
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -9,7 +9,11 @@ Draw an angled line from the current origin, constructing a line segment
|
|||||||
such that the newly created line intersects the desired target line segment.
|
such that the newly created line intersects the desired target line segment.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
angledLineThatIntersects(
|
||||||
|
data: AngledLineThatIntersectsData,
|
||||||
|
sketch: Sketch,
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -29,7 +33,7 @@ angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch: Sketch, tag
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line(endAbsolute = [5, 10])
|
|> line(endAbsolute = [5, 10])
|
||||||
|> line(endAbsolute = [-10, 10], tag = $lineToIntersect)
|
|> line(endAbsolute = [-10, 10], tag = $lineToIntersect)
|
||||||
|
@ -9,7 +9,11 @@ Create a line segment from the current 2-dimensional sketch origin
|
|||||||
along some angle (in degrees) for some length, ending at the provided value in the 'x' dimension.
|
along some angle (in degrees) for some length, ending at the provided value in the 'x' dimension.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineToX(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
angledLineToX(
|
||||||
|
data: AngledLineToData,
|
||||||
|
sketch: Sketch,
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -29,7 +33,7 @@ angledLineToX(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sk
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLineToX({ angle = 30, to = 10 }, %)
|
|> angledLineToX({ angle = 30, to = 10 }, %)
|
||||||
|> line(end = [0, 10])
|
|> line(end = [0, 10])
|
||||||
|
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
@ -9,7 +9,10 @@ Check a value at runtime, and raise an error if the argument provided
|
|||||||
is false.
|
is false.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(data: bool, message: string) -> ()
|
assert(
|
||||||
|
data: bool,
|
||||||
|
message: string,
|
||||||
|
) -> ()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,12 @@ Check that a numerical value equals another at runtime,
|
|||||||
otherwise raise an error.
|
otherwise raise an error.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assertEqual(left: number, right: number, epsilon: number, message: string) -> ()
|
assertEqual(
|
||||||
|
left: number,
|
||||||
|
right: number,
|
||||||
|
epsilon: number,
|
||||||
|
message: string,
|
||||||
|
) -> ()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,11 @@ Check that a numerical value is greater than another at runtime,
|
|||||||
otherwise raise an error.
|
otherwise raise an error.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assertGreaterThan(left: number, right: number, message: string) -> ()
|
assertGreaterThan(
|
||||||
|
left: number,
|
||||||
|
right: number,
|
||||||
|
message: string,
|
||||||
|
) -> ()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,11 @@ Check that a numerical value is greater than or equal to another at runtime,
|
|||||||
otherwise raise an error.
|
otherwise raise an error.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assertGreaterThanOrEq(left: number, right: number, message: string) -> ()
|
assertGreaterThanOrEq(
|
||||||
|
left: number,
|
||||||
|
right: number,
|
||||||
|
message: string,
|
||||||
|
) -> ()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,11 @@ Check that a numerical value is less than to another at runtime,
|
|||||||
otherwise raise an error.
|
otherwise raise an error.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assertLessThan(left: number, right: number, message: string) -> ()
|
assertLessThan(
|
||||||
|
left: number,
|
||||||
|
right: number,
|
||||||
|
message: string,
|
||||||
|
) -> ()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,11 @@ Check that a numerical value is less than or equal to another at runtime,
|
|||||||
otherwise raise an error.
|
otherwise raise an error.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assertLessThanOrEq(left: number, right: number, message: string) -> ()
|
assertLessThanOrEq(
|
||||||
|
left: number,
|
||||||
|
right: number,
|
||||||
|
message: string,
|
||||||
|
) -> ()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,10 @@ Compute the four quadrant arctangent of Y and X (in radians).
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
atan2(y: number, x: number) -> number
|
atan2(
|
||||||
|
y: number,
|
||||||
|
x: number,
|
||||||
|
) -> number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
|
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
15
docs/kcl/const_std-HALF_TURN.md
Normal file
15
docs/kcl/const_std-HALF_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::HALF_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::HALF_TURN: number(deg) = 180deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
15
docs/kcl/const_std-QUARTER_TURN.md
Normal file
15
docs/kcl/const_std-QUARTER_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::QUARTER_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::QUARTER_TURN: number(deg) = 90deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
15
docs/kcl/const_std-THREE_QUARTER_TURN.md
Normal file
15
docs/kcl/const_std-THREE_QUARTER_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::THREE_QUARTER_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::THREE_QUARTER_TURN: number(deg) = 270deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
15
docs/kcl/const_std-XY.md
Normal file
15
docs/kcl/const_std-XY.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::XY"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::XY
|
||||||
|
```
|
||||||
|
|
||||||
|
|
15
docs/kcl/const_std-XZ.md
Normal file
15
docs/kcl/const_std-XZ.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::XZ"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::XZ
|
||||||
|
```
|
||||||
|
|
||||||
|
|
15
docs/kcl/const_std-YZ.md
Normal file
15
docs/kcl/const_std-YZ.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::YZ"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::YZ
|
||||||
|
```
|
||||||
|
|
||||||
|
|
15
docs/kcl/const_std-ZERO.md
Normal file
15
docs/kcl/const_std-ZERO.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::ZERO"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::ZERO: number = 0
|
||||||
|
```
|
||||||
|
|
||||||
|
|
32
docs/kcl/const_std-math-E.md
Normal file
32
docs/kcl/const_std-math-E.md
Normal file
File diff suppressed because one or more lines are too long
28
docs/kcl/const_std-math-PI.md
Normal file
28
docs/kcl/const_std-math-PI.md
Normal file
File diff suppressed because one or more lines are too long
32
docs/kcl/const_std-math-TAU.md
Normal file
32
docs/kcl/const_std-math-TAU.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
@ -4,9 +4,11 @@ excerpt: "Return the value of Euler’s number `e`."
|
|||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**WARNING:** This function is deprecated.
|
||||||
|
|
||||||
Return the value of Euler’s number `e`.
|
Return the value of Euler’s 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
@ -6,9 +6,23 @@ layout: manual
|
|||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
* [Types](kcl/types)
|
### Language
|
||||||
* [Modules](kcl/modules)
|
|
||||||
* [Known Issues](kcl/KNOWN-ISSUES)
|
* [`Types`](kcl/types)
|
||||||
|
* [`Modules`](kcl/modules)
|
||||||
|
* [`Settings`](kcl/settings)
|
||||||
|
* [`Known Issues`](kcl/known-issues)
|
||||||
|
|
||||||
|
### Standard library
|
||||||
|
|
||||||
|
* **`std`**
|
||||||
|
* [`HALF_TURN`](kcl/const_std-HALF_TURN)
|
||||||
|
* [`QUARTER_TURN`](kcl/const_std-QUARTER_TURN)
|
||||||
|
* [`THREE_QUARTER_TURN`](kcl/const_std-THREE_QUARTER_TURN)
|
||||||
|
* [`XY`](kcl/const_std-XY)
|
||||||
|
* [`XZ`](kcl/const_std-XZ)
|
||||||
|
* [`YZ`](kcl/const_std-YZ)
|
||||||
|
* [`ZERO`](kcl/const_std-ZERO)
|
||||||
* [`abs`](kcl/abs)
|
* [`abs`](kcl/abs)
|
||||||
* [`acos`](kcl/acos)
|
* [`acos`](kcl/acos)
|
||||||
* [`angleToMatchLengthX`](kcl/angleToMatchLengthX)
|
* [`angleToMatchLengthX`](kcl/angleToMatchLengthX)
|
||||||
@ -38,8 +52,6 @@ layout: manual
|
|||||||
* [`circleThreePoint`](kcl/circleThreePoint)
|
* [`circleThreePoint`](kcl/circleThreePoint)
|
||||||
* [`close`](kcl/close)
|
* [`close`](kcl/close)
|
||||||
* [`cm`](kcl/cm)
|
* [`cm`](kcl/cm)
|
||||||
* [`cos`](kcl/cos)
|
|
||||||
* [`e`](kcl/e)
|
|
||||||
* [`extrude`](kcl/extrude)
|
* [`extrude`](kcl/extrude)
|
||||||
* [`fillet`](kcl/fillet)
|
* [`fillet`](kcl/fillet)
|
||||||
* [`floor`](kcl/floor)
|
* [`floor`](kcl/floor)
|
||||||
@ -76,7 +88,6 @@ layout: manual
|
|||||||
* [`patternLinear3d`](kcl/patternLinear3d)
|
* [`patternLinear3d`](kcl/patternLinear3d)
|
||||||
* [`patternTransform`](kcl/patternTransform)
|
* [`patternTransform`](kcl/patternTransform)
|
||||||
* [`patternTransform2d`](kcl/patternTransform2d)
|
* [`patternTransform2d`](kcl/patternTransform2d)
|
||||||
* [`pi`](kcl/pi)
|
|
||||||
* [`polar`](kcl/polar)
|
* [`polar`](kcl/polar)
|
||||||
* [`polygon`](kcl/polygon)
|
* [`polygon`](kcl/polygon)
|
||||||
* [`pop`](kcl/pop)
|
* [`pop`](kcl/pop)
|
||||||
@ -88,7 +99,9 @@ layout: manual
|
|||||||
* [`reduce`](kcl/reduce)
|
* [`reduce`](kcl/reduce)
|
||||||
* [`rem`](kcl/rem)
|
* [`rem`](kcl/rem)
|
||||||
* [`revolve`](kcl/revolve)
|
* [`revolve`](kcl/revolve)
|
||||||
|
* [`rotate`](kcl/rotate)
|
||||||
* [`round`](kcl/round)
|
* [`round`](kcl/round)
|
||||||
|
* [`scale`](kcl/scale)
|
||||||
* [`segAng`](kcl/segAng)
|
* [`segAng`](kcl/segAng)
|
||||||
* [`segEnd`](kcl/segEnd)
|
* [`segEnd`](kcl/segEnd)
|
||||||
* [`segEndX`](kcl/segEndX)
|
* [`segEndX`](kcl/segEndX)
|
||||||
@ -98,21 +111,26 @@ layout: manual
|
|||||||
* [`segStartX`](kcl/segStartX)
|
* [`segStartX`](kcl/segStartX)
|
||||||
* [`segStartY`](kcl/segStartY)
|
* [`segStartY`](kcl/segStartY)
|
||||||
* [`shell`](kcl/shell)
|
* [`shell`](kcl/shell)
|
||||||
* [`sin`](kcl/sin)
|
|
||||||
* [`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)
|
||||||
* [`tau`](kcl/tau)
|
|
||||||
* [`toDegrees`](kcl/toDegrees)
|
* [`toDegrees`](kcl/toDegrees)
|
||||||
* [`toRadians`](kcl/toRadians)
|
* [`toRadians`](kcl/toRadians)
|
||||||
|
* [`translate`](kcl/translate)
|
||||||
* [`xLine`](kcl/xLine)
|
* [`xLine`](kcl/xLine)
|
||||||
* [`xLineTo`](kcl/xLineTo)
|
* [`xLineTo`](kcl/xLineTo)
|
||||||
* [`yLine`](kcl/yLine)
|
* [`yLine`](kcl/yLine)
|
||||||
* [`yLineTo`](kcl/yLineTo)
|
* [`yLineTo`](kcl/yLineTo)
|
||||||
* [`yd`](kcl/yd)
|
* [`yd`](kcl/yd)
|
||||||
|
* **`std::math`**
|
||||||
|
* [`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
@ -9,7 +9,10 @@ Compute the angle of the given leg for x.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
legAngX(hypotenuse: number, leg: number) -> number
|
legAngX(
|
||||||
|
hypotenuse: number,
|
||||||
|
leg: number,
|
||||||
|
) -> number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
|
@ -9,7 +9,10 @@ Compute the angle of the given leg for y.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
legAngY(hypotenuse: number, leg: number) -> number
|
legAngY(
|
||||||
|
hypotenuse: number,
|
||||||
|
leg: number,
|
||||||
|
) -> number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
|
@ -9,7 +9,10 @@ Compute the length of the given leg.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
legLen(hypotenuse: number, leg: number) -> number
|
legLen(
|
||||||
|
hypotenuse: number,
|
||||||
|
leg: number,
|
||||||
|
) -> number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
|
@ -9,7 +9,12 @@ Extend the current sketch with a new straight line.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
line(sketch: Sketch, end_absolute?: [number], end?: [number], tag?: TagDeclarator) -> Sketch
|
line(
|
||||||
|
sketch: Sketch,
|
||||||
|
endAbsolute?: [number],
|
||||||
|
end?: [number],
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,7 +23,7 @@ line(sketch: Sketch, end_absolute?: [number], end?: [number], tag?: TagDeclarato
|
|||||||
| 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 |
|
||||||
| `end_absolute` | `[number]` | Which absolute point should this line go to? Incompatible with `end`. | No |
|
| `endAbsolute` | `[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 |
|
||||||
|
|
||||||
@ -30,7 +35,7 @@ line(sketch: Sketch, end_absolute?: [number], end?: [number], tag?: TagDeclarato
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
triangle = startSketchOn("XZ")
|
triangle = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
// The 'end' argument means it ends at exactly [10, 0].
|
// The 'end' argument means it ends at exactly [10, 0].
|
||||||
// This is an absolute measurement, it is NOT relative to
|
// This is an absolute measurement, it is NOT relative to
|
||||||
@ -41,7 +46,7 @@ triangle = startSketchOn("XZ")
|
|||||||
|> close()
|
|> close()
|
||||||
|> extrude(length = 5)
|
|> extrude(length = 5)
|
||||||
|
|
||||||
box = startSketchOn("XZ")
|
box = startSketchOn(XZ)
|
||||||
|> startProfileAt([10, 10], %)
|
|> startProfileAt([10, 10], %)
|
||||||
// The 'to' argument means move the pen this much.
|
// The 'to' argument means move the pen this much.
|
||||||
// So, [10, 0] is a relative distance away from the current point.
|
// So, [10, 0] is a relative distance away from the current point.
|
||||||
|
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
@ -9,7 +9,10 @@ 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], map_fn: FunctionParam) -> [KclValue]
|
map(
|
||||||
|
array: [KclValue],
|
||||||
|
mapFn: FunctionSource,
|
||||||
|
) -> [KclValue]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,7 +21,7 @@ map(array: [KclValue], map_fn: FunctionParam) -> [KclValue]
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | | Yes |
|
| `array` | [`[KclValue]`](/docs/kcl/types/KclValue) | | Yes |
|
||||||
| `map_fn` | `FunctionParam` | | Yes |
|
| `mapFn` | `FunctionSource` | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -20,7 +20,7 @@ export fn increment(x) {
|
|||||||
Other files in the project can now import functions that have been exported.
|
Other files in the project can now import functions that have been exported.
|
||||||
This makes them available to use in another file.
|
This makes them available to use in another file.
|
||||||
|
|
||||||
```
|
```norun
|
||||||
// main.kcl
|
// main.kcl
|
||||||
import increment from "util.kcl"
|
import increment from "util.kcl"
|
||||||
|
|
||||||
@ -48,13 +48,13 @@ export fn decrement(x) {
|
|||||||
|
|
||||||
When importing, you can import multiple functions at once.
|
When importing, you can import multiple functions at once.
|
||||||
|
|
||||||
```
|
```norun
|
||||||
import increment, decrement from "util.kcl"
|
import increment, decrement from "util.kcl"
|
||||||
```
|
```
|
||||||
|
|
||||||
Imported symbols can be renamed for convenience or to avoid name collisions.
|
Imported symbols can be renamed for convenience or to avoid name collisions.
|
||||||
|
|
||||||
```
|
```norun
|
||||||
import increment as inc, decrement as dec from "util.kcl"
|
import increment as inc, decrement as dec from "util.kcl"
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -63,13 +63,13 @@ import increment as inc, decrement as dec from "util.kcl"
|
|||||||
`import` can also be used to import files from other CAD systems. The format of the statement is the
|
`import` can also be used to import files from other CAD systems. The format of the statement is the
|
||||||
same as for KCL files. You can only import the whole file, not items from it. E.g.,
|
same as for KCL files. You can only import the whole file, not items from it. E.g.,
|
||||||
|
|
||||||
```
|
```norun
|
||||||
import "tests/inputs/cube.obj"
|
import "tests/inputs/cube.obj"
|
||||||
|
|
||||||
// Use `cube` just like a KCL object.
|
// Use `cube` just like a KCL object.
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```norun
|
||||||
import "tests/inputs/cube-2.sldprt" as cube
|
import "tests/inputs/cube-2.sldprt" as cube
|
||||||
|
|
||||||
// Use `cube` just like a KCL object.
|
// Use `cube` just like a KCL object.
|
||||||
@ -78,7 +78,7 @@ import "tests/inputs/cube-2.sldprt" as cube
|
|||||||
You can make the file format explicit using a format attribute (useful if using a different
|
You can make the file format explicit using a format attribute (useful if using a different
|
||||||
extension), e.g.,
|
extension), e.g.,
|
||||||
|
|
||||||
```
|
```norun
|
||||||
@(format = obj)
|
@(format = obj)
|
||||||
import "tests/inputs/cube"
|
import "tests/inputs/cube"
|
||||||
```
|
```
|
||||||
@ -87,7 +87,7 @@ For formats lacking unit data (such as STL, OBJ, or PLY files), the default
|
|||||||
unit of measurement is millimeters. Alternatively you may specify the unit
|
unit of measurement is millimeters. Alternatively you may specify the unit
|
||||||
by using an attirbute. Likewise, you can also specify a coordinate system. E.g.,
|
by using an attirbute. Likewise, you can also specify a coordinate system. E.g.,
|
||||||
|
|
||||||
```
|
```norun
|
||||||
@(unitLength = ft, coords = opengl)
|
@(unitLength = ft, coords = opengl)
|
||||||
import "tests/inputs/cube.obj"
|
import "tests/inputs/cube.obj"
|
||||||
```
|
```
|
||||||
|
File diff suppressed because one or more lines are too long
@ -9,7 +9,14 @@ 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(sketch_set: SketchSet, instances: integer, center: [number], arc_degrees: number, rotate_duplicates: bool, use_original?: bool) -> [Sketch]
|
patternCircular2d(
|
||||||
|
sketchSet: SketchSet,
|
||||||
|
instances: integer,
|
||||||
|
center: [number],
|
||||||
|
arcDegrees: number,
|
||||||
|
rotateDuplicates: bool,
|
||||||
|
useOriginal?: bool,
|
||||||
|
) -> [Sketch]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,12 +24,12 @@ patternCircular2d(sketch_set: SketchSet, instances: integer, center: [number], a
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketch_set` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketch(es) to pattern | Yes |
|
| `sketchSet` | [`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 |
|
||||||
| `arc_degrees` | `number` | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes |
|
| `arcDegrees` | `number` | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | Yes |
|
||||||
| `rotate_duplicates` | `bool` | Whether or not to rotate the duplicates as they are copied. | Yes |
|
| `rotateDuplicates` | `bool` | Whether or not to rotate the duplicates as they are copied. | Yes |
|
||||||
| `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 |
|
| `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 |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
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
@ -4,9 +4,11 @@ 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
|
||||||
|
@ -9,7 +9,11 @@ Create a regular polygon with the specified number of sides that is either inscr
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
polygon(data: PolygonData, sketch_surface_or_group: SketchOrSurface, tag?: TagDeclarator) -> Sketch
|
polygon(
|
||||||
|
data: PolygonData,
|
||||||
|
sketchSurfaceOrGroup: SketchOrSurface,
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
) -> Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,7 +22,7 @@ polygon(data: PolygonData, sketch_surface_or_group: SketchOrSurface, tag?: TagDe
|
|||||||
| 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 |
|
||||||
| `sketch_surface_or_group` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes |
|
| `sketchSurfaceOrGroup` | [`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
|
||||||
|
@ -9,7 +9,10 @@ Compute the number to a power.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
pow(num: number, pow: number) -> number
|
pow(
|
||||||
|
num: number,
|
||||||
|
pow: number,
|
||||||
|
) -> number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
|
File diff suppressed because one or more lines are too long
@ -27,7 +27,7 @@ profileStartX(sketch: Sketch) -> number
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
sketch001 = startSketchOn('XY')
|
sketch001 = startSketchOn(XY)
|
||||||
|> startProfileAt([5, 2], %)
|
|> startProfileAt([5, 2], %)
|
||||||
|> angledLine([-26.6, 50], %)
|
|> angledLine([-26.6, 50], %)
|
||||||
|> angledLine([90, 50], %)
|
|> angledLine([90, 50], %)
|
||||||
|
@ -27,7 +27,7 @@ profileStartY(sketch: Sketch) -> number
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
sketch001 = startSketchOn('XY')
|
sketch001 = startSketchOn(XY)
|
||||||
|> startProfileAt([5, 2], %)
|
|> startProfileAt([5, 2], %)
|
||||||
|> angledLine({ angle = -60, length = 14 }, %)
|
|> angledLine({ angle = -60, length = 14 }, %)
|
||||||
|> angledLineToY({ angle = 30, to = profileStartY(%) }, %)
|
|> angledLineToY({ angle = 30, to = profileStartY(%) }, %)
|
||||||
|
@ -9,7 +9,10 @@ Append an element to the end of an array.
|
|||||||
Returns a new array with the element appended.
|
Returns a new array with the element appended.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
push(array: [KclValue], elem: KclValue) -> KclValue
|
push(
|
||||||
|
array: [KclValue],
|
||||||
|
elem: KclValue,
|
||||||
|
) -> KclValue
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,11 @@ 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, reduce_fn: FunctionParam) -> KclValue
|
reduce(
|
||||||
|
array: [KclValue],
|
||||||
|
start: KclValue,
|
||||||
|
reduceFn: FunctionSource,
|
||||||
|
) -> KclValue
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +23,7 @@ reduce(array: [KclValue], start: KclValue, reduce_fn: FunctionParam) -> 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 |
|
||||||
| `reduce_fn` | `FunctionParam` | | Yes |
|
| `reduceFn` | `FunctionSource` | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@ -76,7 +80,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 +101,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)
|
||||||
|
|
||||||
|
@ -9,7 +9,10 @@ Compute the remainder after dividing `num` by `div`.
|
|||||||
If `num` is negative, the result will be too.
|
If `num` is negative, the result will be too.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
rem(num: number, divisor: number) -> number
|
rem(
|
||||||
|
num: number,
|
||||||
|
divisor: number,
|
||||||
|
) -> number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
|
File diff suppressed because one or more lines are too long
109
docs/kcl/rotate.md
Normal file
109
docs/kcl/rotate.md
Normal file
File diff suppressed because one or more lines are too long
63
docs/kcl/scale.md
Normal file
63
docs/kcl/scale.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
30
docs/kcl/settings.md
Normal file
30
docs/kcl/settings.md
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
title: "KCL settings"
|
||||||
|
excerpt: "Documentation of settings for the KCL language and Zoo Modeling App."
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
# Per-file settings
|
||||||
|
|
||||||
|
Settings which affect a single file are configured using the settings attribute.
|
||||||
|
This must be at the top of the KCL file (comments before the attribute are permitted).
|
||||||
|
E.g.,
|
||||||
|
|
||||||
|
```
|
||||||
|
// The settings attribute.
|
||||||
|
@settings(defaultLengthUnit = in)
|
||||||
|
|
||||||
|
// The rest of your KCL code goes below...
|
||||||
|
|
||||||
|
x = 42 // Represents 42 inches.
|
||||||
|
```
|
||||||
|
|
||||||
|
The settings attribute may contain multiple properties separated by commas.
|
||||||
|
Valid properties are:
|
||||||
|
|
||||||
|
- `defaultLengthUnit`: the default length unit to use for numbers declared in this file.
|
||||||
|
- Accepted values: `mm`, `cm`, `m`, `in` (inches), `ft` (feet), `yd` (yards).
|
||||||
|
- `defaultAngleUnit`: the default angle unit to use for numbers declared in this file.
|
||||||
|
- Accepted values: `deg` (degrees), `rad` (radians).
|
||||||
|
|
||||||
|
These settings override any project-wide settings (configured in project.toml or via the UI).
|
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
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user