Compare commits
79 Commits
pierremtb/
...
nightly-v2
Author | SHA1 | Date | |
---|---|---|---|
e8af61e11f | |||
de85c31e71 | |||
725c56ea6f | |||
1b958ee29f | |||
4b0f67e604 | |||
8ba1a5cd4d | |||
df278c7e6a | |||
6e57a80c13 | |||
efe6565857 | |||
fa0a34585b | |||
dec74f633b | |||
dfcea282ec | |||
191dcf8bb0 | |||
cb1bbe4660 | |||
ff66cb1deb | |||
ab46349d63 | |||
cffad78bf7 | |||
bfb81877d3 | |||
c56398db83 | |||
36e0d35968 | |||
62bf7d8715 | |||
a4db302174 | |||
66f3500ca9 | |||
c3bdc6f106 | |||
0a2bf4b55f | |||
bbae9b6363 | |||
180d52280d | |||
dce1dca7c7 | |||
343f6572a2 | |||
c8e58d49e0 | |||
c18546fb2f | |||
466c23a9d8 | |||
8403025c77 | |||
9ce591a1a1 | |||
f238f3882b | |||
a91208eb1c | |||
b92b0a9afe | |||
964347f43a | |||
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 |
@ -1,3 +1,4 @@
|
||||
src/wasm-lib/*
|
||||
rust/*
|
||||
*.typegen.ts
|
||||
packages/codemirror-lsp-client/dist/*
|
||||
e2e/playwright/snapshots/prompt-to-edit/*
|
||||
|
10
.github/dependabot.yml
vendored
10
.github/dependabot.yml
vendored
@ -25,7 +25,7 @@ updates:
|
||||
- adamchalmers
|
||||
- jessfraz
|
||||
- package-ecosystem: 'cargo' # See documentation for possible values
|
||||
directory: '/src/wasm-lib/' # Location of package manifests
|
||||
directory: '/rust/' # Location of package manifests
|
||||
schedule:
|
||||
interval: weekly
|
||||
day: monday
|
||||
@ -39,3 +39,11 @@ updates:
|
||||
wasm-bindgen-deps:
|
||||
patterns:
|
||||
- "wasm-bindgen*"
|
||||
- package-ecosystem: "pip" # See documentation for possible values
|
||||
directory: "/rust/kcl-python-bindings/" # Location of package manifests
|
||||
schedule:
|
||||
interval: weekly
|
||||
day: monday
|
||||
reviewers:
|
||||
- adamchalmers
|
||||
- jessfraz
|
||||
|
6
.github/workflows/build-and-store-wasm.yml
vendored
6
.github/workflows/build-and-store-wasm.yml
vendored
@ -21,8 +21,8 @@ jobs:
|
||||
- name: Cache wasm
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: './src/wasm-lib'
|
||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
||||
workspaces: './rust'
|
||||
- uses: taiki-e/install-action@a209ff0ce0349f9e7cadc4ba8f6a415c8d3b0813
|
||||
with:
|
||||
tool: wasm-pack
|
||||
- name: build wasm
|
||||
@ -33,4 +33,4 @@ jobs:
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: wasm-bundle
|
||||
path: src/wasm-lib/pkg
|
||||
path: rust/kcl-wasm-lib/pkg
|
||||
|
61
.github/workflows/build-apps.yml
vendored
61
.github/workflows/build-apps.yml
vendored
@ -7,14 +7,11 @@ on:
|
||||
- main
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
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)
|
||||
- 'nightly-v[0-9]+.[0-9]+.[0-9]+'
|
||||
|
||||
env:
|
||||
IS_RELEASE: ${{ github.ref_type == 'tag' }}
|
||||
IS_NIGHTLY: ${{ github.event_name == 'schedule' }}
|
||||
IS_RELEASE: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
|
||||
IS_NIGHTLY: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'nightly-v') }}
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
@ -32,6 +29,7 @@ jobs:
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
|
||||
- run: yarn install
|
||||
|
||||
@ -40,10 +38,10 @@ jobs:
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: './src/wasm-lib'
|
||||
workspaces: './rust'
|
||||
|
||||
# TODO: see if we can fetch from main instead if no diff at src/wasm-lib
|
||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
||||
# TODO: see if we can fetch from main instead if no diff at rust
|
||||
- uses: taiki-e/install-action@a209ff0ce0349f9e7cadc4ba8f6a415c8d3b0813
|
||||
with:
|
||||
tool: wasm-pack
|
||||
|
||||
@ -52,7 +50,10 @@ jobs:
|
||||
|
||||
- name: Set nightly version, product name, release notes, and icons
|
||||
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
|
||||
if: ${{ env.IS_RELEASE == 'true' }}
|
||||
@ -66,7 +67,7 @@ jobs:
|
||||
path: |
|
||||
package.json
|
||||
electron-builder.yml
|
||||
src/wasm-lib/pkg/wasm_lib*
|
||||
rust/kcl-wasm-lib/pkg/kcl_wasm_lib*
|
||||
release-notes.md
|
||||
assets/icon.ico
|
||||
assets/icon.png
|
||||
@ -116,21 +117,24 @@ jobs:
|
||||
ls -R prepared-files
|
||||
cp prepared-files/package.json package.json
|
||||
cp prepared-files/electron-builder.yml electron-builder.yml
|
||||
cp prepared-files/src/wasm-lib/pkg/wasm_lib_bg.wasm public
|
||||
mkdir src/wasm-lib/pkg
|
||||
cp prepared-files/src/wasm-lib/pkg/wasm_lib* src/wasm-lib/pkg
|
||||
cp prepared-files/rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public
|
||||
mkdir rust/kcl-wasm-lib/pkg
|
||||
cp prepared-files/rust/kcl-wasm-lib/pkg/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
|
||||
cp prepared-files/release-notes.md release-notes.md
|
||||
cp prepared-files/assets/icon.ico assets/icon.ico
|
||||
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:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn' # Set this to npm, yarn or pnpm.
|
||||
|
||||
- name: yarn install
|
||||
# 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.2
|
||||
with:
|
||||
shell: bash
|
||||
timeout_minutes: 2
|
||||
max_attempts: 3
|
||||
command: yarn install
|
||||
@ -180,8 +184,9 @@ jobs:
|
||||
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
|
||||
DEBUG: "electron-notarize*"
|
||||
# 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.2
|
||||
with:
|
||||
shell: bash
|
||||
timeout_minutes: 10
|
||||
max_attempts: 3
|
||||
command: yarn tronb:package:prod
|
||||
@ -241,8 +246,9 @@ jobs:
|
||||
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
|
||||
DEBUG: "electron-notarize*"
|
||||
# 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.2
|
||||
with:
|
||||
shell: bash
|
||||
timeout_minutes: 10
|
||||
max_attempts: 3
|
||||
command: yarn tronb:package:prod
|
||||
@ -270,7 +276,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: write
|
||||
if: ${{ github.ref_type == 'tag' || github.event_name == 'schedule' }}
|
||||
if: ${{ github.ref_type == 'tag' }}
|
||||
env:
|
||||
VERSION_NO_V: ${{ needs.prepare-files.outputs.version }}
|
||||
VERSION: ${{ format('v{0}', needs.prepare-files.outputs.version) }}
|
||||
@ -327,8 +333,8 @@ jobs:
|
||||
env:
|
||||
NOTES: ${{ needs.prepare-files.outputs.notes }}
|
||||
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' }}
|
||||
URL_CODED_NAME: ${{ github.event_name == 'schedule' && 'Zoo%20Modeling%20App%20%28Nightly%29' || 'Zoo%20Modeling%20App' }}
|
||||
WEBSITE_DIR: ${{ env.IS_NIGHTLY == 'true' && 'dl.zoo.dev/releases/modeling-app/nightly' || 'dl.zoo.dev/releases/modeling-app' }}
|
||||
URL_CODED_NAME: ${{ env.IS_NIGHTLY == 'true' && 'Zoo%20Modeling%20App%20%28Nightly%29' || 'Zoo%20Modeling%20App' }}
|
||||
run: |
|
||||
RELEASE_DIR=https://${WEBSITE_DIR}
|
||||
jq --null-input \
|
||||
@ -383,7 +389,7 @@ jobs:
|
||||
# see https://github.com/actions/checkout/issues/1471
|
||||
git fetch --prune --unshallow --tags
|
||||
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)
|
||||
yarn files:set-notes
|
||||
|
||||
@ -411,14 +417,3 @@ jobs:
|
||||
- name: Invalidate bucket cache on latest*.yml and last_download.json files
|
||||
if: ${{ env.IS_NIGHTLY == 'true' }}
|
||||
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 })
|
||||
|
19
.github/workflows/cargo-check.yml
vendored
19
.github/workflows/cargo-check.yml
vendored
@ -17,23 +17,20 @@ jobs:
|
||||
cargocheck:
|
||||
name: cargo check
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
dir: ['src/wasm-lib']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install latest rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
- name: Use correct Rust toolchain
|
||||
shell: bash
|
||||
run: |
|
||||
cp --update=none rust/rust-toolchain.toml ./ || true
|
||||
- name: Install rust
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- name: Rust Cache
|
||||
uses: Swatinem/rust-cache@v2.6.1
|
||||
cache-workspaces: rust
|
||||
|
||||
- name: Run check
|
||||
run: |
|
||||
cd "${{ matrix.dir }}"
|
||||
cd rust
|
||||
# We specifically want to test the disable-println feature
|
||||
# Since it is not enabled by default, we need to specify it
|
||||
# This is used in kcl-lsp
|
||||
|
21
.github/workflows/cargo-clippy.yml
vendored
21
.github/workflows/cargo-clippy.yml
vendored
@ -23,25 +23,22 @@ jobs:
|
||||
cargoclippy:
|
||||
name: cargo clippy
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
dir: ['src/wasm-lib']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: taiki-e/install-action@just
|
||||
- name: Install latest rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
- name: Use correct Rust toolchain
|
||||
shell: bash
|
||||
run: |
|
||||
cp --update=none rust/rust-toolchain.toml ./ || true
|
||||
- name: Install rust
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
components: clippy
|
||||
|
||||
- name: Rust Cache
|
||||
uses: Swatinem/rust-cache@v2.6.1
|
||||
cache-workspaces: rust
|
||||
components: clippy
|
||||
|
||||
- name: Run clippy
|
||||
run: |
|
||||
cd "${{ matrix.dir }}"
|
||||
cd rust
|
||||
just lint
|
||||
# If this fails, run "cargo check" to update Cargo.lock,
|
||||
# then add Cargo.lock to the PR.
|
||||
|
21
.github/workflows/cargo-fmt.yml
vendored
21
.github/workflows/cargo-fmt.yml
vendored
@ -26,23 +26,20 @@ jobs:
|
||||
cargofmt:
|
||||
name: cargo fmt
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
dir: ['src/wasm-lib']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install latest rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
- name: Use correct Rust toolchain
|
||||
shell: bash
|
||||
run: |
|
||||
cp --update=none rust/rust-toolchain.toml ./ || true
|
||||
- name: Install rust
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
components: rustfmt
|
||||
|
||||
- name: Rust Cache
|
||||
uses: Swatinem/rust-cache@v2.6.1
|
||||
cache-workspaces: rust
|
||||
components: rustfmt
|
||||
|
||||
- name: Run cargo fmt
|
||||
run: |
|
||||
cd "${{ matrix.dir }}"
|
||||
cd rust
|
||||
cargo fmt -- --check
|
||||
shell: bash
|
||||
|
24
.github/workflows/cargo-test.yml
vendored
24
.github/workflows/cargo-test.yml
vendored
@ -9,21 +9,21 @@ permissions: read-all
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
name: cargo test of wasm-lib
|
||||
name: cargo test
|
||||
jobs:
|
||||
cargotest:
|
||||
name: cargo test
|
||||
runs-on: ubuntu-latest-8-cores
|
||||
strategy:
|
||||
matrix:
|
||||
dir: ['src/wasm-lib']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install latest rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
- name: Use correct Rust toolchain
|
||||
shell: bash
|
||||
run: |
|
||||
cp --update=none rust/rust-toolchain.toml ./ || true
|
||||
- name: Install rust
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
cache: false # Configured below.
|
||||
- name: Install vector
|
||||
run: |
|
||||
curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh
|
||||
@ -42,11 +42,13 @@ jobs:
|
||||
- uses: taiki-e/install-action@nextest
|
||||
- name: Rust Cache
|
||||
uses: Swatinem/rust-cache@v2.6.1
|
||||
with:
|
||||
workspaces: rust
|
||||
- name: cargo test
|
||||
shell: bash
|
||||
run: |-
|
||||
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
|
||||
cd rust
|
||||
cargo llvm-cov nextest --workspace --lcov --output-path lcov.info --retries=2 --no-fail-fast -P ci 2>&1 | tee /tmp/github-actions.log
|
||||
env:
|
||||
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
|
||||
RUST_MIN_STACK: 10485760000
|
||||
@ -55,7 +57,7 @@ jobs:
|
||||
with:
|
||||
token: ${{secrets.CODECOV_TOKEN}}
|
||||
fail_ci_if_error: true
|
||||
flags: wasm-lib
|
||||
flags: rust
|
||||
verbose: true
|
||||
files: lcov.info
|
||||
|
||||
|
61
.github/workflows/e2e-tests.yml
vendored
61
.github/workflows/e2e-tests.yml
vendored
@ -3,6 +3,8 @@ on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: 0 * * * * # hourly
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
@ -15,23 +17,6 @@ permissions:
|
||||
|
||||
|
||||
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:
|
||||
timeout-minutes: 60
|
||||
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]
|
||||
shardIndex: [1, 2, 3, 4]
|
||||
shardTotal: [4]
|
||||
# TODO: add ref here for main and latest release tag
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: check-rust-changes
|
||||
steps:
|
||||
- uses: actions/create-github-app-token@v1
|
||||
id: app-token
|
||||
@ -54,12 +39,19 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ steps.app-token.outputs.token }}
|
||||
- id: filter
|
||||
name: Check for Rust changes
|
||||
uses: dorny/paths-filter@v3
|
||||
with:
|
||||
filters: |
|
||||
rust:
|
||||
- 'rust/**'
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
- uses: KittyCAD/action-install-cli@main
|
||||
- name: Install dependencies
|
||||
id: deps-install
|
||||
shell: bash
|
||||
run: yarn
|
||||
- name: Cache Playwright Browsers
|
||||
@ -73,7 +65,7 @@ jobs:
|
||||
run: yarn playwright install --with-deps
|
||||
- name: Download Wasm Cache
|
||||
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
|
||||
continue-on-error: true
|
||||
with:
|
||||
@ -81,27 +73,27 @@ jobs:
|
||||
name: wasm-bundle
|
||||
workflow: build-and-store-wasm.yml
|
||||
branch: main
|
||||
path: src/wasm-lib/pkg
|
||||
path: rust/kcl-wasm-lib/pkg
|
||||
- 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
|
||||
run: cp src/wasm-lib/pkg/wasm_lib_bg.wasm public
|
||||
run: cp rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public
|
||||
continue-on-error: true
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
||||
- uses: taiki-e/install-action@a209ff0ce0349f9e7cadc4ba8f6a415c8d3b0813
|
||||
with:
|
||||
tool: wasm-pack
|
||||
- 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
|
||||
with:
|
||||
workspaces: './src/wasm-lib'
|
||||
workspaces: './rust'
|
||||
- name: OR Cache Wasm (because wasm cache failed)
|
||||
if: steps.download-wasm.outcome == 'failure'
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: './src/wasm-lib'
|
||||
workspaces: './rust'
|
||||
- name: install good sed
|
||||
if: ${{ startsWith(matrix.os, 'macos') }}
|
||||
shell: bash
|
||||
@ -126,7 +118,7 @@ jobs:
|
||||
cat /tmp/vector.toml
|
||||
${HOME}/.vector/bin/vector --config /tmp/vector.toml &
|
||||
- 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
|
||||
run: yarn build:wasm
|
||||
- name: OR Build Wasm (because wasm cache failed)
|
||||
@ -142,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,
|
||||
# but we could do better. This forces a large 1/1 shard of all 20 snapshot tests that runs in about 3 minutes.
|
||||
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:
|
||||
CI: true
|
||||
NODE_ENV: development
|
||||
@ -153,7 +145,7 @@ jobs:
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ !cancelled() && (success() || failure()) }}
|
||||
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/
|
||||
include-hidden-files: true
|
||||
retention-days: 30
|
||||
@ -167,7 +159,7 @@ jobs:
|
||||
shell: bash
|
||||
id: git-check
|
||||
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"
|
||||
then echo "modified=true" >> $GITHUB_OUTPUT
|
||||
else echo "modified=false" >> $GITHUB_OUTPUT
|
||||
@ -176,7 +168,7 @@ jobs:
|
||||
if: steps.git-check.outputs.modified == 'true'
|
||||
shell: bash
|
||||
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.name "github-actions[bot]"
|
||||
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
|
||||
@ -202,9 +194,10 @@ jobs:
|
||||
path: test-results/
|
||||
- name: Run playwright/electron flow (with retries)
|
||||
id: retry
|
||||
if: ${{ !cancelled() && (success() || failure()) }}
|
||||
uses: nick-fields/retry@v3.0.1
|
||||
if: ${{ !cancelled() && steps.deps-install.outcome == 'success' }}
|
||||
uses: nick-fields/retry@v3.0.2
|
||||
with:
|
||||
shell: bash
|
||||
command: .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}}
|
||||
timeout_minutes: 30
|
||||
max_attempts: 25
|
||||
|
179
.github/workflows/kcl-python-bindings.yml
vendored
Normal file
179
.github/workflows/kcl-python-bindings.yml
vendored
Normal file
@ -0,0 +1,179 @@
|
||||
# This file is autogenerated by maturin v1.6.0 and then modified
|
||||
# To update, run
|
||||
#
|
||||
# maturin generate-ci github
|
||||
#
|
||||
name: kcl-python-bindings
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '**/Cargo.toml'
|
||||
- '**/Cargo.lock'
|
||||
- '**/rust-toolchain.toml'
|
||||
- 'rust/kcl-python-bindings/**'
|
||||
- '**.rs'
|
||||
- .github/workflows/kcl-python-bindings.yml
|
||||
tags:
|
||||
- 'kcl-*'
|
||||
pull_request:
|
||||
paths:
|
||||
- '**/Cargo.toml'
|
||||
- '**/Cargo.lock'
|
||||
- '**/rust-toolchain.toml'
|
||||
- 'rust/kcl-python-bindings/**'
|
||||
- '**.rs'
|
||||
- .github/workflows/kcl-python-bindings.yml
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
linux-x86_64:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
- name: Build wheels
|
||||
uses: PyO3/maturin-action@v1
|
||||
with:
|
||||
working-directory: rust/kcl-python-bindings
|
||||
target: x86_64
|
||||
args: --release --out dist --find-interpreter
|
||||
sccache: 'true'
|
||||
manylinux: auto
|
||||
before-script-linux: |
|
||||
yum install openssl-devel -y
|
||||
- name: Upload wheels
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: wheels-linux-x86_64
|
||||
path: rust/kcl-python-bindings/dist
|
||||
|
||||
windows:
|
||||
runs-on: windows-16-cores
|
||||
strategy:
|
||||
matrix:
|
||||
target:
|
||||
- x64
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
architecture: ${{ matrix.target }}
|
||||
- name: Build wheels
|
||||
uses: PyO3/maturin-action@v1
|
||||
with:
|
||||
working-directory: rust/kcl-python-bindings
|
||||
target: ${{ matrix.target }}
|
||||
args: --release --out dist --find-interpreter
|
||||
sccache: 'true'
|
||||
- name: Upload wheels
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: wheels-windows-${{ matrix.target }}
|
||||
path: rust/kcl-python-bindings/dist
|
||||
|
||||
macos:
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
matrix:
|
||||
target:
|
||||
- x86_64
|
||||
- aarch64
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
- name: Build wheels
|
||||
uses: PyO3/maturin-action@v1
|
||||
with:
|
||||
working-directory: rust/kcl-python-bindings
|
||||
target: ${{ matrix.target }}
|
||||
args: --release --out dist --find-interpreter
|
||||
sccache: 'true'
|
||||
- name: Upload wheels
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: wheels-macos-${{ matrix.target }}
|
||||
path: rust/kcl-python-bindings/dist
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
- uses: taiki-e/install-action@just
|
||||
- name: Run tests
|
||||
run: |
|
||||
cd rust/kcl-python-bindings
|
||||
just setup-uv
|
||||
just test
|
||||
env:
|
||||
KITTYCAD_API_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN }}
|
||||
|
||||
sdist:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install the latest version of uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
- name: Install codespell
|
||||
run: |
|
||||
uv venv .venv
|
||||
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
|
||||
echo "$PWD/.venv/bin" >> $GITHUB_PATH
|
||||
uv pip install pip --upgrade
|
||||
- name: Build sdist
|
||||
uses: PyO3/maturin-action@v1
|
||||
with:
|
||||
working-directory: rust/kcl-python-bindings
|
||||
command: sdist
|
||||
args: --out dist
|
||||
- name: Upload sdist
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: wheels-sdist
|
||||
path: rust/kcl-python-bindings/dist
|
||||
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
needs: [linux-x86_64, windows, macos, sdist]
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
- name: Install the latest version of uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
- name: Install codespell
|
||||
run: |
|
||||
cd rust/kcl-python-bindings
|
||||
uv venv .venv
|
||||
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
|
||||
echo "$PWD/.venv/bin" >> $GITHUB_PATH
|
||||
uv pip install pip --upgrade
|
||||
- name: Publish to PyPI
|
||||
uses: PyO3/maturin-action@v1
|
||||
env:
|
||||
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
||||
with:
|
||||
working-directory: rust/kcl-python-bindings
|
||||
command: upload
|
||||
args: --non-interactive --skip-existing wheels-*/*
|
24
.github/workflows/ruff.yml
vendored
Normal file
24
.github/workflows/ruff.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
name: ruff
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
on:
|
||||
push:
|
||||
branches: main
|
||||
paths:
|
||||
- '**.py'
|
||||
- .github/workflows/ruff.yml
|
||||
pull_request:
|
||||
paths:
|
||||
- '**.py'
|
||||
- .github/workflows/ruff.yml
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
jobs:
|
||||
ruff:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/ruff-action@v3
|
||||
|
10
.github/workflows/static-analysis.yml
vendored
10
.github/workflows/static-analysis.yml
vendored
@ -37,7 +37,7 @@ jobs:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
- run: yarn install
|
||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
||||
- uses: taiki-e/install-action@a209ff0ce0349f9e7cadc4ba8f6a415c8d3b0813
|
||||
with:
|
||||
tool: wasm-pack
|
||||
- run: yarn build:wasm
|
||||
@ -54,9 +54,9 @@ jobs:
|
||||
- run: yarn install
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: './src/wasm-lib'
|
||||
workspaces: './rust'
|
||||
|
||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
||||
- uses: taiki-e/install-action@a209ff0ce0349f9e7cadc4ba8f6a415c8d3b0813
|
||||
with:
|
||||
tool: wasm-pack
|
||||
- run: yarn build:wasm
|
||||
@ -98,7 +98,7 @@ jobs:
|
||||
cache: 'yarn'
|
||||
|
||||
- run: yarn install
|
||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
||||
- uses: taiki-e/install-action@a209ff0ce0349f9e7cadc4ba8f6a415c8d3b0813
|
||||
with:
|
||||
tool: wasm-pack
|
||||
- run: yarn build:wasm
|
||||
@ -127,7 +127,7 @@ jobs:
|
||||
cache: 'yarn'
|
||||
|
||||
- run: yarn install
|
||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
||||
- uses: taiki-e/install-action@a209ff0ce0349f9e7cadc4ba8f6a415c8d3b0813
|
||||
with:
|
||||
tool: wasm-pack
|
||||
- run: yarn build:wasm
|
||||
|
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
|
26
.gitignore
vendored
26
.gitignore
vendored
@ -24,18 +24,17 @@ yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
.idea
|
||||
# .vscode
|
||||
.vscode
|
||||
.helix
|
||||
src/wasm-lib/.idea
|
||||
src/wasm-lib/.vscode
|
||||
|
||||
# rust
|
||||
src/wasm-lib/target
|
||||
src/wasm-lib/bindings
|
||||
src/wasm-lib/kcl/bindings
|
||||
public/wasm_lib_bg.wasm
|
||||
src/wasm-lib/lcov.info
|
||||
src/wasm-lib/grackle/test_json_output
|
||||
rust/target
|
||||
rust/kcl-lib/bindings
|
||||
public/kcl_wasm_lib_bg.wasm
|
||||
rust/lcov.info
|
||||
rust/kcl-wasm-lib/pkg
|
||||
*.snap.new
|
||||
rust/kcl-lib/fuzz/Cargo.lock
|
||||
|
||||
e2e/playwright/playwright-secrets.env
|
||||
e2e/playwright/temp1.png
|
||||
@ -59,15 +58,18 @@ e2e/playwright/export-snapshots/*
|
||||
## generated files
|
||||
src/**/*.typegen.ts
|
||||
|
||||
src/wasm-lib/grackle/stdlib_cube_partial.json
|
||||
Mac_App_Distribution.provisionprofile
|
||||
|
||||
*.tsbuildinfo
|
||||
src/wasm-lib/pkg
|
||||
|
||||
.eslintcache
|
||||
venv
|
||||
.vite/
|
||||
|
||||
# electron
|
||||
out/
|
||||
|
||||
# python
|
||||
__pycache__/
|
||||
uv.lock
|
||||
rust/kcl-python-bindings/dist
|
||||
venv
|
||||
|
@ -7,9 +7,9 @@ coverage
|
||||
*.rs
|
||||
*.hbs
|
||||
target
|
||||
src/wasm-lib/pkg
|
||||
src/wasm-lib/kcl/bindings
|
||||
rust/
|
||||
e2e/playwright/export-snapshots
|
||||
e2e/playwright/snapshots/prompt-to-edit
|
||||
|
||||
|
||||
# XState generated files
|
||||
|
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@ -1,5 +0,0 @@
|
||||
{
|
||||
"rust-analyzer.linkedProjects": [
|
||||
"src/wasm-lib/Cargo.toml"
|
||||
]
|
||||
}
|
4
Makefile
4
Makefile
@ -1,6 +1,6 @@
|
||||
.PHONY: dev
|
||||
|
||||
WASM_LIB_FILES := $(wildcard src/wasm-lib/**/*.rs)
|
||||
KCL_WASM_LIB_FILES := $(wildcard rust/**/*.rs)
|
||||
TS_SRC := $(wildcard src/**/*.tsx) $(wildcard src/**/*.ts)
|
||||
XSTATE_TYPEGENS := $(wildcard src/machines/*.typegen.ts)
|
||||
|
||||
@ -18,7 +18,7 @@ lee-electron-test:
|
||||
$(XSTATE_TYPEGENS): $(TS_SRC)
|
||||
yarn xstate typegen 'src/**/*.ts?(x)'
|
||||
|
||||
public/wasm_lib_bg.wasm: $(WASM_LIB_FILES)
|
||||
public/kcl_wasm_lib_bg.wasm: $(KCL_WASM_LIB_FILES)
|
||||
yarn build:wasm
|
||||
|
||||
node_modules: package.json yarn.lock
|
||||
|
36
README.md
36
README.md
@ -40,7 +40,7 @@ The 3D view in Modeling App is just a video stream from our hosted geometry engi
|
||||
|
||||
[Original demo video](https://drive.google.com/file/d/183_wjqGdzZ8EEZXSqZ3eDcJocYPCyOdC/view?pli=1)
|
||||
|
||||
[Original demo slides](https://github.com/KittyCAD/Eng/files/10398178/demo.pdf)
|
||||
[Original demo slides](https://github.com/user-attachments/files/19010536/demo.pdf)
|
||||
|
||||
## Get started
|
||||
|
||||
@ -52,18 +52,21 @@ Install a node version manager such as [fnm](https://github.com/Schniz/fnm?tab=r
|
||||
|
||||
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.
|
||||
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
|
||||
```
|
||||
|
||||
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
|
||||
@ -75,6 +78,7 @@ yarn install:wasm-pack:cargo
|
||||
```
|
||||
|
||||
Then to build the WASM layer, run:
|
||||
|
||||
```
|
||||
# macOS/Linux
|
||||
yarn build:wasm
|
||||
@ -135,6 +139,7 @@ To package the app for your platform with electron-builder, run `yarn tronb:pack
|
||||
Which commands from setup are one off vs need to be run every time?
|
||||
|
||||
The following will need to be run when checking out a new commit and guarantees the build is not stale:
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
yarn build:wasm
|
||||
@ -185,11 +190,12 @@ Manually test against this [list](https://github.com/KittyCAD/modeling-app/issue
|
||||
|
||||
##### Updater-test builds
|
||||
|
||||
The other `build-apps` output in the release `build-apps` workflow (triggered by 2.) is `updater-test-{arch}-{platform}`. It's a semi-automated process: for macOS, Windows, and Linux, download the corresponding updater-test artifact file, install the app, run it, expect an updater prompt to a dummy v0.255.255, install it and check that the app comes back at that version.
|
||||
The other `build-apps` output in the release `build-apps` workflow (triggered by 2.) is `updater-test-{arch}-{platform}`. It's a semi-automated process: for macOS, Windows, and Linux, download the corresponding updater-test artifact file, install the app, run it, expect an updater prompt to a dummy v0.255.255, install it and check that the app comes back at that version.
|
||||
|
||||
The only difference with these builds is that they point to a different update location on the release bucket, with this dummy v0.255.255 always available. This helps ensuring that the version we release will be able to update to the next one available.
|
||||
|
||||
If the prompt doesn't show up, start the app in command line to grab the electron-updater logs. This is likely an issue with the current build that needs addressing (or the updater-test location in the storage bucket).
|
||||
|
||||
```
|
||||
# Windows (PowerShell)
|
||||
& 'C:\Program Files\Zoo Modeling App\Zoo Modeling App.exe'
|
||||
@ -205,15 +211,14 @@ If the prompt doesn't show up, start the app in command line to grab the electro
|
||||
|
||||
Head over to https://github.com/KittyCAD/modeling-app/releases/new, pick the newly created tag and type it in the _Release title_ field as well.
|
||||
|
||||
Hit _Generate release notes_ as a starting point to discuss the changelog in the issue. Once done, make sure _Set as the latest release_ is checked, and hit _Publish release_.
|
||||
Hit _Generate release notes_ as a starting point to discuss the changelog in the issue. Once done, make sure _Set as the latest release_ is checked, and hit _Publish release_.
|
||||
|
||||
A new `publish-apps-release` will kick in and you should be able to find it [here](https://github.com/KittyCAD/modeling-app/actions?query=event%3Arelease). On success, the files will be uploaded to the public bucket as well as to the GitHub release, and the announcement on Discord will be sent.
|
||||
A new `publish-apps-release` will kick in and you should be able to find it [here](https://github.com/KittyCAD/modeling-app/actions?query=event%3Arelease). On success, the files will be uploaded to the public bucket as well as to the GitHub release, and the announcement on Discord will be sent.
|
||||
|
||||
#### 5. Close the issue
|
||||
|
||||
If everything is well and the release is out to the public, the issue tracking the release shall be closed.
|
||||
|
||||
|
||||
## Fuzzing the parser
|
||||
|
||||
Make sure you install cargo fuzz:
|
||||
@ -223,7 +228,7 @@ $ cargo install cargo-fuzz
|
||||
```
|
||||
|
||||
```bash
|
||||
$ cd src/wasm-lib/kcl
|
||||
$ cd rust/kcl-lib
|
||||
|
||||
# list the fuzz targets
|
||||
$ cargo fuzz list
|
||||
@ -251,6 +256,7 @@ snapshottoken=<your-snapshot-token>
|
||||
For a portable way to run Playwright you'll need Docker.
|
||||
|
||||
#### Generic example
|
||||
|
||||
After that, open a terminal and run:
|
||||
|
||||
```bash
|
||||
@ -263,7 +269,6 @@ and in another terminal, run:
|
||||
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project="Google Chrome" <test suite>
|
||||
```
|
||||
|
||||
|
||||
#### Specific example
|
||||
|
||||
open a terminal and run:
|
||||
@ -281,7 +286,6 @@ PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project=
|
||||
run a specific test change the test from `test('...` to `test.only('...`
|
||||
(note if you commit this, the tests will instantly fail without running any of the tests)
|
||||
|
||||
|
||||
**Gotcha**: running the docker container with a mismatched image against your `./node_modules/playwright` will cause a failure. Make sure the versions are matched and up to date.
|
||||
|
||||
run headed
|
||||
@ -375,17 +379,19 @@ Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testin
|
||||
- `just`
|
||||
|
||||
#### Setting KITTYCAD_API_TOKEN
|
||||
|
||||
Use the production zoo.dev token, set this environment variable before running the tests
|
||||
|
||||
#### Installing cargonextest
|
||||
|
||||
```
|
||||
cd src/wasm-lib
|
||||
cd rust
|
||||
cargo search cargo-nextest
|
||||
cargo install cargo-nextest
|
||||
```
|
||||
|
||||
#### just
|
||||
|
||||
install [`just`](https://github.com/casey/just?tab=readme-ov-file#pre-built-binaries)
|
||||
|
||||
#### Running the tests
|
||||
@ -395,7 +401,7 @@ install [`just`](https://github.com/casey/just?tab=readme-ov-file#pre-built-bina
|
||||
# Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set
|
||||
# Make sure you installed cargo-nextest
|
||||
# Make sure you installed just
|
||||
cd src/wasm-lib
|
||||
cd rust
|
||||
just test
|
||||
```
|
||||
|
||||
@ -403,7 +409,7 @@ just test
|
||||
# Without just
|
||||
# Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set
|
||||
# Make sure you installed cargo-nextest
|
||||
cd src/wasm-lib
|
||||
cd rust
|
||||
export RUST_BRACKTRACE="full" && cargo nextest run --workspace --test-threads=1
|
||||
```
|
||||
|
||||
@ -412,13 +418,14 @@ Where `XXX` is an API token from the production engine (NOT the dev environment)
|
||||
We recommend using [nextest](https://nexte.st/) to run the Rust tests (its faster and is used in CI). Once installed, run the tests using
|
||||
|
||||
```
|
||||
cd src/wasm-lib
|
||||
cd rust
|
||||
KITTYCAD_API_TOKEN=XXX cargo run nextest
|
||||
```
|
||||
|
||||
### Mapping CI CD jobs to local commands
|
||||
|
||||
When you see the CI CD fail on jobs you may wonder three things
|
||||
|
||||
- Do I have a bug in my code?
|
||||
- Is the test flaky?
|
||||
- Is there a bug in `main`?
|
||||
@ -437,7 +444,6 @@ yarn test-setup
|
||||
|
||||
> Gotcha, are packages up to date and is the wasm built?
|
||||
|
||||
|
||||
```
|
||||
yarn tsc
|
||||
yarn fmt-check
|
||||
@ -493,7 +499,7 @@ PS: for the debug panel, the following JSON is useful for snapping the camera
|
||||
|
||||
## KCL
|
||||
|
||||
For how to contribute to KCL, [see our KCL README](https://github.com/KittyCAD/modeling-app/tree/main/src/wasm-lib/kcl).
|
||||
For how to contribute to KCL, [see our KCL README](https://github.com/KittyCAD/modeling-app/tree/main/rust/kcl-lib).
|
||||
|
||||
### Logging
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
---
|
||||
title: "QUARTER_TURN"
|
||||
excerpt: ""
|
||||
layout: manual
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```js
|
||||
QUARTER_TURN: number(deg) = 90deg
|
||||
```
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
---
|
||||
title: "THREE_QUARTER_TURN"
|
||||
excerpt: ""
|
||||
layout: manual
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```js
|
||||
THREE_QUARTER_TURN: number(deg) = 270deg
|
||||
```
|
||||
|
||||
|
@ -9,7 +9,7 @@ Compute the absolute value of a number.
|
||||
|
||||
|
||||
```js
|
||||
abs(num: number) -> number
|
||||
abs(num: number): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -9,7 +9,7 @@ Compute the arccosine of a number (in radians).
|
||||
|
||||
|
||||
```js
|
||||
acos(num: number) -> number
|
||||
acos(num: number): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -9,7 +9,11 @@ Returns the angle to match the given length for x.
|
||||
|
||||
|
||||
```js
|
||||
angleToMatchLengthX(tag: TagIdentifier, to: number, sketch: Sketch) -> number
|
||||
angleToMatchLengthX(
|
||||
tag: TagIdentifier,
|
||||
to: number,
|
||||
sketch: Sketch,
|
||||
): number
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,11 @@ Returns the angle to match the given length for y.
|
||||
|
||||
|
||||
```js
|
||||
angleToMatchLengthY(tag: TagIdentifier, to: number, sketch: Sketch) -> number
|
||||
angleToMatchLengthY(
|
||||
tag: TagIdentifier,
|
||||
to: number,
|
||||
sketch: Sketch,
|
||||
): number
|
||||
```
|
||||
|
||||
|
||||
|
@ -1,15 +1,19 @@
|
||||
---
|
||||
title: "angledLine"
|
||||
excerpt: "Draw a line segment relative to the current origin using the polar"
|
||||
excerpt: "Draw a line segment relative to the current origin using the polar measure of some angle and distance."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Draw a line segment relative to the current origin using the polar
|
||||
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
|
||||
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
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> yLineTo(15, %)
|
||||
|> angledLine({ angle = 30, length = 15 }, %)
|
||||
|
@ -1,15 +1,19 @@
|
||||
---
|
||||
title: "angledLineOfXLength"
|
||||
excerpt: "Create a line segment from the current 2-dimensional sketch origin"
|
||||
excerpt: "Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some relative length in the 'x' dimension."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Create a line segment from the current 2-dimensional sketch origin
|
||||
Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some relative length in the 'x' dimension.
|
||||
|
||||
|
||||
along some angle (in degrees) for some relative length in the 'x' dimension.
|
||||
|
||||
```js
|
||||
angledLineOfXLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
angledLineOfXLength(
|
||||
data: AngledLineData,
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -29,7 +33,7 @@ angledLineOfXLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -
|
||||
### Examples
|
||||
|
||||
```js
|
||||
sketch001 = startSketchOn('XZ')
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> angledLineOfXLength({ angle = 45, length = 10 }, %, $edge1)
|
||||
|> angledLineOfXLength({ angle = -15, length = 20 }, %, $edge2)
|
||||
|
@ -1,15 +1,19 @@
|
||||
---
|
||||
title: "angledLineOfYLength"
|
||||
excerpt: "Create a line segment from the current 2-dimensional sketch origin"
|
||||
excerpt: "Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some relative length in the 'y' dimension."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Create a line segment from the current 2-dimensional sketch origin
|
||||
Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some relative length in the 'y' dimension.
|
||||
|
||||
|
||||
along some angle (in degrees) for some relative length in the 'y' dimension.
|
||||
|
||||
```js
|
||||
angledLineOfYLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
angledLineOfYLength(
|
||||
data: AngledLineData,
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -29,7 +33,7 @@ angledLineOfYLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(end = [10, 0])
|
||||
|> angledLineOfYLength({ angle = 45, length = 10 }, %)
|
||||
|
@ -1,15 +1,19 @@
|
||||
---
|
||||
title: "angledLineThatIntersects"
|
||||
excerpt: "Draw an angled line from the current origin, constructing a line segment"
|
||||
excerpt: "Draw an angled line from the current origin, constructing a line segment such that the newly created line intersects the desired target line segment."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Draw an angled line from the current origin, constructing a line segment
|
||||
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
|
||||
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
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(endAbsolute = [5, 10])
|
||||
|> line(endAbsolute = [-10, 10], tag = $lineToIntersect)
|
||||
|
@ -1,15 +1,19 @@
|
||||
---
|
||||
title: "angledLineToX"
|
||||
excerpt: "Create a line segment from the current 2-dimensional sketch origin"
|
||||
excerpt: "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."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Create a line segment from the current 2-dimensional sketch origin
|
||||
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
|
||||
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
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> angledLineToX({ angle = 30, to = 10 }, %)
|
||||
|> line(end = [0, 10])
|
||||
|
@ -1,15 +1,19 @@
|
||||
---
|
||||
title: "angledLineToY"
|
||||
excerpt: "Create a line segment from the current 2-dimensional sketch origin"
|
||||
excerpt: "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 'y' dimension."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Create a line segment from the current 2-dimensional sketch origin
|
||||
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 'y' dimension.
|
||||
|
||||
|
||||
along some angle (in degrees) for some length, ending at the provided value in the 'y' dimension.
|
||||
|
||||
```js
|
||||
angledLineToY(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
angledLineToY(
|
||||
data: AngledLineToData,
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -29,7 +33,7 @@ angledLineToY(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sk
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> angledLineToY({ angle = 60, to = 20 }, %)
|
||||
|> line(end = [-20, 0])
|
||||
|
File diff suppressed because one or more lines are too long
@ -11,7 +11,11 @@ The arc is constructed such that the current position of the sketch is placed al
|
||||
Unless this makes a lot of sense and feels like what you're looking for to construct your shape, you're likely looking for tangentialArc.
|
||||
|
||||
```js
|
||||
arc(data: ArcData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
arc(
|
||||
data: ArcData,
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -31,7 +35,7 @@ arc(data: ArcData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(end = [10, 0])
|
||||
|> arc({
|
||||
|
@ -1,15 +1,19 @@
|
||||
---
|
||||
title: "arcTo"
|
||||
excerpt: "Draw a 3 point arc."
|
||||
excerpt: "Draw a three point arc."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Draw a 3 point arc.
|
||||
Draw a three point arc.
|
||||
|
||||
The arc is constructed such that the start point is the current position of the sketch and two more points defined as the end and interior point. The interior point is placed between the start point and end point. The radius of the arc will be controlled by how far the interior point is placed from the start and end.
|
||||
|
||||
```js
|
||||
arcTo(data: ArcToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
arcTo(
|
||||
data: ArcToData,
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -29,7 +33,7 @@ arcTo(data: ArcToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> arcTo({ end = [10, 0], interior = [5, 5] }, %)
|
||||
|> close()
|
||||
|
@ -9,7 +9,7 @@ Compute the arcsine of a number (in radians).
|
||||
|
||||
|
||||
```js
|
||||
asin(num: number) -> number
|
||||
asin(num: number): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -1,15 +1,18 @@
|
||||
---
|
||||
title: "assert"
|
||||
excerpt: "Check a value at runtime, and raise an error if the argument provided"
|
||||
excerpt: "Check a value at runtime, and raise an error if the argument provided is false."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Check a value at runtime, and raise an error if the argument provided
|
||||
Check a value at runtime, and raise an error if the argument provided is false.
|
||||
|
||||
|
||||
is false.
|
||||
|
||||
```js
|
||||
assert(data: bool, message: string) -> ()
|
||||
assert(
|
||||
data: bool,
|
||||
message: string,
|
||||
): ()
|
||||
```
|
||||
|
||||
|
||||
|
@ -1,15 +1,20 @@
|
||||
---
|
||||
title: "assertEqual"
|
||||
excerpt: "Check that a numerical value equals another at runtime,"
|
||||
excerpt: "Check that a numerical value equals another at runtime, otherwise raise an error."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Check that a numerical value equals another at runtime,
|
||||
Check that a numerical value equals another at runtime, otherwise raise an error.
|
||||
|
||||
|
||||
otherwise raise an error.
|
||||
|
||||
```js
|
||||
assertEqual(left: number, right: number, epsilon: number, message: string) -> ()
|
||||
assertEqual(
|
||||
left: number,
|
||||
right: number,
|
||||
epsilon: number,
|
||||
message: string,
|
||||
): ()
|
||||
```
|
||||
|
||||
|
||||
|
@ -1,15 +1,19 @@
|
||||
---
|
||||
title: "assertGreaterThan"
|
||||
excerpt: "Check that a numerical value is greater than another at runtime,"
|
||||
excerpt: "Check that a numerical value is greater than another at runtime, otherwise raise an error."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Check that a numerical value is greater than another at runtime,
|
||||
Check that a numerical value is greater than another at runtime, otherwise raise an error.
|
||||
|
||||
|
||||
otherwise raise an error.
|
||||
|
||||
```js
|
||||
assertGreaterThan(left: number, right: number, message: string) -> ()
|
||||
assertGreaterThan(
|
||||
left: number,
|
||||
right: number,
|
||||
message: string,
|
||||
): ()
|
||||
```
|
||||
|
||||
|
||||
|
@ -1,15 +1,19 @@
|
||||
---
|
||||
title: "assertGreaterThanOrEq"
|
||||
excerpt: "Check that a numerical value is greater than or equal to another at runtime,"
|
||||
excerpt: "Check that a numerical value is greater than or equal to another at runtime, otherwise raise an error."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Check that a numerical value is greater than or equal to another at runtime,
|
||||
Check that a numerical value is greater than or equal to another at runtime, otherwise raise an error.
|
||||
|
||||
|
||||
otherwise raise an error.
|
||||
|
||||
```js
|
||||
assertGreaterThanOrEq(left: number, right: number, message: string) -> ()
|
||||
assertGreaterThanOrEq(
|
||||
left: number,
|
||||
right: number,
|
||||
message: string,
|
||||
): ()
|
||||
```
|
||||
|
||||
|
||||
|
@ -1,15 +1,19 @@
|
||||
---
|
||||
title: "assertLessThan"
|
||||
excerpt: "Check that a numerical value is less than to another at runtime,"
|
||||
excerpt: "Check that a numerical value is less than to another at runtime, otherwise raise an error."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Check that a numerical value is less than to another at runtime,
|
||||
Check that a numerical value is less than to another at runtime, otherwise raise an error.
|
||||
|
||||
|
||||
otherwise raise an error.
|
||||
|
||||
```js
|
||||
assertLessThan(left: number, right: number, message: string) -> ()
|
||||
assertLessThan(
|
||||
left: number,
|
||||
right: number,
|
||||
message: string,
|
||||
): ()
|
||||
```
|
||||
|
||||
|
||||
|
@ -1,15 +1,19 @@
|
||||
---
|
||||
title: "assertLessThanOrEq"
|
||||
excerpt: "Check that a numerical value is less than or equal to another at runtime,"
|
||||
excerpt: "Check that a numerical value is less than or equal to another at runtime, otherwise raise an error."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Check that a numerical value is less than or equal to another at runtime,
|
||||
Check that a numerical value is less than or equal to another at runtime, otherwise raise an error.
|
||||
|
||||
|
||||
otherwise raise an error.
|
||||
|
||||
```js
|
||||
assertLessThanOrEq(left: number, right: number, message: string) -> ()
|
||||
assertLessThanOrEq(
|
||||
left: number,
|
||||
right: number,
|
||||
message: string,
|
||||
): ()
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@ Compute the arctangent of a number (in radians).
|
||||
|
||||
|
||||
```js
|
||||
atan(num: number) -> number
|
||||
atan(num: number): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -9,7 +9,10 @@ Compute the four quadrant arctangent of Y and X (in radians).
|
||||
|
||||
|
||||
```js
|
||||
atan2(y: number, x: number) -> number
|
||||
atan2(
|
||||
y: number,
|
||||
x: number,
|
||||
): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -1,15 +1,19 @@
|
||||
---
|
||||
title: "bezierCurve"
|
||||
excerpt: "Draw a smooth, continuous, curved line segment from the current origin to"
|
||||
excerpt: "Draw a smooth, continuous, curved line segment from the current origin to the desired (x, y), using a number of control points to shape the curve's shape."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Draw a smooth, continuous, curved line segment from the current origin to
|
||||
Draw a smooth, continuous, curved line segment from the current origin to the desired (x, y), using a number of control points to shape the curve's shape.
|
||||
|
||||
|
||||
the desired (x, y), using a number of control points to shape the curve's shape.
|
||||
|
||||
```js
|
||||
bezierCurve(data: BezierData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
bezierCurve(
|
||||
data: BezierData,
|
||||
sketch: Sketch,
|
||||
tag?: TagDeclarator,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -29,7 +33,7 @@ bezierCurve(data: BezierData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(end = [0, 10])
|
||||
|> bezierCurve({
|
||||
|
@ -9,7 +9,7 @@ Compute the smallest integer greater than or equal to a number.
|
||||
|
||||
|
||||
```js
|
||||
ceil(num: number) -> number
|
||||
ceil(num: number): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -9,7 +9,12 @@ Cut a straight transitional edge along a tagged path.
|
||||
Chamfer is similar in function and use to a fillet, except a fillet will blend the transition along an edge, rather than cut a sharp, straight transitional edge.
|
||||
|
||||
```js
|
||||
chamfer(solid: Solid, length: number, tags: [EdgeReference], tag?: TagDeclarator) -> Solid
|
||||
chamfer(
|
||||
solid: Solid,
|
||||
length: number,
|
||||
tags: [EdgeReference],
|
||||
tag?: TagDeclarator,
|
||||
): Solid
|
||||
```
|
||||
|
||||
|
||||
|
@ -1,15 +1,20 @@
|
||||
---
|
||||
title: "circle"
|
||||
excerpt: "Construct a 2-dimensional circle, of the specified radius, centered at"
|
||||
excerpt: "Construct a 2-dimensional circle, of the specified radius, centered at the provided (x, y) origin point."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Construct a 2-dimensional circle, of the specified radius, centered at
|
||||
Construct a 2-dimensional circle, of the specified radius, centered at the provided (x, y) origin point.
|
||||
|
||||
|
||||
the provided (x, y) origin point.
|
||||
|
||||
```js
|
||||
circle(data: CircleData, sketchSurfaceOrGroup: SketchOrSurface, tag?: TagDeclarator) -> Sketch
|
||||
circle(
|
||||
sketchOrSurface: SketchOrSurface,
|
||||
center: [number],
|
||||
radius: number,
|
||||
tag?: TagDeclarator,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -17,9 +22,10 @@ circle(data: CircleData, sketchSurfaceOrGroup: SketchOrSurface, tag?: TagDeclara
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `data` | [`CircleData`](/docs/kcl/types/CircleData) | Data for drawing an circle | Yes |
|
||||
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||
| `sketchOrSurface` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes |
|
||||
| `center` | `[number]` | The center of the circle. | Yes |
|
||||
| `radius` | `number` | The radius of the circle. | Yes |
|
||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this circle | No |
|
||||
|
||||
### Returns
|
||||
|
||||
@ -30,7 +36,7 @@ circle(data: CircleData, sketchSurfaceOrGroup: SketchOrSurface, tag?: TagDeclara
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn("-XZ")
|
||||
|> circle({ center = [0, 0], radius = 10 }, %)
|
||||
|> circle(center = [0, 0], radius = 10)
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
```
|
||||
@ -44,7 +50,7 @@ exampleSketch = startSketchOn("XZ")
|
||||
|> line(end = [0, 30])
|
||||
|> line(end = [-30, 0])
|
||||
|> close()
|
||||
|> hole(circle({ center = [0, 15], radius = 5 }, %), %)
|
||||
|> hole(circle(center = [0, 15], radius = 5), %)
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
```
|
||||
|
@ -9,7 +9,13 @@ Construct a circle derived from 3 points.
|
||||
|
||||
|
||||
```js
|
||||
circleThreePoint(p1: [number], p2: [number], p3: [number], sketchSurfaceOrGroup: SketchOrSurface, tag?: TagDeclarator) -> Sketch
|
||||
circleThreePoint(
|
||||
p1: [number],
|
||||
p2: [number],
|
||||
p3: [number],
|
||||
sketchSurfaceOrGroup: SketchOrSurface,
|
||||
tag?: TagDeclarator,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -15,7 +15,7 @@ For example, if the current project uses inches, this function will return `0.39
|
||||
We merely provide these functions for convenience and readability, as `10 * cm()` is more readable that your intent is "I want 10 centimeters" than `10 * 10`, if the project settings are in millimeters.
|
||||
|
||||
```js
|
||||
cm() -> number
|
||||
cm(): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
File diff suppressed because one or more lines are too long
@ -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
@ -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
@ -1,15 +0,0 @@
|
||||
---
|
||||
title: "THREE_QUARTER_TURN"
|
||||
excerpt: ""
|
||||
layout: manual
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```js
|
||||
THREE_QUARTER_TURN: number(deg) = 270deg
|
||||
```
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "ZERO"
|
||||
title: "std::XY"
|
||||
excerpt: ""
|
||||
layout: manual
|
||||
---
|
||||
@ -9,7 +9,7 @@ layout: manual
|
||||
|
||||
|
||||
```js
|
||||
ZERO: number = 0
|
||||
std::XY
|
||||
```
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "ZERO"
|
||||
title: "std::XZ"
|
||||
excerpt: ""
|
||||
layout: manual
|
||||
---
|
||||
@ -9,7 +9,7 @@ layout: manual
|
||||
|
||||
|
||||
```js
|
||||
ZERO: number = 0
|
||||
std::XZ
|
||||
```
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "HALF_TURN"
|
||||
title: "std::YZ"
|
||||
excerpt: ""
|
||||
layout: manual
|
||||
---
|
||||
@ -9,7 +9,7 @@ layout: manual
|
||||
|
||||
|
||||
```js
|
||||
HALF_TURN: number(deg) = 180deg
|
||||
std::YZ
|
||||
```
|
||||
|
||||
|
@ -18,7 +18,7 @@ std::math::PI: number = 3.14159265358979323846264338327950288_
|
||||
circumference = 70
|
||||
|
||||
exampleSketch = startSketchOn("XZ")
|
||||
|> circle({ center = [0, 0], radius = circumference/ (2 * PI) }, %)
|
||||
|> circle(center = [0, 0], radius = circumference/ (2 * PI))
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
```
|
||||
|
File diff suppressed because one or more lines are too long
@ -11,7 +11,7 @@ Return the value of Euler’s number `e`.
|
||||
**DEPRECATED** use the constant E
|
||||
|
||||
```js
|
||||
e() -> number
|
||||
e(): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -1,15 +1,18 @@
|
||||
---
|
||||
title: "extrude"
|
||||
excerpt: "Extend a 2-dimensional sketch through a third dimension in order to"
|
||||
excerpt: "Extend a 2-dimensional sketch through a third dimension in order to create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Extend a 2-dimensional sketch through a third dimension in order to
|
||||
Extend a 2-dimensional sketch through a third dimension in order to create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid.
|
||||
|
||||
|
||||
create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid.
|
||||
|
||||
```js
|
||||
extrude(sketchSet: SketchSet, length: number) -> SolidSet
|
||||
extrude(
|
||||
sketchSet: SketchSet,
|
||||
length: number,
|
||||
): SolidSet
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,13 @@ Blend a transitional edge along a tagged path, smoothing the sharp edge.
|
||||
Fillet is similar in function and use to a chamfer, except a chamfer will cut a sharp transition along an edge while fillet will smoothly blend the transition.
|
||||
|
||||
```js
|
||||
fillet(solid: Solid, radius: number, tags: [EdgeReference], tolerance?: number, tag?: TagDeclarator) -> Solid
|
||||
fillet(
|
||||
solid: Solid,
|
||||
radius: number,
|
||||
tags: [EdgeReference],
|
||||
tolerance?: number,
|
||||
tag?: TagDeclarator,
|
||||
): Solid
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@ Compute the largest integer less than or equal to a number.
|
||||
|
||||
|
||||
```js
|
||||
floor(num: number) -> number
|
||||
floor(num: number): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -15,7 +15,7 @@ For example, if the current project uses inches, this function will return `12`.
|
||||
We merely provide these functions for convenience and readability, as `10 * ft()` is more readable that your intent is "I want 10 feet" than `10 * 304.8`, if the project settings are in millimeters.
|
||||
|
||||
```js
|
||||
ft() -> number
|
||||
ft(): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -9,7 +9,7 @@ Get the next adjacent edge to the edge given.
|
||||
|
||||
|
||||
```js
|
||||
getNextAdjacentEdge(tag: TagIdentifier) -> Uuid
|
||||
getNextAdjacentEdge(tag: TagIdentifier): Uuid
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@ Get the opposite edge to the edge given.
|
||||
|
||||
|
||||
```js
|
||||
getOppositeEdge(tag: TagIdentifier) -> Uuid
|
||||
getOppositeEdge(tag: TagIdentifier): Uuid
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@ Get the previous adjacent edge to the edge given.
|
||||
|
||||
|
||||
```js
|
||||
getPreviousAdjacentEdge(tag: TagIdentifier) -> Uuid
|
||||
getPreviousAdjacentEdge(tag: TagIdentifier): Uuid
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,14 @@ Create a helix.
|
||||
|
||||
|
||||
```js
|
||||
helix(revolutions: number, angleStart: number, ccw?: bool, radius: number, axis: Axis3dOrEdgeReference, length?: number) -> HelixValue
|
||||
helix(
|
||||
revolutions: number,
|
||||
angleStart: number,
|
||||
ccw?: bool,
|
||||
radius: number,
|
||||
axis: Axis3dOrEdgeReference,
|
||||
length?: number,
|
||||
): HelixValue
|
||||
```
|
||||
|
||||
|
||||
@ -44,7 +51,7 @@ helixPath = helix(
|
||||
|
||||
// Create a spring by sweeping around the helix path.
|
||||
springSketch = startSketchOn('YZ')
|
||||
|> circle({ center = [0, 0], radius = 0.5 }, %)
|
||||
|> circle(center = [0, 0], radius = 0.5)
|
||||
|> sweep(path = helixPath)
|
||||
```
|
||||
|
||||
@ -67,7 +74,7 @@ helixPath = helix(
|
||||
|
||||
// Create a spring by sweeping around the helix path.
|
||||
springSketch = startSketchOn('XY')
|
||||
|> circle({ center = [0, 0], radius = 0.5 }, %)
|
||||
|> circle(center = [0, 0], radius = 0.5)
|
||||
|> sweep(path = helixPath)
|
||||
```
|
||||
|
||||
@ -91,7 +98,7 @@ helixPath = helix(
|
||||
|
||||
// Create a spring by sweeping around the helix path.
|
||||
springSketch = startSketchOn('XY')
|
||||
|> circle({ center = [0, 0], radius = 1 }, %)
|
||||
|> circle(center = [0, 0], radius = 1)
|
||||
|> sweep(path = helixPath)
|
||||
```
|
||||
|
||||
|
@ -9,7 +9,10 @@ Create a helix on a cylinder.
|
||||
|
||||
|
||||
```js
|
||||
helixRevolutions(data: HelixRevolutionsData, solid: Solid) -> Solid
|
||||
helixRevolutions(
|
||||
data: HelixRevolutionsData,
|
||||
solid: Solid,
|
||||
): Solid
|
||||
```
|
||||
|
||||
|
||||
@ -29,7 +32,7 @@ helixRevolutions(data: HelixRevolutionsData, solid: Solid) -> Solid
|
||||
|
||||
```js
|
||||
part001 = startSketchOn('XY')
|
||||
|> circle({ center = [5, 5], radius = 10 }, %)
|
||||
|> circle(center = [5, 5], radius = 10)
|
||||
|> extrude(length = 10)
|
||||
|> helixRevolutions({
|
||||
angleStart = 0,
|
||||
|
@ -9,7 +9,10 @@ Use a 2-dimensional sketch to cut a hole in another 2-dimensional sketch.
|
||||
|
||||
|
||||
```js
|
||||
hole(holeSketch: SketchSet, sketch: Sketch) -> Sketch
|
||||
hole(
|
||||
holeSketch: SketchSet,
|
||||
sketch: Sketch,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -28,14 +31,14 @@ hole(holeSketch: SketchSet, sketch: Sketch) -> Sketch
|
||||
### Examples
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XY')
|
||||
exampleSketch = startSketchOn(XY)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(end = [0, 5])
|
||||
|> line(end = [5, 0])
|
||||
|> line(end = [0, -5])
|
||||
|> close()
|
||||
|> hole(circle({ center = [1, 1], radius = .25 }, %), %)
|
||||
|> hole(circle({ center = [1, 4], radius = .25 }, %), %)
|
||||
|> hole(circle(center = [1, 1], radius = .25), %)
|
||||
|> hole(circle(center = [1, 4], radius = .25), %)
|
||||
|
||||
example = extrude(exampleSketch, length = 1)
|
||||
```
|
||||
@ -44,7 +47,7 @@ example = extrude(exampleSketch, length = 1)
|
||||
|
||||
```js
|
||||
fn squareHoleSketch() {
|
||||
squareSketch = startSketchOn('-XZ')
|
||||
squareSketch = startSketchOn(-XZ)
|
||||
|> startProfileAt([-1, -1], %)
|
||||
|> line(end = [2, 0])
|
||||
|> line(end = [0, 2])
|
||||
@ -53,8 +56,8 @@ fn squareHoleSketch() {
|
||||
return squareSketch
|
||||
}
|
||||
|
||||
exampleSketch = startSketchOn('-XZ')
|
||||
|> circle({ center = [0, 0], radius = 3 }, %)
|
||||
exampleSketch = startSketchOn(-XZ)
|
||||
|> circle(center = [0, 0], radius = 3)
|
||||
|> hole(squareHoleSketch(), %)
|
||||
example = extrude(exampleSketch, length = 1)
|
||||
```
|
||||
|
@ -9,7 +9,10 @@ Make the inside of a 3D object hollow.
|
||||
Remove volume from a 3-dimensional shape such that a wall of the provided thickness remains around the exterior of the shape.
|
||||
|
||||
```js
|
||||
hollow(thickness: number, solid: Solid) -> Solid
|
||||
hollow(
|
||||
thickness: number,
|
||||
solid: Solid,
|
||||
): Solid
|
||||
```
|
||||
|
||||
|
||||
@ -67,17 +70,11 @@ case = startSketchOn('-XZ')
|
||||
|> extrude(length = 65)
|
||||
|
||||
thing1 = startSketchOn(case, 'end')
|
||||
|> circle({
|
||||
center = [-size / 2, -size / 2],
|
||||
radius = 25
|
||||
}, %)
|
||||
|> circle(center = [-size / 2, -size / 2], radius = 25)
|
||||
|> extrude(length = 50)
|
||||
|
||||
thing2 = startSketchOn(case, 'end')
|
||||
|> circle({
|
||||
center = [size / 2, -size / 2],
|
||||
radius = 25
|
||||
}, %)
|
||||
|> circle(center = [size / 2, -size / 2], radius = 25)
|
||||
|> extrude(length = 50)
|
||||
|
||||
hollow(0.5, case)
|
||||
|
@ -15,7 +15,10 @@ For formats lacking unit data (such as STL, OBJ, or PLY files), the default unit
|
||||
Note: The import command currently only works when using the native Modeling App.
|
||||
|
||||
```js
|
||||
import(filePath: String, options?: ImportFormat) -> ImportedGeometry
|
||||
import(
|
||||
filePath: String,
|
||||
options?: ImportFormat,
|
||||
): ImportedGeometry
|
||||
```
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ For example, if the current project uses inches, this function will return `1`.
|
||||
We merely provide these functions for convenience and readability, as `10 * inch()` is more readable that your intent is "I want 10 inches" than `10 * 25.4`, if the project settings are in millimeters.
|
||||
|
||||
```js
|
||||
inch() -> number
|
||||
inch(): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -6,13 +6,22 @@ layout: manual
|
||||
|
||||
## Table of Contents
|
||||
|
||||
* [Types](kcl/types)
|
||||
* [Modules](kcl/modules)
|
||||
* [Known Issues](kcl/KNOWN-ISSUES)
|
||||
### Language
|
||||
|
||||
* [`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)
|
||||
* [`acos`](kcl/acos)
|
||||
@ -90,7 +99,9 @@ layout: manual
|
||||
* [`reduce`](kcl/reduce)
|
||||
* [`rem`](kcl/rem)
|
||||
* [`revolve`](kcl/revolve)
|
||||
* [`rotate`](kcl/rotate)
|
||||
* [`round`](kcl/round)
|
||||
* [`scale`](kcl/scale)
|
||||
* [`segAng`](kcl/segAng)
|
||||
* [`segEnd`](kcl/segEnd)
|
||||
* [`segEndX`](kcl/segEndX)
|
||||
@ -110,6 +121,7 @@ layout: manual
|
||||
* [`tangentialArcToRelative`](kcl/tangentialArcToRelative)
|
||||
* [`toDegrees`](kcl/toDegrees)
|
||||
* [`toRadians`](kcl/toRadians)
|
||||
* [`translate`](kcl/translate)
|
||||
* [`xLine`](kcl/xLine)
|
||||
* [`xLineTo`](kcl/xLineTo)
|
||||
* [`yLine`](kcl/yLine)
|
||||
|
@ -11,7 +11,7 @@ Convert a number to an integer.
|
||||
DEPRECATED use floor(), ceil(), or round().
|
||||
|
||||
```js
|
||||
int(num: number) -> number
|
||||
int(num: number): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
@ -37,7 +37,7 @@ n = int(ceil(5 / 2))
|
||||
assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3")
|
||||
// Draw n cylinders.
|
||||
startSketchOn('XZ')
|
||||
|> circle({ center = [0, 0], radius = 2 }, %)
|
||||
|> circle(center = [0, 0], radius = 2)
|
||||
|> extrude(length = 5)
|
||||
|> patternTransform(
|
||||
instances = n,
|
||||
|
@ -1,15 +1,15 @@
|
||||
---
|
||||
title: "lastSegX"
|
||||
excerpt: "Extract the 'x' axis value of the last line segment in the provided 2-d"
|
||||
excerpt: "Extract the 'x' axis value of the last line segment in the provided 2-d sketch."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Extract the 'x' axis value of the last line segment in the provided 2-d
|
||||
Extract the 'x' axis value of the last line segment in the provided 2-d sketch.
|
||||
|
||||
|
||||
sketch.
|
||||
|
||||
```js
|
||||
lastSegX(sketch: Sketch) -> number
|
||||
lastSegX(sketch: Sketch): number
|
||||
```
|
||||
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
---
|
||||
title: "lastSegY"
|
||||
excerpt: "Extract the 'y' axis value of the last line segment in the provided 2-d"
|
||||
excerpt: "Extract the 'y' axis value of the last line segment in the provided 2-d sketch."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Extract the 'y' axis value of the last line segment in the provided 2-d
|
||||
Extract the 'y' axis value of the last line segment in the provided 2-d sketch.
|
||||
|
||||
|
||||
sketch.
|
||||
|
||||
```js
|
||||
lastSegY(sketch: Sketch) -> number
|
||||
lastSegY(sketch: Sketch): number
|
||||
```
|
||||
|
||||
|
||||
|
@ -9,7 +9,10 @@ Compute the angle of the given leg for x.
|
||||
|
||||
|
||||
```js
|
||||
legAngX(hypotenuse: number, leg: number) -> number
|
||||
legAngX(
|
||||
hypotenuse: number,
|
||||
leg: number,
|
||||
): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -9,7 +9,10 @@ Compute the angle of the given leg for y.
|
||||
|
||||
|
||||
```js
|
||||
legAngY(hypotenuse: number, leg: number) -> number
|
||||
legAngY(
|
||||
hypotenuse: number,
|
||||
leg: number,
|
||||
): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -9,7 +9,10 @@ Compute the length of the given leg.
|
||||
|
||||
|
||||
```js
|
||||
legLen(hypotenuse: number, leg: number) -> number
|
||||
legLen(
|
||||
hypotenuse: number,
|
||||
leg: number,
|
||||
): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -9,7 +9,12 @@ Extend the current sketch with a new straight line.
|
||||
|
||||
|
||||
```js
|
||||
line(sketch: Sketch, endAbsolute?: [number], end?: [number], tag?: TagDeclarator) -> Sketch
|
||||
line(
|
||||
sketch: Sketch,
|
||||
endAbsolute?: [number],
|
||||
end?: [number],
|
||||
tag?: TagDeclarator,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
@ -30,7 +35,7 @@ line(sketch: Sketch, endAbsolute?: [number], end?: [number], tag?: TagDeclarator
|
||||
### Examples
|
||||
|
||||
```js
|
||||
triangle = startSketchOn("XZ")
|
||||
triangle = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
// The 'end' argument means it ends at exactly [10, 0].
|
||||
// This is an absolute measurement, it is NOT relative to
|
||||
@ -41,7 +46,7 @@ triangle = startSketchOn("XZ")
|
||||
|> close()
|
||||
|> extrude(length = 5)
|
||||
|
||||
box = startSketchOn("XZ")
|
||||
box = startSketchOn(XZ)
|
||||
|> startProfileAt([10, 10], %)
|
||||
// The 'to' argument means move the pen this much.
|
||||
// So, [10, 0] is a relative distance away from the current point.
|
||||
|
@ -9,7 +9,7 @@ Compute the natural logarithm of the number.
|
||||
|
||||
|
||||
```js
|
||||
ln(num: number) -> number
|
||||
ln(num: number): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -9,7 +9,13 @@ Create a 3D surface or solid by interpolating between two or more sketches.
|
||||
The sketches need to closed and on the same plane.
|
||||
|
||||
```js
|
||||
loft(sketches: [Sketch], vDegree: NonZeroU32, bezApproximateRational: bool, baseCurveIndex?: integer, tolerance?: number) -> Solid
|
||||
loft(
|
||||
sketches: [Sketch],
|
||||
vDegree: NonZeroU32,
|
||||
bezApproximateRational: bool,
|
||||
baseCurveIndex?: integer,
|
||||
tolerance?: number,
|
||||
): Solid
|
||||
```
|
||||
|
||||
|
||||
@ -63,10 +69,10 @@ squareSketch = startSketchOn('XY')
|
||||
|> close()
|
||||
|
||||
circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))
|
||||
|> circle({ center = [0, 100], radius = 50 }, %)
|
||||
|> circle(center = [0, 100], radius = 50)
|
||||
|
||||
circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))
|
||||
|> circle({ center = [0, 100], radius = 20 }, %)
|
||||
|> circle(center = [0, 100], radius = 20)
|
||||
|
||||
loft([
|
||||
squareSketch,
|
||||
@ -88,10 +94,10 @@ squareSketch = startSketchOn('XY')
|
||||
|> close()
|
||||
|
||||
circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))
|
||||
|> circle({ center = [0, 100], radius = 50 }, %)
|
||||
|> circle(center = [0, 100], radius = 50)
|
||||
|
||||
circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))
|
||||
|> circle({ center = [0, 100], radius = 20 }, %)
|
||||
|> circle(center = [0, 100], radius = 20)
|
||||
|
||||
loft(
|
||||
[
|
||||
|
@ -9,7 +9,10 @@ Compute the logarithm of the number with respect to an arbitrary base.
|
||||
The result might not be correctly rounded owing to implementation details; `log2()` can produce more accurate results for base 2, and `log10()` can produce more accurate results for base 10.
|
||||
|
||||
```js
|
||||
log(num: number, base: number) -> number
|
||||
log(
|
||||
num: number,
|
||||
base: number,
|
||||
): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -9,7 +9,7 @@ Compute the base 10 logarithm of the number.
|
||||
|
||||
|
||||
```js
|
||||
log10(num: number) -> number
|
||||
log10(num: number): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -9,7 +9,7 @@ Compute the base 2 logarithm of the number.
|
||||
|
||||
|
||||
```js
|
||||
log2(num: number) -> number
|
||||
log2(num: number): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -15,7 +15,7 @@ For example, if the current project uses inches, this function will return `39.3
|
||||
We merely provide these functions for convenience and readability, as `10 * m()` is more readable that your intent is "I want 10 meters" than `10 * 1000`, if the project settings are in millimeters.
|
||||
|
||||
```js
|
||||
m() -> number
|
||||
m(): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -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)]`
|
||||
|
||||
```js
|
||||
map(array: [KclValue], mapFn: FunctionSource) -> [KclValue]
|
||||
map(
|
||||
array: [KclValue],
|
||||
mapFn: FunctionSource,
|
||||
): [KclValue]
|
||||
```
|
||||
|
||||
|
||||
@ -31,7 +34,7 @@ map(array: [KclValue], mapFn: FunctionSource) -> [KclValue]
|
||||
r = 10 // radius
|
||||
fn drawCircle(id) {
|
||||
return startSketchOn("XY")
|
||||
|> circle({ center = [id * 2 * r, 0], radius = r }, %)
|
||||
|> circle(center = [id * 2 * r, 0], radius = r)
|
||||
}
|
||||
|
||||
// Call `drawCircle`, passing in each element of the array.
|
||||
@ -47,7 +50,7 @@ r = 10 // radius
|
||||
// Call `map`, using an anonymous function instead of a named one.
|
||||
circles = map([1..3], fn(id) {
|
||||
return startSketchOn("XY")
|
||||
|> circle({ center = [id * 2 * r, 0], radius = r }, %)
|
||||
|> circle(center = [id * 2 * r, 0], radius = r)
|
||||
})
|
||||
```
|
||||
|
||||
|
@ -9,7 +9,7 @@ Compute the maximum of the given arguments.
|
||||
|
||||
|
||||
```js
|
||||
max(args: [number]) -> number
|
||||
max(args: [number]): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -9,7 +9,7 @@ Compute the minimum of the given arguments.
|
||||
|
||||
|
||||
```js
|
||||
min(args: [number]) -> number
|
||||
min(args: [number]): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -11,7 +11,10 @@ Only works on unclosed sketches for now.
|
||||
Mirror occurs around a local sketch axis rather than a global axis.
|
||||
|
||||
```js
|
||||
mirror2d(data: Mirror2dData, sketchSet: SketchSet) -> [Sketch]
|
||||
mirror2d(
|
||||
data: Mirror2dData,
|
||||
sketchSet: SketchSet,
|
||||
): [Sketch]
|
||||
```
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ For example, if the current project uses inches, this function will return `(1/2
|
||||
We merely provide these functions for convenience and readability, as `10 * mm()` is more readable that your intent is "I want 10 millimeters" than `10 * (1/25.4)`, if the project settings are in inches.
|
||||
|
||||
```js
|
||||
mm() -> number
|
||||
mm(): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
@ -20,7 +20,7 @@ export fn increment(x) {
|
||||
Other files in the project can now import functions that have been exported.
|
||||
This makes them available to use in another file.
|
||||
|
||||
```
|
||||
```norun
|
||||
// main.kcl
|
||||
import increment from "util.kcl"
|
||||
|
||||
@ -48,13 +48,13 @@ export fn decrement(x) {
|
||||
|
||||
When importing, you can import multiple functions at once.
|
||||
|
||||
```
|
||||
```norun
|
||||
import increment, decrement from "util.kcl"
|
||||
```
|
||||
|
||||
Imported symbols can be renamed for convenience or to avoid name collisions.
|
||||
|
||||
```
|
||||
```norun
|
||||
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
|
||||
same as for KCL files. You can only import the whole file, not items from it. E.g.,
|
||||
|
||||
```
|
||||
```norun
|
||||
import "tests/inputs/cube.obj"
|
||||
|
||||
// Use `cube` just like a KCL object.
|
||||
```
|
||||
|
||||
```
|
||||
```norun
|
||||
import "tests/inputs/cube-2.sldprt" as cube
|
||||
|
||||
// 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
|
||||
extension), e.g.,
|
||||
|
||||
```
|
||||
```norun
|
||||
@(format = obj)
|
||||
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
|
||||
by using an attirbute. Likewise, you can also specify a coordinate system. E.g.,
|
||||
|
||||
```
|
||||
```norun
|
||||
@(unitLength = ft, coords = opengl)
|
||||
import "tests/inputs/cube.obj"
|
||||
```
|
||||
|
@ -9,7 +9,10 @@ Offset a plane by a distance along its normal.
|
||||
For example, if you offset the 'XZ' plane by 10, the new plane will be parallel to the 'XZ' plane and 10 units away from it.
|
||||
|
||||
```js
|
||||
offsetPlane(plane: PlaneData, offset: number) -> Plane
|
||||
offsetPlane(
|
||||
plane: PlaneData,
|
||||
offset: number,
|
||||
): Plane
|
||||
```
|
||||
|
||||
|
||||
@ -38,7 +41,7 @@ squareSketch = startSketchOn('XY')
|
||||
|> close()
|
||||
|
||||
circleSketch = startSketchOn(offsetPlane('XY', offset = 150))
|
||||
|> circle({ center = [0, 100], radius = 50 }, %)
|
||||
|> circle(center = [0, 100], radius = 50)
|
||||
|
||||
loft([squareSketch, circleSketch])
|
||||
```
|
||||
@ -56,7 +59,7 @@ squareSketch = startSketchOn('XZ')
|
||||
|> close()
|
||||
|
||||
circleSketch = startSketchOn(offsetPlane('XZ', offset = 150))
|
||||
|> circle({ center = [0, 100], radius = 50 }, %)
|
||||
|> circle(center = [0, 100], radius = 50)
|
||||
|
||||
loft([squareSketch, circleSketch])
|
||||
```
|
||||
@ -74,7 +77,7 @@ squareSketch = startSketchOn('YZ')
|
||||
|> close()
|
||||
|
||||
circleSketch = startSketchOn(offsetPlane('YZ', offset = 150))
|
||||
|> circle({ center = [0, 100], radius = 50 }, %)
|
||||
|> circle(center = [0, 100], radius = 50)
|
||||
|
||||
loft([squareSketch, circleSketch])
|
||||
```
|
||||
@ -92,7 +95,7 @@ squareSketch = startSketchOn('-XZ')
|
||||
|> close()
|
||||
|
||||
circleSketch = startSketchOn(offsetPlane('-XZ', offset = -150))
|
||||
|> circle({ center = [0, 100], radius = 50 }, %)
|
||||
|> circle(center = [0, 100], radius = 50)
|
||||
|
||||
loft([squareSketch, circleSketch])
|
||||
```
|
||||
@ -103,7 +106,7 @@ loft([squareSketch, circleSketch])
|
||||
// A circle on the XY plane
|
||||
startSketchOn("XY")
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> circle({ radius = 10, center = [0, 0] }, %)
|
||||
|> circle(radius = 10, center = [0, 0])
|
||||
|
||||
// Triangle on the plane 4 units above
|
||||
startSketchOn(offsetPlane("XY", offset = 4))
|
||||
|
@ -1,15 +1,22 @@
|
||||
---
|
||||
title: "patternCircular2d"
|
||||
excerpt: "Repeat a 2-dimensional sketch some number of times along a partial or"
|
||||
excerpt: "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."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Repeat a 2-dimensional sketch some number of times along a partial or
|
||||
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
|
||||
patternCircular2d(sketchSet: SketchSet, instances: integer, center: [number], arcDegrees: number, rotateDuplicates: bool, useOriginal?: bool) -> [Sketch]
|
||||
patternCircular2d(
|
||||
sketchSet: SketchSet,
|
||||
instances: integer,
|
||||
center: [number],
|
||||
arcDegrees: number,
|
||||
rotateDuplicates: bool,
|
||||
useOriginal?: bool,
|
||||
): [Sketch]
|
||||
```
|
||||
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,15 +1,21 @@
|
||||
---
|
||||
title: "patternLinear2d"
|
||||
excerpt: "Repeat a 2-dimensional sketch along some dimension, with a dynamic amount"
|
||||
excerpt: "Repeat a 2-dimensional sketch along some dimension, with a dynamic amount of distance between each repetition, some specified number of times."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Repeat a 2-dimensional sketch along some dimension, with a dynamic amount
|
||||
Repeat a 2-dimensional sketch along some dimension, 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
|
||||
patternLinear2d(sketchSet: SketchSet, instances: integer, distance: number, axis: [number], useOriginal?: bool) -> [Sketch]
|
||||
patternLinear2d(
|
||||
sketchSet: SketchSet,
|
||||
instances: integer,
|
||||
distance: number,
|
||||
axis: [number],
|
||||
useOriginal?: bool,
|
||||
): [Sketch]
|
||||
```
|
||||
|
||||
|
||||
@ -32,7 +38,7 @@ patternLinear2d(sketchSet: SketchSet, instances: integer, distance: number, axis
|
||||
|
||||
```js
|
||||
exampleSketch = startSketchOn('XZ')
|
||||
|> circle({ center = [0, 0], radius = 1 }, %)
|
||||
|> circle(center = [0, 0], radius = 1)
|
||||
|> patternLinear2d(axis = [1, 0], instances = 7, distance = 4)
|
||||
|
||||
example = extrude(exampleSketch, length = 1)
|
||||
|
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