Compare commits
106 Commits
david/fix-
...
achalmers/
Author | SHA1 | Date | |
---|---|---|---|
1a912f58a6 | |||
320740cfb7 | |||
f1fdf48834 | |||
bae875382c | |||
14ce66bcc1 | |||
644c561815 | |||
5f31f3a6b3 | |||
a0afe9dd0e | |||
9c29756a38 | |||
bf63b21d74 | |||
0ea0d1703e | |||
29b8a442c2 | |||
844f229b5a | |||
fa51b4bbbc | |||
1fa6e1eccc | |||
44b810ee0a | |||
a9998be176 | |||
5e200aebcc | |||
e0cd3efc64 | |||
77e3efde9a | |||
a173a82d59 | |||
4d2bc18c2f | |||
aca5fdb521 | |||
8867258e47 | |||
f6cb725268 | |||
1bd570ceb9 | |||
1c87298b44 | |||
3a23ec1bee | |||
d96a4d3337 | |||
94452cce88 | |||
2e754f2a11 | |||
719136937e | |||
e207552255 | |||
1835e49191 | |||
145c28bbd5 | |||
a58a3361b6 | |||
efba773635 | |||
4439229ad2 | |||
0dcb8baf64 | |||
921adcb3eb | |||
24465cf463 | |||
d0b0365f75 | |||
0f88598dc0 | |||
d7e80b3cc7 | |||
25bb95a66e | |||
6e115c19d5 | |||
5a18f551aa | |||
0426967bf7 | |||
9d893d8f0b | |||
8de648f0db | |||
50f8131d83 | |||
5a4f8bd522 | |||
f8e53d941d | |||
717a2039cb | |||
6e7c44fca7 | |||
ffbe20b586 | |||
9547e95e9d | |||
a1f31f4348 | |||
604e244395 | |||
fe22a67cf6 | |||
885d2afaa3 | |||
be4a32a59e | |||
c501d3bfbf | |||
0ef1483e11 | |||
bbaaf86e4d | |||
6a0e10f8ab | |||
5c0ca52291 | |||
bff13f6bfe | |||
6001b71f06 | |||
bd1e68a4c8 | |||
8589f8fc5f | |||
6641e1178b | |||
6e0f1e71b2 | |||
0e945b6457 | |||
19155a9132 | |||
305d613d40 | |||
95f2caacab | |||
8f61ee1d2f | |||
b02dbd4fe6 | |||
668f6671a9 | |||
f6387eb7e9 | |||
83a87b046f | |||
20c2ce3bac | |||
2956f9ed55 | |||
510d74f2c7 | |||
457ab28f74 | |||
1502f923ee | |||
f03a684eec | |||
45e17c50e7 | |||
6bf74379a7 | |||
01c6fd53fa | |||
f8306c0275 | |||
900ef9e18d | |||
a46186573c | |||
90f6c1bb04 | |||
41d946b339 | |||
b7385d5f25 | |||
3d22f6cd66 | |||
9730e3f5b3 | |||
29d6b22d63 | |||
f99e44e371 | |||
8be36d3d16 | |||
bc1742af48 | |||
e4080cc184 | |||
18de6ccb59 | |||
f00ea4cf5e |
@ -19,6 +19,11 @@
|
|||||||
"plugin:jsx-a11y/recommended",
|
"plugin:jsx-a11y/recommended",
|
||||||
"plugin:react-hooks/recommended"
|
"plugin:react-hooks/recommended"
|
||||||
],
|
],
|
||||||
|
"settings": {
|
||||||
|
"react": {
|
||||||
|
"version": "detect"
|
||||||
|
}
|
||||||
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-array-constructor": "off", // This is wrong; use the @typescript-eslint one instead.
|
"no-array-constructor": "off", // This is wrong; use the @typescript-eslint one instead.
|
||||||
"@typescript-eslint/no-array-constructor": "error",
|
"@typescript-eslint/no-array-constructor": "error",
|
||||||
@ -61,6 +66,7 @@
|
|||||||
"jsx-a11y/click-events-have-key-events": "off",
|
"jsx-a11y/click-events-have-key-events": "off",
|
||||||
"jsx-a11y/no-autofocus": "off",
|
"jsx-a11y/no-autofocus": "off",
|
||||||
"jsx-a11y/no-noninteractive-element-interactions": "off",
|
"jsx-a11y/no-noninteractive-element-interactions": "off",
|
||||||
|
"react/no-unknown-property": "error",
|
||||||
"no-restricted-globals": [
|
"no-restricted-globals": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
11
.github/ci-cd-scripts/playwright-electron.sh
vendored
11
.github/ci-cd-scripts/playwright-electron.sh
vendored
@ -26,8 +26,8 @@ max_retries=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_retries ]]; do
|
while [[ $retry -le $max_retries ]]; do
|
||||||
if [[ -f "test-results/.last-run.json" ]]; then
|
if [[ -f "test-results/.last-run.json" ]]; then
|
||||||
failed_tests=$(jq '.failedTests | length' test-results/.last-run.json)
|
status=$(jq -r '.status' test-results/.last-run.json)
|
||||||
if [[ $failed_tests -gt 0 ]]; then
|
if [[ "$status" == "failed" ]]; then
|
||||||
echo "retried=true" >>$GITHUB_OUTPUT
|
echo "retried=true" >>$GITHUB_OUTPUT
|
||||||
echo "run playwright with last failed tests and retry $retry"
|
echo "run playwright with last failed tests and retry $retry"
|
||||||
if [[ "$3" == *ubuntu* ]]; then
|
if [[ "$3" == *ubuntu* ]]; then
|
||||||
@ -56,10 +56,11 @@ done
|
|||||||
echo "retried=false" >>$GITHUB_OUTPUT
|
echo "retried=false" >>$GITHUB_OUTPUT
|
||||||
|
|
||||||
if [[ -f "test-results/.last-run.json" ]]; then
|
if [[ -f "test-results/.last-run.json" ]]; then
|
||||||
failed_tests=$(jq '.failedTests | length' test-results/.last-run.json)
|
status=$(jq -r '.status' test-results/.last-run.json)
|
||||||
if [[ $failed_tests -gt 0 ]]; then
|
if [[ "$status" == "failed" ]]; then
|
||||||
# If it still fails after 3 retries, then fail the job
|
# If it still fails after retries, then fail the job
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
6
.github/workflows/cargo-bench.yml
vendored
6
.github/workflows/cargo-bench.yml
vendored
@ -26,12 +26,8 @@ name: cargo bench
|
|||||||
jobs:
|
jobs:
|
||||||
cargo-bench:
|
cargo-bench:
|
||||||
name: cargo bench
|
name: cargo bench
|
||||||
runs-on:
|
runs-on: ubuntu-latest
|
||||||
- runs-on=${{ github.run_id }}
|
|
||||||
- runner=32cpu-linux-x64
|
|
||||||
- extras=s3-cache
|
|
||||||
steps:
|
steps:
|
||||||
- uses: runs-on/action@v1
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Use correct Rust toolchain
|
- name: Use correct Rust toolchain
|
||||||
shell: bash
|
shell: bash
|
||||||
|
86
.github/workflows/cargo-test.yml
vendored
86
.github/workflows/cargo-test.yml
vendored
@ -13,10 +13,14 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
name: cargo test
|
name: cargo test
|
||||||
jobs:
|
jobs:
|
||||||
cargotest:
|
build-test-artifacts:
|
||||||
name: cargo test
|
name: Build test artifacts
|
||||||
runs-on: ubuntu-latest-8-cores
|
runs-on:
|
||||||
|
- runs-on=${{ github.run_id }}
|
||||||
|
- runner=8cpu-linux-x64
|
||||||
|
- extras=s3-cache
|
||||||
steps:
|
steps:
|
||||||
|
- uses: runs-on/action@v1
|
||||||
- uses: actions/create-github-app-token@v1
|
- uses: actions/create-github-app-token@v1
|
||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
@ -39,7 +43,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_ACTIONS_AXIOM_TOKEN: ${{ secrets.GH_ACTIONS_AXIOM_TOKEN }}
|
GH_ACTIONS_AXIOM_TOKEN: ${{ secrets.GH_ACTIONS_AXIOM_TOKEN }}
|
||||||
OS_NAME: ${{ env.OS_NAME }}
|
OS_NAME: ${{ env.OS_NAME }}
|
||||||
- uses: taiki-e/install-action@cargo-llvm-cov
|
|
||||||
- uses: taiki-e/install-action@nextest
|
- uses: taiki-e/install-action@nextest
|
||||||
- name: Install just
|
- name: Install just
|
||||||
uses: taiki-e/install-action@just
|
uses: taiki-e/install-action@just
|
||||||
@ -81,11 +84,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
cd rust
|
cd rust
|
||||||
cargo nextest run --workspace --retries=2 --no-fail-fast --profile ci simulation_tests::kcl_samples 2>&1 | tee /tmp/github-actions.log
|
cargo nextest run --workspace --features artifact-graph --retries=2 --no-fail-fast --profile ci simulation_tests::kcl_samples 2>&1 | tee /tmp/github-actions.log
|
||||||
env:
|
env:
|
||||||
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
|
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
|
||||||
RUST_BACKTRACE: full
|
RUST_BACKTRACE: full
|
||||||
RUST_MIN_STACK: 10485760000
|
|
||||||
- name: Commit differences
|
- name: Commit differences
|
||||||
if: steps.path-changes.outputs.outside-kcl-samples == 'false' && steps.cargo-test-kcl-samples.outcome == 'failure'
|
if: steps.path-changes.outputs.outside-kcl-samples == 'false' && steps.cargo-test-kcl-samples.outcome == 'failure'
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -118,23 +120,67 @@ jobs:
|
|||||||
# Configure nextest when it's run by insta (via just).
|
# Configure nextest when it's run by insta (via just).
|
||||||
NEXTEST_PROFILE: ci
|
NEXTEST_PROFILE: ci
|
||||||
RUST_BACKTRACE: full
|
RUST_BACKTRACE: full
|
||||||
RUST_MIN_STACK: 10485760000
|
- name: Build and archive tests
|
||||||
- name: cargo test
|
run: |
|
||||||
if: steps.path-changes.outputs.outside-kcl-samples == 'true'
|
cd rust
|
||||||
|
cargo nextest archive --workspace --features artifact-graph --archive-file nextest-archive.tar.zst
|
||||||
|
- name: Upload archive to workflow
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: nextest-archive
|
||||||
|
path: rust/nextest-archive.tar.zst
|
||||||
|
|
||||||
|
run-test-artifacts:
|
||||||
|
name: cargo test (shard ${{ matrix.partitionIndex}})
|
||||||
|
runs-on:
|
||||||
|
- runs-on=${{ github.run_id }}
|
||||||
|
- runner=32cpu-linux-x64
|
||||||
|
- extras=s3-cache
|
||||||
|
needs: build-test-artifacts
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
partitionIndex: [1, 2, 3, 4, 5, 6]
|
||||||
|
partitionTotal: [6]
|
||||||
|
steps:
|
||||||
|
- uses: runs-on/action@v1
|
||||||
|
- 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 }}
|
||||||
|
- name: Use correct Rust toolchain
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
|
||||||
|
- name: Install rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
cache: false # Configured below.
|
||||||
|
- name: Start Vector
|
||||||
|
run: .github/ci-cd-scripts/start-vector-ubuntu.sh
|
||||||
|
env:
|
||||||
|
GH_ACTIONS_AXIOM_TOKEN: ${{ secrets.GH_ACTIONS_AXIOM_TOKEN }}
|
||||||
|
OS_NAME: ${{ env.OS_NAME }}
|
||||||
|
- uses: taiki-e/install-action@nextest
|
||||||
|
- name: Download archive
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: nextest-archive
|
||||||
|
- name: Run tests
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |-
|
run: |-
|
||||||
|
cp nextest-archive.tar.zst rust/nextest-archive.tar.zst
|
||||||
|
ls -lah
|
||||||
cd rust
|
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
|
cargo nextest run\
|
||||||
|
--retries=2 --no-fail-fast -P ci --archive-file nextest-archive.tar.zst \
|
||||||
|
--partition count:${{ matrix.partitionIndex}}/${{ matrix.partitionTotal }} \
|
||||||
|
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
|
|
||||||
- name: Upload to codecov.io
|
|
||||||
if: steps.path-changes.outputs.outside-kcl-samples == 'true'
|
|
||||||
uses: codecov/codecov-action@v5
|
|
||||||
with:
|
|
||||||
token: ${{secrets.CODECOV_TOKEN}}
|
|
||||||
fail_ci_if_error: true
|
|
||||||
flags: rust
|
|
||||||
verbose: true
|
|
||||||
files: lcov.info
|
|
||||||
|
|
||||||
|
52
.github/workflows/e2e-tests.yml
vendored
52
.github/workflows/e2e-tests.yml
vendored
@ -3,7 +3,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- all-e2e # this bypasses `fixme()` using `orRunWhenFullSuiteEnabled()`
|
|
||||||
pull_request:
|
pull_request:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: 0 * * * * # hourly
|
- cron: 0 * * * * # hourly
|
||||||
@ -225,7 +224,7 @@ jobs:
|
|||||||
uses: nick-fields/retry@v3.0.2
|
uses: nick-fields/retry@v3.0.2
|
||||||
with:
|
with:
|
||||||
shell: bash
|
shell: bash
|
||||||
command: npm run test:snapshots || true
|
command: npm run test:snapshots
|
||||||
timeout_minutes: 5
|
timeout_minutes: 5
|
||||||
max_attempts: 5
|
max_attempts: 5
|
||||||
env:
|
env:
|
||||||
@ -278,29 +277,42 @@ jobs:
|
|||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
env:
|
env:
|
||||||
OS_NAME: ${{ contains(matrix.os, 'ubuntu') && 'ubuntu' || (contains(matrix.os, 'windows') && 'windows' || 'macos') }}
|
OS_NAME: ${{ contains(matrix.os, 'ubuntu') && 'ubuntu' || (contains(matrix.os, 'windows') && 'windows' || 'macos') }}
|
||||||
name: playwright:electron:${{ contains(matrix.os, 'ubuntu') && 'ubuntu' || (contains(matrix.os, 'windows') && 'windows' || 'macos') }}:${{ matrix.shardIndex }}:${{ matrix.shardTotal }}
|
name: playwright:electron:${{ contains(matrix.os, 'ubuntu') && 'ubuntu' || (contains(matrix.os, 'windows') && 'windows' || 'macos') }} (shard ${{ matrix.shardIndex }})
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
# TODO: enable namespace-profile-windows-latest once available
|
# TODO: enable namespace-profile-windows-latest once available
|
||||||
os:
|
include:
|
||||||
- "runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64"
|
- os: "runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64"
|
||||||
# TODO: renable this when macoOS runner seem more stable
|
shardIndex: 1
|
||||||
# - namespace-profile-macos-6-cores
|
shardTotal: 8
|
||||||
- windows-latest-8-cores
|
- os: "runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64"
|
||||||
shardIndex: [1, 2, 3, 4]
|
shardIndex: 2
|
||||||
shardTotal: [4]
|
shardTotal: 8
|
||||||
# Disable macos and windows tests on hourly e2e tests since we only care
|
- os: "runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64"
|
||||||
# about server side changes.
|
shardIndex: 3
|
||||||
# Technique from https://github.com/joaomcteixeira/python-project-skeleton/pull/31/files
|
shardTotal: 8
|
||||||
isScheduled:
|
- os: "runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64"
|
||||||
- ${{ github.event_name == 'schedule' }}
|
shardIndex: 4
|
||||||
exclude:
|
shardTotal: 8
|
||||||
- os: namespace-profile-macos-6-cores
|
- os: "runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64"
|
||||||
isScheduled: true
|
shardIndex: 5
|
||||||
|
shardTotal: 8
|
||||||
|
- os: "runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64"
|
||||||
|
shardIndex: 6
|
||||||
|
shardTotal: 8
|
||||||
|
- os: "runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64"
|
||||||
|
shardIndex: 7
|
||||||
|
shardTotal: 8
|
||||||
|
- os: "runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64"
|
||||||
|
shardIndex: 8
|
||||||
|
shardTotal: 8
|
||||||
|
- os: namespace-profile-macos-8-cores
|
||||||
|
shardIndex: 1
|
||||||
|
shardTotal: 1
|
||||||
- os: windows-latest-8-cores
|
- os: windows-latest-8-cores
|
||||||
isScheduled: true
|
shardIndex: 1
|
||||||
# TODO: add ref here for main and latest release tag
|
shardTotal: 1
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
45
.github/workflows/update-e2e-branch.yml
vendored
45
.github/workflows/update-e2e-branch.yml
vendored
@ -1,45 +0,0 @@
|
|||||||
name: update-e2e-branch
|
|
||||||
|
|
||||||
# This is used to sync the `all-e2e` branch with the `main` branch for the
|
|
||||||
# logic in the test utility `orRunWhenFullSuiteEnabled()` that allows all e2e
|
|
||||||
# tests to run on a particular branch to analyze failures metrics in Axiom.
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 * * * *' # runs every hour
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
update-branch:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
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 }}
|
|
||||||
|
|
||||||
- name: Sync with main
|
|
||||||
run: |
|
|
||||||
# Create the branch
|
|
||||||
git checkout all-e2e || git checkout -b all-e2e
|
|
||||||
|
|
||||||
# Reset to main
|
|
||||||
git fetch origin
|
|
||||||
git reset --hard origin/main
|
|
||||||
|
|
||||||
# Get a new SHA to prevent overwriting the commit status on main
|
|
||||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
||||||
git config --local user.name "github-actions[bot]"
|
|
||||||
git commit --allow-empty --message="[all-e2e] $(git log --max-count=1 --pretty=%B)"
|
|
||||||
|
|
||||||
# Overwrite the branch
|
|
||||||
git remote set-url origin https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ github.repository }}.git
|
|
||||||
git push --force origin all-e2e
|
|
1
.husky/pre-commit
Executable file
1
.husky/pre-commit
Executable file
@ -0,0 +1 @@
|
|||||||
|
npm run fmt
|
@ -1,4 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
. "$(dirname -- "$0")/_/husky.sh"
|
|
||||||
|
|
||||||
npm run fmt-check
|
|
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
@ -44,7 +44,7 @@ angledLine(
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> yLine(endAbsolute = 15)
|
|> yLine(endAbsolute = 15)
|
||||||
|> angledLine(angle = 30, length = 15)
|
|> angledLine(angle = 30, length = 15)
|
||||||
|> line(end = [8, -10])
|
|> line(end = [8, -10])
|
||||||
|
@ -38,7 +38,7 @@ angledLineThatIntersects(
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(endAbsolute = [5, 10])
|
|> line(endAbsolute = [5, 10])
|
||||||
|> line(endAbsolute = [-10, 10], tag = $lineToIntersect)
|
|> line(endAbsolute = [-10, 10], tag = $lineToIntersect)
|
||||||
|> line(endAbsolute = [0, 20])
|
|> line(endAbsolute = [0, 20])
|
||||||
|
File diff suppressed because one or more lines are too long
@ -44,7 +44,7 @@ arc(
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [10, 0])
|
|> line(end = [10, 0])
|
||||||
|> arc(angleStart = 0, angleEnd = 280, radius = 16)
|
|> arc(angleStart = 0, angleEnd = 280, radius = 16)
|
||||||
|> close()
|
|> close()
|
||||||
@ -55,7 +55,7 @@ example = extrude(exampleSketch, length = 10)
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> arc(endAbsolute = [10, 0], interiorAbsolute = [5, 5])
|
|> arc(endAbsolute = [10, 0], interiorAbsolute = [5, 5])
|
||||||
|> close()
|
|> close()
|
||||||
example = extrude(exampleSketch, length = 10)
|
example = extrude(exampleSketch, length = 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
File diff suppressed because one or more lines are too long
40
docs/kcl/assertIs.md
Normal file
40
docs/kcl/assertIs.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
@ -38,7 +38,7 @@ bezierCurve(
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [0, 10])
|
|> line(end = [0, 10])
|
||||||
|> bezierCurve(control1 = [5, 0], control2 = [5, 10], end = [10, 10])
|
|> bezierCurve(control1 = [5, 0], control2 = [5, 10], end = [10, 10])
|
||||||
|> line(endAbsolute = [10, 0])
|
|> line(endAbsolute = [10, 0])
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
258
docs/kcl/clone.md
Normal file
258
docs/kcl/clone.md
Normal file
File diff suppressed because one or more lines are too long
@ -32,7 +32,7 @@ close(
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
startSketchOn(XZ)
|
startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [10, 10])
|
|> line(end = [10, 10])
|
||||||
|> line(end = [10, 0])
|
|> line(end = [10, 0])
|
||||||
|> close()
|
|> close()
|
||||||
@ -43,7 +43,7 @@ startSketchOn(XZ)
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(-XZ)
|
exampleSketch = startSketchOn(-XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [10, 0])
|
|> line(end = [10, 0])
|
||||||
|> line(end = [0, 10])
|
|> line(end = [0, 10])
|
||||||
|> close()
|
|> close()
|
||||||
|
@ -16,7 +16,7 @@ std::math::E: number = 2.71828182845904523536028747135266250_
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> angledLine(
|
|> angledLine(
|
||||||
angle = 30,
|
angle = 30,
|
||||||
length = 2 * E ^ 2,
|
length = 2 * E ^ 2,
|
||||||
|
@ -9,7 +9,7 @@ The value of `pi`, Archimedes’ constant (π).
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
std::math::PI: number = 3.14159265358979323846264338327950288_
|
std::math::PI: number(_?) = 3.14159265358979323846264338327950288_?
|
||||||
```
|
```
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
@ -18,7 +18,7 @@ std::math::PI: number = 3.14159265358979323846264338327950288_
|
|||||||
circumference = 70
|
circumference = 70
|
||||||
|
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> circle(center = [0, 0], radius = circumference / (2 * PI))
|
|> circle(center = [0, 0], radius = (circumference / (2 * PI)): number(mm))
|
||||||
|
|
||||||
example = extrude(exampleSketch, length = 5)
|
example = extrude(exampleSketch, length = 5)
|
||||||
```
|
```
|
||||||
|
@ -16,7 +16,7 @@ std::math::TAU: number = 6.28318530717958647692528676655900577_
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> angledLine(
|
|> angledLine(
|
||||||
angle = 50,
|
angle = 50,
|
||||||
length = 10 * TAU,
|
length = 10 * TAU,
|
||||||
|
@ -29,7 +29,7 @@ e(): number
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> angledLine(angle = 30, length = 2 * e() ^ 2)
|
|> angledLine(angle = 30, length = 2 * e() ^ 2)
|
||||||
|> yLine(endAbsolute = 0)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
@ -40,7 +40,7 @@ extrude(
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
example = startSketchOn(XZ)
|
example = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [10, 0])
|
|> line(end = [10, 0])
|
||||||
|> arc(angleStart = 120, angleEnd = 0, radius = 5)
|
|> arc(angleStart = 120, angleEnd = 0, radius = 5)
|
||||||
|> line(end = [5, 0])
|
|> line(end = [5, 0])
|
||||||
@ -55,7 +55,7 @@ example = startSketchOn(XZ)
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([-10, 0], %)
|
|> startProfile(at = [-10, 0])
|
||||||
|> arc(angleStart = 120, angleEnd = -60, radius = 5)
|
|> arc(angleStart = 120, angleEnd = -60, radius = 5)
|
||||||
|> line(end = [10, 0])
|
|> line(end = [10, 0])
|
||||||
|> line(end = [5, 0])
|
|> line(end = [5, 0])
|
||||||
@ -71,7 +71,7 @@ example = extrude(exampleSketch, length = 10)
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([-10, 0], %)
|
|> startProfile(at = [-10, 0])
|
||||||
|> arc(angleStart = 120, angleEnd = -60, radius = 5)
|
|> arc(angleStart = 120, angleEnd = -60, radius = 5)
|
||||||
|> line(end = [10, 0])
|
|> line(end = [10, 0])
|
||||||
|> line(end = [5, 0])
|
|> line(end = [5, 0])
|
||||||
@ -87,7 +87,7 @@ example = extrude(exampleSketch, length = 20, symmetric = true)
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([-10, 0], %)
|
|> startProfile(at = [-10, 0])
|
||||||
|> arc(angleStart = 120, angleEnd = -60, radius = 5)
|
|> arc(angleStart = 120, angleEnd = -60, radius = 5)
|
||||||
|> line(end = [10, 0])
|
|> line(end = [10, 0])
|
||||||
|> line(end = [5, 0])
|
|> line(end = [5, 0])
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -4,8 +4,12 @@ excerpt: "Converts a number from centimeters to the current default unit."
|
|||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**WARNING:** This function is deprecated.
|
||||||
|
|
||||||
Converts a number from centimeters to the current default unit.
|
Converts a number from centimeters to the current default unit.
|
||||||
|
|
||||||
|
*DEPRECATED* prefer using explicit numeric suffixes (e.g., `42cm`) or the `to...` conversion functions.
|
||||||
|
|
||||||
No matter what units the current file uses, this function will always return a number equivalent to the input in centimeters.
|
No matter what units the current file uses, this function will always return a number equivalent to the input in centimeters.
|
||||||
|
|
||||||
For example, if the current file uses inches, `fromCm(1)` will return `0.393701`. If the current file uses millimeters, `fromCm(1)` will return `10`. If the current file uses centimeters, `fromCm(1)` will return `1`.
|
For example, if the current file uses inches, `fromCm(1)` will return `0.393701`. If the current file uses millimeters, `fromCm(1)` will return `10`. If the current file uses centimeters, `fromCm(1)` will return `1`.
|
||||||
|
@ -4,8 +4,12 @@ excerpt: "Converts a number from feet to the current default unit."
|
|||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**WARNING:** This function is deprecated.
|
||||||
|
|
||||||
Converts a number from feet to the current default unit.
|
Converts a number from feet to the current default unit.
|
||||||
|
|
||||||
|
*DEPRECATED* prefer using explicit numeric suffixes (e.g., `42ft`) or the `to...` conversion functions.
|
||||||
|
|
||||||
No matter what units the current file uses, this function will always return a number equivalent to the input in feet.
|
No matter what units the current file uses, this function will always return a number equivalent to the input in feet.
|
||||||
|
|
||||||
For example, if the current file uses inches, `fromFt(1)` will return `12`. If the current file uses millimeters, `fromFt(1)` will return `304.8`. If the current file uses feet, `fromFt(1)` will return `1`.
|
For example, if the current file uses inches, `fromFt(1)` will return `12`. If the current file uses millimeters, `fromFt(1)` will return `304.8`. If the current file uses feet, `fromFt(1)` will return `1`.
|
||||||
|
@ -4,8 +4,12 @@ excerpt: "Converts a number from inches to the current default unit."
|
|||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**WARNING:** This function is deprecated.
|
||||||
|
|
||||||
Converts a number from inches to the current default unit.
|
Converts a number from inches to the current default unit.
|
||||||
|
|
||||||
|
*DEPRECATED* prefer using explicit numeric suffixes (e.g., `42inch`) or the `to...` conversion functions.
|
||||||
|
|
||||||
No matter what units the current file uses, this function will always return a number equivalent to the input in inches.
|
No matter what units the current file uses, this function will always return a number equivalent to the input in inches.
|
||||||
|
|
||||||
For example, if the current file uses inches, `fromInches(1)` will return `1`. If the current file uses millimeters, `fromInches(1)` will return `25.4`.
|
For example, if the current file uses inches, `fromInches(1)` will return `1`. If the current file uses millimeters, `fromInches(1)` will return `25.4`.
|
||||||
|
@ -4,8 +4,12 @@ excerpt: "Converts a number from meters to the current default unit."
|
|||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**WARNING:** This function is deprecated.
|
||||||
|
|
||||||
Converts a number from meters to the current default unit.
|
Converts a number from meters to the current default unit.
|
||||||
|
|
||||||
|
*DEPRECATED* prefer using explicit numeric suffixes (e.g., `42m`) or the `to...` conversion functions.
|
||||||
|
|
||||||
No matter what units the current file uses, this function will always return a number equivalent to the input in meters.
|
No matter what units the current file uses, this function will always return a number equivalent to the input in meters.
|
||||||
|
|
||||||
For example, if the current file uses inches, `fromM(1)` will return `39.3701`. If the current file uses millimeters, `fromM(1)` will return `1000`. If the current file uses meters, `fromM(1)` will return `1`.
|
For example, if the current file uses inches, `fromM(1)` will return `39.3701`. If the current file uses millimeters, `fromM(1)` will return `1000`. If the current file uses meters, `fromM(1)` will return `1`.
|
||||||
|
@ -4,8 +4,12 @@ excerpt: "Converts a number from mm to the current default unit."
|
|||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**WARNING:** This function is deprecated.
|
||||||
|
|
||||||
Converts a number from mm to the current default unit.
|
Converts a number from mm to the current default unit.
|
||||||
|
|
||||||
|
*DEPRECATED* prefer using explicit numeric suffixes (e.g., `42mm`) or the `to...` conversion functions.
|
||||||
|
|
||||||
No matter what units the current file uses, this function will always return a number equivalent to the input in millimeters.
|
No matter what units the current file uses, this function will always return a number equivalent to the input in millimeters.
|
||||||
|
|
||||||
For example, if the current file uses inches, `fromMm(1)` will return `1/25.4`. If the current file uses millimeters, `fromMm(1)` will return `1`.
|
For example, if the current file uses inches, `fromMm(1)` will return `1/25.4`. If the current file uses millimeters, `fromMm(1)` will return `1`.
|
||||||
|
@ -4,8 +4,12 @@ excerpt: "Converts a number from yards to the current default unit."
|
|||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**WARNING:** This function is deprecated.
|
||||||
|
|
||||||
Converts a number from yards to the current default unit.
|
Converts a number from yards to the current default unit.
|
||||||
|
|
||||||
|
*DEPRECATED* prefer using explicit numeric suffixes (e.g., `42yd`) or the `to...` conversion functions.
|
||||||
|
|
||||||
No matter what units the current file uses, this function will always return a number equivalent to the input in yards.
|
No matter what units the current file uses, this function will always return a number equivalent to the input in yards.
|
||||||
|
|
||||||
For example, if the current file uses inches, `fromYd(1)` will return `36`. If the current file uses millimeters, `fromYd(1)` will return `914.4`. If the current file uses yards, `fromYd(1)` will return `1`.
|
For example, if the current file uses inches, `fromYd(1)` will return `36`. If the current file uses millimeters, `fromYd(1)` will return `914.4`. If the current file uses yards, `fromYd(1)` will return `1`.
|
||||||
|
@ -32,7 +32,7 @@ getCommonEdge(faces: [TagIdentifier]): Uuid
|
|||||||
|
|
||||||
scale = 20
|
scale = 20
|
||||||
part001 = startSketchOn(XY)
|
part001 = startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [0, scale])
|
|> line(end = [0, scale])
|
||||||
|> line(end = [scale, 0])
|
|> line(end = [scale, 0])
|
||||||
|> line(end = [0, -scale])
|
|> line(end = [0, -scale])
|
||||||
|
@ -9,7 +9,7 @@ Get the next adjacent edge to the edge given.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
getNextAdjacentEdge(tag: TagIdentifier): Uuid
|
getNextAdjacentEdge(edge: TagIdentifier): Uuid
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ getNextAdjacentEdge(tag: TagIdentifier): Uuid
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| [`tag`](/docs/kcl/types/tag) | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
| `edge` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The tag of the edge you want to find the next adjacent edge of. | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ getNextAdjacentEdge(tag: TagIdentifier): Uuid
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [10, 0])
|
|> line(end = [10, 0])
|
||||||
|> angledLine(angle = 60, length = 10)
|
|> angledLine(angle = 60, length = 10)
|
||||||
|> angledLine(angle = 120, length = 10)
|
|> angledLine(angle = 120, length = 10)
|
||||||
|
@ -9,7 +9,7 @@ Get the opposite edge to the edge given.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
getOppositeEdge(tag: TagIdentifier): Uuid
|
getOppositeEdge(edge: TagIdentifier): Uuid
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ getOppositeEdge(tag: TagIdentifier): Uuid
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| [`tag`](/docs/kcl/types/tag) | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
| `edge` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The tag of the edge you want to find the opposite edge of. | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ getOppositeEdge(tag: TagIdentifier): Uuid
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [10, 0])
|
|> line(end = [10, 0])
|
||||||
|> angledLine(angle = 60, length = 10)
|
|> angledLine(angle = 60, length = 10)
|
||||||
|> angledLine(angle = 120, length = 10)
|
|> angledLine(angle = 120, length = 10)
|
||||||
|
@ -9,7 +9,7 @@ Get the previous adjacent edge to the edge given.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
getPreviousAdjacentEdge(tag: TagIdentifier): Uuid
|
getPreviousAdjacentEdge(edge: TagIdentifier): Uuid
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ getPreviousAdjacentEdge(tag: TagIdentifier): Uuid
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| [`tag`](/docs/kcl/types/tag) | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
| `edge` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The tag of the edge you want to find the previous adjacent edge of. | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ getPreviousAdjacentEdge(tag: TagIdentifier): Uuid
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [10, 0])
|
|> line(end = [10, 0])
|
||||||
|> angledLine(angle = 60, length = 10)
|
|> angledLine(angle = 60, length = 10)
|
||||||
|> angledLine(angle = 120, length = 10)
|
|> angledLine(angle = 120, length = 10)
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -30,44 +30,22 @@ layout: manual
|
|||||||
* [`Y`](kcl/consts/std-Y)
|
* [`Y`](kcl/consts/std-Y)
|
||||||
* [`YZ`](kcl/consts/std-YZ)
|
* [`YZ`](kcl/consts/std-YZ)
|
||||||
* [`Z`](kcl/consts/std-Z)
|
* [`Z`](kcl/consts/std-Z)
|
||||||
* [`abs`](kcl/abs)
|
|
||||||
* [`acos`](kcl/acos)
|
|
||||||
* [`angleToMatchLengthX`](kcl/angleToMatchLengthX)
|
|
||||||
* [`angleToMatchLengthY`](kcl/angleToMatchLengthY)
|
|
||||||
* [`angledLine`](kcl/angledLine)
|
* [`angledLine`](kcl/angledLine)
|
||||||
* [`angledLineThatIntersects`](kcl/angledLineThatIntersects)
|
* [`angledLineThatIntersects`](kcl/angledLineThatIntersects)
|
||||||
* [`appearance`](kcl/appearance)
|
* [`appearance`](kcl/appearance)
|
||||||
* [`arc`](kcl/arc)
|
* [`arc`](kcl/arc)
|
||||||
* [`asin`](kcl/asin)
|
|
||||||
* [`assert`](kcl/assert)
|
* [`assert`](kcl/assert)
|
||||||
* [`assertEqual`](kcl/assertEqual)
|
* [`assertIs`](kcl/assertIs)
|
||||||
* [`assertGreaterThan`](kcl/assertGreaterThan)
|
|
||||||
* [`assertGreaterThanOrEq`](kcl/assertGreaterThanOrEq)
|
|
||||||
* [`assertLessThan`](kcl/assertLessThan)
|
|
||||||
* [`assertLessThanOrEq`](kcl/assertLessThanOrEq)
|
|
||||||
* [`atan`](kcl/atan)
|
|
||||||
* [`atan2`](kcl/atan2)
|
|
||||||
* [`bezierCurve`](kcl/bezierCurve)
|
* [`bezierCurve`](kcl/bezierCurve)
|
||||||
* [`ceil`](kcl/ceil)
|
|
||||||
* [`chamfer`](kcl/chamfer)
|
|
||||||
* [`circleThreePoint`](kcl/circleThreePoint)
|
* [`circleThreePoint`](kcl/circleThreePoint)
|
||||||
|
* [`clone`](kcl/clone)
|
||||||
* [`close`](kcl/close)
|
* [`close`](kcl/close)
|
||||||
* [`extrude`](kcl/extrude)
|
* [`extrude`](kcl/extrude)
|
||||||
* [`fillet`](kcl/fillet)
|
|
||||||
* [`floor`](kcl/floor)
|
|
||||||
* [`fromCm`](kcl/fromCm)
|
|
||||||
* [`fromFt`](kcl/fromFt)
|
|
||||||
* [`fromInches`](kcl/fromInches)
|
|
||||||
* [`fromM`](kcl/fromM)
|
|
||||||
* [`fromMm`](kcl/fromMm)
|
|
||||||
* [`fromYd`](kcl/fromYd)
|
|
||||||
* [`getCommonEdge`](kcl/getCommonEdge)
|
* [`getCommonEdge`](kcl/getCommonEdge)
|
||||||
* [`getNextAdjacentEdge`](kcl/getNextAdjacentEdge)
|
* [`getNextAdjacentEdge`](kcl/getNextAdjacentEdge)
|
||||||
* [`getOppositeEdge`](kcl/getOppositeEdge)
|
* [`getOppositeEdge`](kcl/getOppositeEdge)
|
||||||
* [`getPreviousAdjacentEdge`](kcl/getPreviousAdjacentEdge)
|
* [`getPreviousAdjacentEdge`](kcl/getPreviousAdjacentEdge)
|
||||||
* [`helix`](kcl/std-helix)
|
* [`helix`](kcl/std-helix)
|
||||||
* [`hole`](kcl/hole)
|
|
||||||
* [`hollow`](kcl/hollow)
|
|
||||||
* [`intersect`](kcl/intersect)
|
* [`intersect`](kcl/intersect)
|
||||||
* [`involuteCircular`](kcl/involuteCircular)
|
* [`involuteCircular`](kcl/involuteCircular)
|
||||||
* [`lastSegX`](kcl/lastSegX)
|
* [`lastSegX`](kcl/lastSegX)
|
||||||
@ -76,15 +54,9 @@ layout: manual
|
|||||||
* [`legAngY`](kcl/legAngY)
|
* [`legAngY`](kcl/legAngY)
|
||||||
* [`legLen`](kcl/legLen)
|
* [`legLen`](kcl/legLen)
|
||||||
* [`line`](kcl/line)
|
* [`line`](kcl/line)
|
||||||
* [`ln`](kcl/ln)
|
|
||||||
* [`loft`](kcl/loft)
|
* [`loft`](kcl/loft)
|
||||||
* [`log`](kcl/log)
|
|
||||||
* [`log10`](kcl/log10)
|
|
||||||
* [`log2`](kcl/log2)
|
|
||||||
* [`map`](kcl/map)
|
* [`map`](kcl/map)
|
||||||
* [`max`](kcl/max)
|
* [`offsetPlane`](kcl/std-offsetPlane)
|
||||||
* [`min`](kcl/min)
|
|
||||||
* [`offsetPlane`](kcl/offsetPlane)
|
|
||||||
* [`patternCircular2d`](kcl/patternCircular2d)
|
* [`patternCircular2d`](kcl/patternCircular2d)
|
||||||
* [`patternCircular3d`](kcl/patternCircular3d)
|
* [`patternCircular3d`](kcl/patternCircular3d)
|
||||||
* [`patternLinear2d`](kcl/patternLinear2d)
|
* [`patternLinear2d`](kcl/patternLinear2d)
|
||||||
@ -93,16 +65,13 @@ layout: manual
|
|||||||
* [`patternTransform2d`](kcl/patternTransform2d)
|
* [`patternTransform2d`](kcl/patternTransform2d)
|
||||||
* [`polygon`](kcl/polygon)
|
* [`polygon`](kcl/polygon)
|
||||||
* [`pop`](kcl/pop)
|
* [`pop`](kcl/pop)
|
||||||
* [`pow`](kcl/pow)
|
|
||||||
* [`profileStart`](kcl/profileStart)
|
* [`profileStart`](kcl/profileStart)
|
||||||
* [`profileStartX`](kcl/profileStartX)
|
* [`profileStartX`](kcl/profileStartX)
|
||||||
* [`profileStartY`](kcl/profileStartY)
|
* [`profileStartY`](kcl/profileStartY)
|
||||||
* [`push`](kcl/push)
|
* [`push`](kcl/push)
|
||||||
* [`reduce`](kcl/reduce)
|
* [`reduce`](kcl/reduce)
|
||||||
* [`rem`](kcl/rem)
|
|
||||||
* [`revolve`](kcl/std-revolve)
|
* [`revolve`](kcl/std-revolve)
|
||||||
* [`rotate`](kcl/rotate)
|
* [`rotate`](kcl/rotate)
|
||||||
* [`round`](kcl/round)
|
|
||||||
* [`scale`](kcl/scale)
|
* [`scale`](kcl/scale)
|
||||||
* [`segAng`](kcl/segAng)
|
* [`segAng`](kcl/segAng)
|
||||||
* [`segEnd`](kcl/segEnd)
|
* [`segEnd`](kcl/segEnd)
|
||||||
@ -112,31 +81,50 @@ layout: manual
|
|||||||
* [`segStart`](kcl/segStart)
|
* [`segStart`](kcl/segStart)
|
||||||
* [`segStartX`](kcl/segStartX)
|
* [`segStartX`](kcl/segStartX)
|
||||||
* [`segStartY`](kcl/segStartY)
|
* [`segStartY`](kcl/segStartY)
|
||||||
* [`shell`](kcl/shell)
|
* [`startProfile`](kcl/startProfile)
|
||||||
* [`sqrt`](kcl/sqrt)
|
|
||||||
* [`startProfileAt`](kcl/startProfileAt)
|
|
||||||
* [`startSketchOn`](kcl/startSketchOn)
|
* [`startSketchOn`](kcl/startSketchOn)
|
||||||
* [`subtract`](kcl/subtract)
|
* [`subtract`](kcl/subtract)
|
||||||
|
* [`subtract2d`](kcl/subtract2d)
|
||||||
* [`sweep`](kcl/sweep)
|
* [`sweep`](kcl/sweep)
|
||||||
* [`tangentToEnd`](kcl/tangentToEnd)
|
* [`tangentToEnd`](kcl/tangentToEnd)
|
||||||
* [`tangentialArc`](kcl/tangentialArc)
|
* [`tangentialArc`](kcl/tangentialArc)
|
||||||
* [`toDegrees`](kcl/toDegrees)
|
|
||||||
* [`toRadians`](kcl/toRadians)
|
|
||||||
* [`translate`](kcl/translate)
|
* [`translate`](kcl/translate)
|
||||||
* [`union`](kcl/union)
|
* [`union`](kcl/union)
|
||||||
* [`xLine`](kcl/xLine)
|
* [`xLine`](kcl/xLine)
|
||||||
* [`yLine`](kcl/yLine)
|
* [`yLine`](kcl/yLine)
|
||||||
* **std::math**
|
* **std::math**
|
||||||
* [`E`](kcl/consts/std-math-E)
|
* [`math::E`](kcl/consts/std-math-E)
|
||||||
* [`PI`](kcl/consts/std-math-PI)
|
* [`math::PI`](kcl/consts/std-math-PI)
|
||||||
* [`TAU`](kcl/consts/std-math-TAU)
|
* [`math::TAU`](kcl/consts/std-math-TAU)
|
||||||
* [`cos`](kcl/std-math-cos)
|
* [`math::abs`](kcl/std-math-abs)
|
||||||
* [`polar`](kcl/std-math-polar)
|
* [`math::acos`](kcl/std-math-acos)
|
||||||
* [`sin`](kcl/std-math-sin)
|
* [`math::asin`](kcl/std-math-asin)
|
||||||
* [`tan`](kcl/std-math-tan)
|
* [`math::atan`](kcl/std-math-atan)
|
||||||
|
* [`math::atan2`](kcl/std-math-atan2)
|
||||||
|
* [`math::ceil`](kcl/std-math-ceil)
|
||||||
|
* [`math::cos`](kcl/std-math-cos)
|
||||||
|
* [`math::floor`](kcl/std-math-floor)
|
||||||
|
* [`math::ln`](kcl/std-math-ln)
|
||||||
|
* [`math::log`](kcl/std-math-log)
|
||||||
|
* [`math::log10`](kcl/std-math-log10)
|
||||||
|
* [`math::log2`](kcl/std-math-log2)
|
||||||
|
* [`math::max`](kcl/std-math-max)
|
||||||
|
* [`math::min`](kcl/std-math-min)
|
||||||
|
* [`math::polar`](kcl/std-math-polar)
|
||||||
|
* [`math::pow`](kcl/std-math-pow)
|
||||||
|
* [`math::rem`](kcl/std-math-rem)
|
||||||
|
* [`math::round`](kcl/std-math-round)
|
||||||
|
* [`math::sin`](kcl/std-math-sin)
|
||||||
|
* [`math::sqrt`](kcl/std-math-sqrt)
|
||||||
|
* [`math::tan`](kcl/std-math-tan)
|
||||||
* **std::sketch**
|
* **std::sketch**
|
||||||
* [`circle`](kcl/std-sketch-circle)
|
* [`circle`](kcl/std-sketch-circle)
|
||||||
* [`mirror2d`](kcl/std-sketch-mirror2d)
|
* [`mirror2d`](kcl/std-sketch-mirror2d)
|
||||||
|
* **std::solid**
|
||||||
|
* [`chamfer`](kcl/std-solid-chamfer)
|
||||||
|
* [`fillet`](kcl/std-solid-fillet)
|
||||||
|
* [`hollow`](kcl/std-solid-hollow)
|
||||||
|
* [`shell`](kcl/std-solid-shell)
|
||||||
* **std::turns**
|
* **std::turns**
|
||||||
* [`turns::HALF_TURN`](kcl/consts/std-turns-HALF_TURN)
|
* [`turns::HALF_TURN`](kcl/consts/std-turns-HALF_TURN)
|
||||||
* [`turns::QUARTER_TURN`](kcl/consts/std-turns-QUARTER_TURN)
|
* [`turns::QUARTER_TURN`](kcl/consts/std-turns-QUARTER_TURN)
|
||||||
@ -153,3 +141,12 @@ layout: manual
|
|||||||
* [`Point3d`](kcl/types/Point3d)
|
* [`Point3d`](kcl/types/Point3d)
|
||||||
* [`Sketch`](kcl/types/Sketch)
|
* [`Sketch`](kcl/types/Sketch)
|
||||||
* [`Solid`](kcl/types/Solid)
|
* [`Solid`](kcl/types/Solid)
|
||||||
|
* **std::units**
|
||||||
|
* [`units::toCentimeters`](kcl/std-units-toCentimeters)
|
||||||
|
* [`units::toDegrees`](kcl/std-units-toDegrees)
|
||||||
|
* [`units::toFeet`](kcl/std-units-toFeet)
|
||||||
|
* [`units::toInches`](kcl/std-units-toInches)
|
||||||
|
* [`units::toMeters`](kcl/std-units-toMeters)
|
||||||
|
* [`units::toMillimeters`](kcl/std-units-toMillimeters)
|
||||||
|
* [`units::toRadians`](kcl/std-units-toRadians)
|
||||||
|
* [`units::toYards`](kcl/std-units-toYards)
|
||||||
|
@ -34,7 +34,7 @@ int(num: number): number
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
n = int(ceil(5 / 2))
|
n = int(ceil(5 / 2))
|
||||||
assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3")
|
assert(n, isEqualTo = 3, error = "5/2 = 2.5, rounded up makes 3")
|
||||||
// Draw n cylinders.
|
// Draw n cylinders.
|
||||||
startSketchOn(XZ)
|
startSketchOn(XZ)
|
||||||
|> circle(center = [0, 0], radius = 2)
|
|> circle(center = [0, 0], radius = 2)
|
||||||
|
@ -36,7 +36,7 @@ intersect(
|
|||||||
|
|
||||||
fn cube(center, size) {
|
fn cube(center, size) {
|
||||||
return startSketchOn(XY)
|
return startSketchOn(XY)
|
||||||
|> startProfileAt([center[0] - size, center[1] - size], %)
|
|> startProfile(at = [center[0] - size, center[1] - size])
|
||||||
|> line(endAbsolute = [center[0] + size, center[1] - size])
|
|> line(endAbsolute = [center[0] + size, center[1] - size])
|
||||||
|> line(endAbsolute = [center[0] + size, center[1] + size])
|
|> line(endAbsolute = [center[0] + size, center[1] + size])
|
||||||
|> line(endAbsolute = [center[0] - size, center[1] + size])
|
|> line(endAbsolute = [center[0] - size, center[1] + size])
|
||||||
@ -61,7 +61,7 @@ intersectedPart = intersect([part001, part002])
|
|||||||
|
|
||||||
fn cube(center, size) {
|
fn cube(center, size) {
|
||||||
return startSketchOn(XY)
|
return startSketchOn(XY)
|
||||||
|> startProfileAt([center[0] - size, center[1] - size], %)
|
|> startProfile(at = [center[0] - size, center[1] - size])
|
||||||
|> line(endAbsolute = [center[0] + size, center[1] - size])
|
|> line(endAbsolute = [center[0] + size, center[1] - size])
|
||||||
|> line(endAbsolute = [center[0] + size, center[1] + size])
|
|> line(endAbsolute = [center[0] + size, center[1] + size])
|
||||||
|> line(endAbsolute = [center[0] - size, center[1] + size])
|
|> line(endAbsolute = [center[0] - size, center[1] + size])
|
||||||
|
@ -42,7 +42,7 @@ involuteCircular(
|
|||||||
a = 10
|
a = 10
|
||||||
b = 14
|
b = 14
|
||||||
startSketchOn(XZ)
|
startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> involuteCircular(startRadius = a, endRadius = b, angle = 60)
|
|> involuteCircular(startRadius = a, endRadius = b, angle = 60)
|
||||||
|> involuteCircular(
|
|> involuteCircular(
|
||||||
startRadius = a,
|
startRadius = a,
|
||||||
|
@ -21,4 +21,6 @@ once fixed in engine will just start working here with no language changes.
|
|||||||
- **Chamfers**: Chamfers cannot intersect, you will get an error. Only simple
|
- **Chamfers**: Chamfers cannot intersect, you will get an error. Only simple
|
||||||
chamfer cases work currently.
|
chamfer cases work currently.
|
||||||
|
|
||||||
- **Appearance**: Changing the appearance on a loft does not work.
|
- **Appearance**: Changing the appearance on a loft does not work.
|
||||||
|
|
||||||
|
- **CSG Booleans**: Coplanar (bodies that share a plane) unions, subtractions, and intersections are not currently supported.
|
||||||
|
@ -28,7 +28,7 @@ lastSegX(sketch: Sketch): number
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [5, 0])
|
|> line(end = [5, 0])
|
||||||
|> line(end = [20, 5])
|
|> line(end = [20, 5])
|
||||||
|> line(end = [lastSegX(%), 0])
|
|> line(end = [lastSegX(%), 0])
|
||||||
|
@ -28,7 +28,7 @@ lastSegY(sketch: Sketch): number
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [5, 0])
|
|> line(end = [5, 0])
|
||||||
|> line(end = [20, 5])
|
|> line(end = [20, 5])
|
||||||
|> line(end = [0, lastSegY(%)])
|
|> line(end = [0, lastSegY(%)])
|
||||||
|
@ -24,8 +24,8 @@ legAngX(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `hypotenuse` | [`number`](/docs/kcl/types/number) | | Yes |
|
| `hypotenuse` | [`number`](/docs/kcl/types/number) | The length of the triangle's hypotenuse | Yes |
|
||||||
| `leg` | [`number`](/docs/kcl/types/number) | | Yes |
|
| `leg` | [`number`](/docs/kcl/types/number) | The length of one of the triangle's legs (i.e. non-hypotenuse side) | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ legAngX(
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
legAngX(5, 3)
|
legAngX(hypotenuse = 5, leg = 3)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ legAngY(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `hypotenuse` | [`number`](/docs/kcl/types/number) | | Yes |
|
| `hypotenuse` | [`number`](/docs/kcl/types/number) | The length of the triangle's hypotenuse | Yes |
|
||||||
| `leg` | [`number`](/docs/kcl/types/number) | | Yes |
|
| `leg` | [`number`](/docs/kcl/types/number) | The length of one of the triangle's legs (i.e. non-hypotenuse side) | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ legAngY(
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
legAngY(5, 3)
|
legAngY(hypotenuse = 5, leg = 3)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ legLen(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `hypotenuse` | [`number`](/docs/kcl/types/number) | | Yes |
|
| `hypotenuse` | [`number`](/docs/kcl/types/number) | The length of the triangle's hypotenuse | Yes |
|
||||||
| `leg` | [`number`](/docs/kcl/types/number) | | Yes |
|
| `leg` | [`number`](/docs/kcl/types/number) | The length of one of the triangle's legs (i.e. non-hypotenuse side) | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ legLen(
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
legLen(5, 3)
|
legLen(hypotenuse = 5, leg = 3)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ line(
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
triangle = startSketchOn(XZ)
|
triangle = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [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
|
||||||
// the start of the sketch.
|
// the start of the sketch.
|
||||||
@ -47,7 +47,7 @@ triangle = startSketchOn(XZ)
|
|||||||
|> extrude(length = 5)
|
|> extrude(length = 5)
|
||||||
|
|
||||||
box = startSketchOn(XZ)
|
box = startSketchOn(XZ)
|
||||||
|> startProfileAt([10, 10], %)
|
|> startProfile(at = [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.
|
||||||
|> line(end = [10, 0])
|
|> line(end = [10, 0])
|
||||||
|
File diff suppressed because one or more lines are too long
@ -43,7 +43,7 @@ loft(
|
|||||||
```js
|
```js
|
||||||
// Loft a square and a triangle.
|
// Loft a square and a triangle.
|
||||||
squareSketch = startSketchOn(XY)
|
squareSketch = startSketchOn(XY)
|
||||||
|> startProfileAt([-100, 200], %)
|
|> startProfile(at = [-100, 200])
|
||||||
|> line(end = [200, 0])
|
|> line(end = [200, 0])
|
||||||
|> line(end = [0, -200])
|
|> line(end = [0, -200])
|
||||||
|> line(end = [-200, 0])
|
|> line(end = [-200, 0])
|
||||||
@ -51,7 +51,7 @@ squareSketch = startSketchOn(XY)
|
|||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
triangleSketch = startSketchOn(offsetPlane(XY, offset = 75))
|
triangleSketch = startSketchOn(offsetPlane(XY, offset = 75))
|
||||||
|> startProfileAt([0, 125], %)
|
|> startProfile(at = [0, 125])
|
||||||
|> line(end = [-15, -30])
|
|> line(end = [-15, -30])
|
||||||
|> line(end = [30, 0])
|
|> line(end = [30, 0])
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
@ -65,7 +65,7 @@ loft([squareSketch, triangleSketch])
|
|||||||
```js
|
```js
|
||||||
// Loft a square, a circle, and another circle.
|
// Loft a square, a circle, and another circle.
|
||||||
squareSketch = startSketchOn(XY)
|
squareSketch = startSketchOn(XY)
|
||||||
|> startProfileAt([-100, 200], %)
|
|> startProfile(at = [-100, 200])
|
||||||
|> line(end = [200, 0])
|
|> line(end = [200, 0])
|
||||||
|> line(end = [0, -200])
|
|> line(end = [0, -200])
|
||||||
|> line(end = [-200, 0])
|
|> line(end = [-200, 0])
|
||||||
@ -90,7 +90,7 @@ loft([
|
|||||||
```js
|
```js
|
||||||
// Loft a square, a circle, and another circle with options.
|
// Loft a square, a circle, and another circle with options.
|
||||||
squareSketch = startSketchOn(XY)
|
squareSketch = startSketchOn(XY)
|
||||||
|> startProfileAt([-100, 200], %)
|
|> startProfile(at = [-100, 200])
|
||||||
|> line(end = [200, 0])
|
|> line(end = [200, 0])
|
||||||
|> line(end = [0, -200])
|
|> line(end = [0, -200])
|
||||||
|> line(end = [-200, 0])
|
|> line(end = [-200, 0])
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -10,7 +10,7 @@ isolated from other files as a separate module.
|
|||||||
When you define a function, you can use `export` before it to make it available
|
When you define a function, you can use `export` before it to make it available
|
||||||
to other modules.
|
to other modules.
|
||||||
|
|
||||||
```
|
```kcl
|
||||||
// util.kcl
|
// util.kcl
|
||||||
export fn increment(x) {
|
export fn increment(x) {
|
||||||
return x + 1
|
return x + 1
|
||||||
@ -31,11 +31,11 @@ Imported files _must_ be in the same project so that units are uniform across
|
|||||||
modules. This means that it must be in the same directory.
|
modules. This means that it must be in the same directory.
|
||||||
|
|
||||||
Import statements must be at the top-level of a file. It is not allowed to have
|
Import statements must be at the top-level of a file. It is not allowed to have
|
||||||
an `import` statement inside a function or in the body of an if-else.
|
an `import` statement inside a function or in the body of an if‑else.
|
||||||
|
|
||||||
Multiple functions can be exported in a file.
|
Multiple functions can be exported in a file.
|
||||||
|
|
||||||
```
|
```kcl
|
||||||
// util.kcl
|
// util.kcl
|
||||||
export fn increment(x) {
|
export fn increment(x) {
|
||||||
return x + 1
|
return x + 1
|
||||||
@ -58,6 +58,215 @@ Imported symbols can be renamed for convenience or to avoid name collisions.
|
|||||||
import increment as inc, decrement as dec from "util.kcl"
|
import increment as inc, decrement as dec from "util.kcl"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Functions vs `clone`
|
||||||
|
|
||||||
|
There are two common patterns for re‑using geometry:
|
||||||
|
|
||||||
|
1. **Wrap the construction in a function** – flexible and fully parametric.
|
||||||
|
2. **Duplicate an existing object with `clone`** – lightning‑fast, but an exact
|
||||||
|
duplicate.
|
||||||
|
|
||||||
|
### Parametric function example
|
||||||
|
|
||||||
|
```kcl
|
||||||
|
fn cube(center) {
|
||||||
|
return startSketchOn(XY)
|
||||||
|
|> startProfile(at = [center[0] - 10, center[1] - 10])
|
||||||
|
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|
||||||
|
|> line(endAbsolute = [center[0] + 10, center[1] + 10])
|
||||||
|
|> line(endAbsolute = [center[0] - 10, center[1] + 10])
|
||||||
|
|> close()
|
||||||
|
|> extrude(length = 10)
|
||||||
|
}
|
||||||
|
|
||||||
|
myCube = cube([0, 0])
|
||||||
|
```
|
||||||
|
|
||||||
|
*Pros*
|
||||||
|
- Any argument can be a parameter – size, position, appearance, etc.
|
||||||
|
- Works great inside loops, arrays, or optimisation sweeps.
|
||||||
|
|
||||||
|
*Cons*
|
||||||
|
- Every invocation rebuilds the entire feature tree.
|
||||||
|
- **Slower** than a straight duplicate – each call is its own render job.
|
||||||
|
|
||||||
|
### `clone` example
|
||||||
|
|
||||||
|
```kcl
|
||||||
|
sketch001 = startSketchOn(-XZ)
|
||||||
|
|> circle(center = [0, 0], radius = 10)
|
||||||
|
|> extrude(length = 5)
|
||||||
|
|> appearance(color = "#ff0000", metalness = 90, roughness = 90)
|
||||||
|
|
||||||
|
sketch002 = clone(sketch001) // ✓ instant copy
|
||||||
|
```
|
||||||
|
|
||||||
|
*Pros*
|
||||||
|
- Roughly an O(1) operation – we just duplicate the underlying engine handle.
|
||||||
|
- Perfect when you need ten identical bolts or two copies of the same imported STEP file.
|
||||||
|
|
||||||
|
*Cons*
|
||||||
|
- **Not parametric** – the clone is exactly the same shape as the source.
|
||||||
|
- If you need to tweak dimensions per‑instance, you’re back to a function.
|
||||||
|
|
||||||
|
> **Rule of thumb** – Reach for `clone` when the geometry is already what you want. Reach for a function when you need customisation.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Module‑level parallelism
|
||||||
|
|
||||||
|
Under the hood, the Design Studio runs **every module in parallel** where it can. This means:
|
||||||
|
|
||||||
|
- The top‑level code of `foo.kcl`, `bar.kcl`, and `baz.kcl` all start executing immediately and concurrently.
|
||||||
|
- Imports that read foreign files (STEP/OBJ/…) overlap their I/O and background render.
|
||||||
|
- CPU‑bound calculations in separate modules get their own worker threads.
|
||||||
|
|
||||||
|
### Why modules beat one‑big‑file
|
||||||
|
|
||||||
|
If you shoe‑horn everything into `main.kcl`, each statement runs sequentially:
|
||||||
|
|
||||||
|
```norun
|
||||||
|
import "big.step" as gizmo // blocks main while reading
|
||||||
|
|
||||||
|
gizmo |> translate(x=50) // blocks again while waiting for render
|
||||||
|
```
|
||||||
|
|
||||||
|
Split `gizmo` into its own file and the read/render can overlap whatever else `main.kcl` is doing.
|
||||||
|
|
||||||
|
```norun
|
||||||
|
// gizmo.kcl (worker A)
|
||||||
|
import "big.step"
|
||||||
|
|
||||||
|
// main.kcl (worker B)
|
||||||
|
import "gizmo.kcl" as gizmo // non‑blocking
|
||||||
|
|
||||||
|
// ... other setup ...
|
||||||
|
|
||||||
|
gizmo |> translate(x=50) // only blocks here
|
||||||
|
```
|
||||||
|
|
||||||
|
### Gotcha: defining but **not** calling functions
|
||||||
|
|
||||||
|
Defining a function inside a module is instantaneous – we just record the byte‑code. The heavy lifting happens when the function is **called**. So:
|
||||||
|
|
||||||
|
```norun
|
||||||
|
// util.kcl
|
||||||
|
export fn makeBolt(size) { /* … expensive CAD … */ }
|
||||||
|
```
|
||||||
|
|
||||||
|
If `main.kcl` waits until the very end to call `makeBolt`, *none* of that work was parallelised – you’ve pushed the cost back onto the serial tail of your script.
|
||||||
|
|
||||||
|
**Better:** call it early or move the invocation into another module.
|
||||||
|
|
||||||
|
```norun
|
||||||
|
// bolt_instance.kcl
|
||||||
|
import makeBolt from "util.kcl"
|
||||||
|
bolt = makeBolt(5) // executed in parallel
|
||||||
|
bolt
|
||||||
|
```
|
||||||
|
|
||||||
|
Now `main.kcl` can `import "bolt_instance.kcl" as bolt` and get the result that was rendered while it was busy doing other things.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Whole module import
|
||||||
|
|
||||||
|
You can also import the whole module. This is useful if you want to use the
|
||||||
|
result of a module as a variable, like a part.
|
||||||
|
|
||||||
|
```norun
|
||||||
|
import "tests/inputs/cube.kcl" as cube
|
||||||
|
cube
|
||||||
|
|> translate(x=10)
|
||||||
|
```
|
||||||
|
|
||||||
|
This imports the whole module and makes it available as `cube`. You can then
|
||||||
|
use it like any other object. The `cube` variable is now a reference to the
|
||||||
|
result of the module. This means that if you change the module, the `cube`
|
||||||
|
variable will change as well.
|
||||||
|
|
||||||
|
In `cube.kcl`, you cannot have multiple objects. It has to be a single part. If
|
||||||
|
you have multiple objects, you will get an error. This is because the module is
|
||||||
|
expected to return a single object that can be used as a variable.
|
||||||
|
|
||||||
|
The last expression or variable definition becomes the module's return value.
|
||||||
|
The module is expected to return a single object that can be used as a variable
|
||||||
|
by whatever imports it.
|
||||||
|
|
||||||
|
So for example, this is allowed:
|
||||||
|
|
||||||
|
```norun
|
||||||
|
... a bunch of code to create cube and cube2 ...
|
||||||
|
|
||||||
|
myUnion = union([cube, cube2])
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also do this:
|
||||||
|
|
||||||
|
```norun
|
||||||
|
... a bunch of code to create cube and cube2 ...
|
||||||
|
|
||||||
|
union([cube, cube2])
|
||||||
|
```
|
||||||
|
|
||||||
|
Either way, the last line will return the union of the two objects.
|
||||||
|
|
||||||
|
Or what you could do instead is:
|
||||||
|
|
||||||
|
```norun
|
||||||
|
... a bunch of code to create cube and cube2 ...
|
||||||
|
|
||||||
|
myUnion = union([cube, cube2])
|
||||||
|
myUnion
|
||||||
|
```
|
||||||
|
|
||||||
|
This will assign the union of the two objects to a variable, and then return it
|
||||||
|
on the last statement. It's simply another way of doing the same thing.
|
||||||
|
|
||||||
|
The final statement is what's important because it's the return value of the
|
||||||
|
entire module. The module is expected to return a single object that can be used
|
||||||
|
as a variable by the file that imports it.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Multiple instances of the same import
|
||||||
|
|
||||||
|
Whether you are importing a file from another CAD system or a KCL file, that
|
||||||
|
file represents object(s) in memory. If you import the same file multiple times,
|
||||||
|
it will only be rendered once.
|
||||||
|
|
||||||
|
If you want to have multiple instances of the same object, you can use the
|
||||||
|
[`clone`](/docs/kcl/clone) function. This will render a new instance of the object in memory.
|
||||||
|
|
||||||
|
```norun
|
||||||
|
import cube from "tests/inputs/cube.kcl"
|
||||||
|
|
||||||
|
cube
|
||||||
|
|> translate(x=10)
|
||||||
|
clone(cube)
|
||||||
|
|> translate(x=20)
|
||||||
|
```
|
||||||
|
|
||||||
|
In the sample above, the `cube` object is imported from a KCL file. The first
|
||||||
|
instance is translated 10 units in the x direction. The second instance is
|
||||||
|
cloned and translated 20 units in the x direction. The two instances are now
|
||||||
|
separate objects in memory, and can be manipulated independently.
|
||||||
|
|
||||||
|
Here is an example with a file from another CAD system:
|
||||||
|
|
||||||
|
```kcl
|
||||||
|
import "tests/inputs/cube.step" as cube
|
||||||
|
|
||||||
|
cube
|
||||||
|
|> translate(x=10)
|
||||||
|
clone(cube)
|
||||||
|
|> translate(x=20)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Importing files from other CAD systems
|
## Importing files from other CAD systems
|
||||||
|
|
||||||
`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
|
||||||
@ -69,26 +278,18 @@ import "tests/inputs/cube.obj"
|
|||||||
// Use `cube` just like a KCL object.
|
// Use `cube` just like a KCL object.
|
||||||
```
|
```
|
||||||
|
|
||||||
```norun
|
```kcl
|
||||||
import "tests/inputs/cube-2.sldprt" as cube
|
import "tests/inputs/cube.sldprt" as cube
|
||||||
|
|
||||||
// Use `cube` just like a KCL object.
|
// Use `cube` just like a KCL object.
|
||||||
```
|
```
|
||||||
|
|
||||||
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"
|
|
||||||
```
|
|
||||||
|
|
||||||
For formats lacking unit data (such as STL, OBJ, or PLY files), the default
|
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 attribute. Likewise, you can also specify a coordinate system. E.g.,
|
||||||
|
|
||||||
```norun
|
```kcl
|
||||||
@(unitLength = ft, coords = opengl)
|
@(lengthUnit = ft, coords = opengl)
|
||||||
import "tests/inputs/cube.obj"
|
import "tests/inputs/cube.obj"
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -110,97 +311,55 @@ Coordinate systems:
|
|||||||
- `opengl`, forward: +Z, up: +Y, handedness: right
|
- `opengl`, forward: +Z, up: +Y, handedness: right
|
||||||
- `vulkan`, forward: +Z, up: -Y, handedness: left
|
- `vulkan`, forward: +Z, up: -Y, handedness: left
|
||||||
|
|
||||||
### Performance
|
---
|
||||||
|
|
||||||
Parallelized foreign-file imports now let you overlap file reads, initialization,
|
## Performance deep‑dive for foreign‑file imports
|
||||||
|
|
||||||
|
Parallelized foreign‑file imports now let you overlap file reads, initialization,
|
||||||
and rendering. To maximize throughput, you need to understand the three distinct
|
and rendering. To maximize throughput, you need to understand the three distinct
|
||||||
stages—reading, initializing (background render start), and invocation (blocking)
|
stages—reading, initializing (background render start), and invocation (blocking)
|
||||||
—and structure your code to defer blocking operations until the end.
|
—and structure your code to defer blocking operations until the end.
|
||||||
|
|
||||||
#### Foreign Import Execution Stages
|
### Foreign import execution stages
|
||||||
|
|
||||||
1. **Import (Read) Stage**
|
1. **Import (Read / Initialization) Stage**
|
||||||
```norun
|
```kcl
|
||||||
import "tests/inputs/cube.step" as cube
|
import "tests/inputs/cube.step" as cube
|
||||||
```
|
```
|
||||||
- Reads the file from disk and makes its API available.
|
- Reads the file from disk and makes its API available.
|
||||||
- **Does _not_** start Engine rendering or block your script.
|
- Starts engine rendering but **does not block** your script.
|
||||||
|
- This kick‑starts the render pipeline while you keep executing other code.
|
||||||
|
|
||||||
2. **Initialization (Background Render) Stage**
|
2. **Invocation (Blocking) Stage**
|
||||||
```norun
|
```kcl
|
||||||
import "tests/inputs/cube.step" as cube
|
import "tests/inputs/cube.step" as cube
|
||||||
|
|
||||||
myCube = cube // <- This line starts background rendering
|
cube
|
||||||
```
|
|> translate(z=10) // ← blocks here only
|
||||||
- Invoking the imported symbol (assignment or plain call) triggers Engine rendering _in the background_.
|
```
|
||||||
- This kick‑starts the render pipeline but doesn’t block—you can continue other work while the Engine processes the model.
|
- Any method call (e.g., `translate`, `scale`, `rotate`) waits for the background render to finish before applying transformations.
|
||||||
|
|
||||||
3. **Invocation (Blocking) Stage**
|
### Best practices
|
||||||
```norun
|
|
||||||
import "tests/inputs/cube.step" as cube
|
|
||||||
|
|
||||||
myCube = cube
|
#### 1. Defer blocking calls
|
||||||
|
|
||||||
myCube
|
```kcl
|
||||||
|> translate(z=10) // <- This line blocks
|
import "tests/inputs/cube.step" as cube // 1) Read / Background render starts
|
||||||
```
|
|
||||||
- Any method call (e.g., `translate`, `scale`, `rotate`) waits for the background render to finish before applying transformations.
|
|
||||||
- This is the only point where your script will block.
|
|
||||||
|
|
||||||
> **Nuance:** Foreign imports differ from pure KCL modules—calling the same import symbol multiple times (e.g., `screw` twice) starts background rendering twice.
|
|
||||||
|
|
||||||
#### Best Practices
|
|
||||||
|
|
||||||
##### 1. Defer Blocking Calls
|
|
||||||
Initialize early but delay all transformations until after your heavy computation:
|
|
||||||
```norun
|
|
||||||
import "tests/inputs/cube.step" as cube // 1) Read
|
|
||||||
|
|
||||||
myCube = cube // 2) Background render starts
|
|
||||||
|
|
||||||
|
|
||||||
// --- perform other operations and calculations or setup here ---
|
// --- perform other operations and calculations here ---
|
||||||
|
|
||||||
|
|
||||||
myCube
|
|
||||||
|> translate(z=10) // 3) Blocks only here
|
|
||||||
```
|
|
||||||
|
|
||||||
##### 2. Encapsulate Imports in Modules
|
|
||||||
Keep `main.kcl` free of reads and initialization; wrap them:
|
|
||||||
|
|
||||||
```norun
|
|
||||||
// imports.kcl
|
|
||||||
import "tests/inputs/cube.step" as cube // Read only
|
|
||||||
|
|
||||||
|
|
||||||
export myCube = cube // Kick off rendering
|
|
||||||
```
|
|
||||||
|
|
||||||
```norun
|
|
||||||
// main.kcl
|
|
||||||
import myCube from "imports.kcl" // Import the initialized object
|
|
||||||
|
|
||||||
|
|
||||||
// ... computations ...
|
|
||||||
|
|
||||||
|
|
||||||
myCube
|
|
||||||
|> translate(z=10) // Blocking call at the end
|
|
||||||
```
|
|
||||||
|
|
||||||
##### 3. Avoid Immediate Method Calls
|
|
||||||
|
|
||||||
```norun
|
|
||||||
import "tests/inputs/cube.step" as cube
|
|
||||||
|
|
||||||
cube
|
cube
|
||||||
|> translate(z=10) // Blocks immediately, negating parallelism
|
|> translate(z=10) // 2) Blocks only here
|
||||||
```
|
```
|
||||||
|
|
||||||
Both calling methods right on `cube` immediately or leaving an implicit import without assignment introduce blocking.
|
#### 2. Split heavy work into separate modules
|
||||||
|
|
||||||
#### Future Improvements
|
Place computationally expensive or IO‑heavy work into its own module so it can render in parallel while `main.kcl` continues.
|
||||||
|
|
||||||
|
#### Future improvements
|
||||||
|
|
||||||
|
Upcoming releases will auto‑analyse dependencies and only block when truly necessary. Until then, explicit deferral will give you the best performance.
|
||||||
|
|
||||||
Upcoming releases will auto‑analyze dependencies and only block when truly necessary. Until then, explicit deferral and modular wrapping give you the best performance.
|
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -40,7 +40,7 @@ patternCircular2d(
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([.5, 25], %)
|
|> startProfile(at = [.5, 25])
|
||||||
|> line(end = [0, 5])
|
|> line(end = [0, 5])
|
||||||
|> line(end = [-1, 0])
|
|> line(end = [-1, 0])
|
||||||
|> line(end = [0, -5])
|
|> line(end = [0, -5])
|
||||||
|
@ -38,7 +38,7 @@ patternLinear3d(
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [0, 2])
|
|> line(end = [0, 2])
|
||||||
|> line(end = [3, 1])
|
|> line(end = [3, 1])
|
||||||
|> line(end = [0, -4])
|
|> line(end = [0, -4])
|
||||||
@ -54,7 +54,7 @@ example = extrude(exampleSketch, length = 1)
|
|||||||
// Pattern a whole sketch on face.
|
// Pattern a whole sketch on face.
|
||||||
size = 100
|
size = 100
|
||||||
case = startSketchOn(XY)
|
case = startSketchOn(XY)
|
||||||
|> startProfileAt([-size, -size], %)
|
|> startProfile(at = [-size, -size])
|
||||||
|> line(end = [2 * size, 0])
|
|> line(end = [2 * size, 0])
|
||||||
|> line(end = [0, 2 * size])
|
|> line(end = [0, 2 * size])
|
||||||
|> tangentialArc(endAbsolute = [-size, size])
|
|> tangentialArc(endAbsolute = [-size, size])
|
||||||
@ -85,7 +85,7 @@ patternLinear3d(
|
|||||||
// Pattern an object on a face.
|
// Pattern an object on a face.
|
||||||
size = 100
|
size = 100
|
||||||
case = startSketchOn(XY)
|
case = startSketchOn(XY)
|
||||||
|> startProfileAt([-size, -size], %)
|
|> startProfile(at = [-size, -size])
|
||||||
|> line(end = [2 * size, 0])
|
|> line(end = [2 * size, 0])
|
||||||
|> line(end = [0, 2 * size])
|
|> line(end = [0, 2 * size])
|
||||||
|> tangentialArc(endAbsolute = [-size, size])
|
|> tangentialArc(endAbsolute = [-size, size])
|
||||||
|
@ -102,7 +102,7 @@ fn cube(length, center) {
|
|||||||
p3 = [l + x, -l + y]
|
p3 = [l + x, -l + y]
|
||||||
|
|
||||||
return startSketchOn(XY)
|
return startSketchOn(XY)
|
||||||
|> startProfileAt(p0, %)
|
|> startProfile(at = p0)
|
||||||
|> line(endAbsolute = p1)
|
|> line(endAbsolute = p1)
|
||||||
|> line(endAbsolute = p2)
|
|> line(endAbsolute = p2)
|
||||||
|> line(endAbsolute = p3)
|
|> line(endAbsolute = p3)
|
||||||
@ -117,7 +117,11 @@ fn transform(i) {
|
|||||||
// Move down each time.
|
// Move down each time.
|
||||||
translate = [0, 0, -i * width],
|
translate = [0, 0, -i * width],
|
||||||
// Make the cube longer, wider and flatter each time.
|
// Make the cube longer, wider and flatter each time.
|
||||||
scale = [pow(1.1, i), pow(1.1, i), pow(0.9, i)],
|
scale = [
|
||||||
|
pow(1.1, exp = i),
|
||||||
|
pow(1.1, exp = i),
|
||||||
|
pow(0.9, exp = i)
|
||||||
|
],
|
||||||
// Turn by 15 degrees each time.
|
// Turn by 15 degrees each time.
|
||||||
rotation = { angle = 15 * i, origin = "local" }
|
rotation = { angle = 15 * i, origin = "local" }
|
||||||
}
|
}
|
||||||
@ -140,7 +144,7 @@ fn cube(length, center) {
|
|||||||
p3 = [l + x, -l + y]
|
p3 = [l + x, -l + y]
|
||||||
|
|
||||||
return startSketchOn(XY)
|
return startSketchOn(XY)
|
||||||
|> startProfileAt(p0, %)
|
|> startProfile(at = p0)
|
||||||
|> line(endAbsolute = p1)
|
|> line(endAbsolute = p1)
|
||||||
|> line(endAbsolute = p2)
|
|> line(endAbsolute = p2)
|
||||||
|> line(endAbsolute = p3)
|
|> line(endAbsolute = p3)
|
||||||
@ -174,7 +178,7 @@ t = 0.005 // taper factor [0-1)
|
|||||||
// Defines how to modify each layer of the vase.
|
// Defines how to modify each layer of the vase.
|
||||||
// Each replica is shifted up the Z axis, and has a smoothly-varying radius
|
// Each replica is shifted up the Z axis, and has a smoothly-varying radius
|
||||||
fn transform(replicaId) {
|
fn transform(replicaId) {
|
||||||
scale = r * abs(1 - (t * replicaId)) * (5 + cos(replicaId / 8))
|
scale = r * math::abs(1 - (t * replicaId)) * (5 + math::cos((replicaId / 8): number(rad)))
|
||||||
return {
|
return {
|
||||||
translate = [0, 0, replicaId * 10],
|
translate = [0, 0, replicaId * 10],
|
||||||
scale = [scale, scale, 0]
|
scale = [scale, scale, 0]
|
||||||
@ -204,7 +208,7 @@ fn transform(i) {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
startSketchOn(XY)
|
startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> polygon(
|
|> polygon(
|
||||||
radius = 10,
|
radius = 10,
|
||||||
numSides = 4,
|
numSides = 4,
|
||||||
|
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,7 @@ Extract the provided 2-dimensional sketch's profile's origin value.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
profileStart(sketch: Sketch): [number]
|
profileStart(profile: Sketch): [number]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ profileStart(sketch: Sketch): [number]
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
| `profile` | [`Sketch`](/docs/kcl/types/Sketch) | Profile whose start is being used | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ profileStart(sketch: Sketch): [number]
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
sketch001 = startSketchOn(XY)
|
sketch001 = startSketchOn(XY)
|
||||||
|> startProfileAt([5, 2], %)
|
|> startProfile(at = [5, 2])
|
||||||
|> angledLine(angle = 120, length = 50, tag = $seg01)
|
|> angledLine(angle = 120, length = 50, tag = $seg01)
|
||||||
|> angledLine(angle = segAng(seg01) + 120, length = 50)
|
|> angledLine(angle = segAng(seg01) + 120, length = 50)
|
||||||
|> line(end = profileStart(%))
|
|> line(end = profileStart(%))
|
||||||
|
@ -9,7 +9,7 @@ Extract the provided 2-dimensional sketch's profile's origin's 'x' value.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
profileStartX(sketch: Sketch): number
|
profileStartX(profile: Sketch): number
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ profileStartX(sketch: Sketch): number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
| `profile` | [`Sketch`](/docs/kcl/types/Sketch) | Profile whose start is being used | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ profileStartX(sketch: Sketch): number
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
sketch001 = startSketchOn(XY)
|
sketch001 = startSketchOn(XY)
|
||||||
|> startProfileAt([5, 2], %)
|
|> startProfile(at = [5, 2])
|
||||||
|> angledLine(angle = -26.6, length = 50)
|
|> angledLine(angle = -26.6, length = 50)
|
||||||
|> angledLine(angle = 90, length = 50)
|
|> angledLine(angle = 90, length = 50)
|
||||||
|> angledLine(angle = 30, endAbsoluteX = profileStartX(%))
|
|> angledLine(angle = 30, endAbsoluteX = profileStartX(%))
|
||||||
|
@ -9,7 +9,7 @@ Extract the provided 2-dimensional sketch's profile's origin's 'y' value.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
profileStartY(sketch: Sketch): number
|
profileStartY(profile: Sketch): number
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ profileStartY(sketch: Sketch): number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
| `profile` | [`Sketch`](/docs/kcl/types/Sketch) | Profile whose start is being used | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ profileStartY(sketch: Sketch): number
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
sketch001 = startSketchOn(XY)
|
sketch001 = startSketchOn(XY)
|
||||||
|> startProfileAt([5, 2], %)
|
|> startProfile(at = [5, 2])
|
||||||
|> angledLine(angle = -60, length = 14)
|
|> angledLine(angle = -60, length = 14)
|
||||||
|> angledLine(angle = 30, endAbsoluteY = profileStartY(%))
|
|> angledLine(angle = 30, endAbsoluteY = profileStartY(%))
|
||||||
```
|
```
|
||||||
|
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
@ -63,7 +63,7 @@ rotate(
|
|||||||
|
|
||||||
// Create a path for the sweep.
|
// Create a path for the sweep.
|
||||||
sweepPath = startSketchOn(XZ)
|
sweepPath = startSketchOn(XZ)
|
||||||
|> startProfileAt([0.05, 0.05], %)
|
|> startProfile(at = [0.05, 0.05])
|
||||||
|> line(end = [0, 7])
|
|> line(end = [0, 7])
|
||||||
|> tangentialArc(angle = 90, radius = 5)
|
|> tangentialArc(angle = 90, radius = 5)
|
||||||
|> line(end = [-3, 0])
|
|> line(end = [-3, 0])
|
||||||
@ -76,7 +76,7 @@ pipeHole = startSketchOn(XY)
|
|||||||
|
|
||||||
sweepSketch = startSketchOn(XY)
|
sweepSketch = startSketchOn(XY)
|
||||||
|> circle(center = [0, 0], radius = 2)
|
|> circle(center = [0, 0], radius = 2)
|
||||||
|> hole(pipeHole, %)
|
|> subtract2d(tool = pipeHole)
|
||||||
|> sweep(path = sweepPath)
|
|> sweep(path = sweepPath)
|
||||||
|> rotate(roll = 10, pitch = 10, yaw = 90)
|
|> rotate(roll = 10, pitch = 10, yaw = 90)
|
||||||
```
|
```
|
||||||
@ -88,7 +88,7 @@ sweepSketch = startSketchOn(XY)
|
|||||||
|
|
||||||
// Create a path for the sweep.
|
// Create a path for the sweep.
|
||||||
sweepPath = startSketchOn(XZ)
|
sweepPath = startSketchOn(XZ)
|
||||||
|> startProfileAt([0.05, 0.05], %)
|
|> startProfile(at = [0.05, 0.05])
|
||||||
|> line(end = [0, 7])
|
|> line(end = [0, 7])
|
||||||
|> tangentialArc(angle = 90, radius = 5)
|
|> tangentialArc(angle = 90, radius = 5)
|
||||||
|> line(end = [-3, 0])
|
|> line(end = [-3, 0])
|
||||||
@ -101,7 +101,7 @@ pipeHole = startSketchOn(XY)
|
|||||||
|
|
||||||
sweepSketch = startSketchOn(XY)
|
sweepSketch = startSketchOn(XY)
|
||||||
|> circle(center = [0, 0], radius = 2)
|
|> circle(center = [0, 0], radius = 2)
|
||||||
|> hole(pipeHole, %)
|
|> subtract2d(tool = pipeHole)
|
||||||
|> sweep(path = sweepPath)
|
|> sweep(path = sweepPath)
|
||||||
|> rotate(roll = 10)
|
|> rotate(roll = 10)
|
||||||
```
|
```
|
||||||
@ -113,7 +113,7 @@ sweepSketch = startSketchOn(XY)
|
|||||||
|
|
||||||
// Create a path for the sweep.
|
// Create a path for the sweep.
|
||||||
sweepPath = startSketchOn(XZ)
|
sweepPath = startSketchOn(XZ)
|
||||||
|> startProfileAt([0.05, 0.05], %)
|
|> startProfile(at = [0.05, 0.05])
|
||||||
|> line(end = [0, 7])
|
|> line(end = [0, 7])
|
||||||
|> tangentialArc(angle = 90, radius = 5)
|
|> tangentialArc(angle = 90, radius = 5)
|
||||||
|> line(end = [-3, 0])
|
|> line(end = [-3, 0])
|
||||||
@ -126,7 +126,7 @@ pipeHole = startSketchOn(XY)
|
|||||||
|
|
||||||
sweepSketch = startSketchOn(XY)
|
sweepSketch = startSketchOn(XY)
|
||||||
|> circle(center = [0, 0], radius = 2)
|
|> circle(center = [0, 0], radius = 2)
|
||||||
|> hole(pipeHole, %)
|
|> subtract2d(tool = pipeHole)
|
||||||
|> sweep(path = sweepPath)
|
|> sweep(path = sweepPath)
|
||||||
|> rotate(axis = [0, 0, 1.0], angle = 90)
|
|> rotate(axis = [0, 0, 1.0], angle = 90)
|
||||||
```
|
```
|
||||||
@ -150,7 +150,7 @@ cube
|
|||||||
|
|
||||||
|
|
||||||
sketch001 = startSketchOn(XY)
|
sketch001 = startSketchOn(XY)
|
||||||
rectangleSketch = startProfileAt([-200, 23.86], sketch001)
|
rectangleSketch = startProfile(sketch001, at = [-200, 23.86])
|
||||||
|> angledLine(angle = 0, length = 73.47, tag = $rectangleSegmentA001)
|
|> angledLine(angle = 0, length = 73.47, tag = $rectangleSegmentA001)
|
||||||
|> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 50.61)
|
|> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 50.61)
|
||||||
|> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
|
|> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
|
||||||
@ -160,7 +160,7 @@ rectangleSketch = startProfileAt([-200, 23.86], sketch001)
|
|||||||
circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
|
circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
|
||||||
|
|
||||||
sketch002 = startSketchOn(YZ)
|
sketch002 = startSketchOn(YZ)
|
||||||
sweepPath = startProfileAt([0, 0], sketch002)
|
sweepPath = startProfile(sketch002, at = [0, 0])
|
||||||
|> yLine(length = 231.81)
|
|> yLine(length = 231.81)
|
||||||
|> tangentialArc(radius = 80, angle = -90)
|
|> tangentialArc(radius = 80, angle = -90)
|
||||||
|> xLine(length = 384.93)
|
|> xLine(length = 384.93)
|
||||||
@ -178,7 +178,7 @@ rotate(parts, axis = [0, 0, 1.0], angle = 90)
|
|||||||
sketch001 = startSketchOn(XY)
|
sketch001 = startSketchOn(XY)
|
||||||
|
|
||||||
fn square() {
|
fn square() {
|
||||||
return startProfileAt([-10, 10], sketch001)
|
return startProfile(sketch001, at = [-10, 10])
|
||||||
|> xLine(length = 20)
|
|> xLine(length = 20)
|
||||||
|> yLine(length = -20)
|
|> yLine(length = -20)
|
||||||
|> xLine(length = -20)
|
|> xLine(length = -20)
|
||||||
|
File diff suppressed because one or more lines are too long
@ -47,7 +47,7 @@ scale(
|
|||||||
|
|
||||||
// Create a path for the sweep.
|
// Create a path for the sweep.
|
||||||
sweepPath = startSketchOn(XZ)
|
sweepPath = startSketchOn(XZ)
|
||||||
|> startProfileAt([0.05, 0.05], %)
|
|> startProfile(at = [0.05, 0.05])
|
||||||
|> line(end = [0, 7])
|
|> line(end = [0, 7])
|
||||||
|> tangentialArc(angle = 90, radius = 5)
|
|> tangentialArc(angle = 90, radius = 5)
|
||||||
|> line(end = [-3, 0])
|
|> line(end = [-3, 0])
|
||||||
@ -60,7 +60,7 @@ pipeHole = startSketchOn(XY)
|
|||||||
|
|
||||||
sweepSketch = startSketchOn(XY)
|
sweepSketch = startSketchOn(XY)
|
||||||
|> circle(center = [0, 0], radius = 2)
|
|> circle(center = [0, 0], radius = 2)
|
||||||
|> hole(pipeHole, %)
|
|> subtract2d(tool = pipeHole)
|
||||||
|> sweep(path = sweepPath)
|
|> sweep(path = sweepPath)
|
||||||
|> scale(z = 2.5)
|
|> scale(z = 2.5)
|
||||||
```
|
```
|
||||||
@ -84,7 +84,7 @@ cube
|
|||||||
|
|
||||||
|
|
||||||
sketch001 = startSketchOn(XY)
|
sketch001 = startSketchOn(XY)
|
||||||
rectangleSketch = startProfileAt([-200, 23.86], sketch001)
|
rectangleSketch = startProfile(sketch001, at = [-200, 23.86])
|
||||||
|> angledLine(angle = 0, length = 73.47, tag = $rectangleSegmentA001)
|
|> angledLine(angle = 0, length = 73.47, tag = $rectangleSegmentA001)
|
||||||
|> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 50.61)
|
|> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 50.61)
|
||||||
|> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
|
|> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
|
||||||
@ -94,7 +94,7 @@ rectangleSketch = startProfileAt([-200, 23.86], sketch001)
|
|||||||
circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
|
circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
|
||||||
|
|
||||||
sketch002 = startSketchOn(YZ)
|
sketch002 = startSketchOn(YZ)
|
||||||
sweepPath = startProfileAt([0, 0], sketch002)
|
sweepPath = startProfile(sketch002, at = [0, 0])
|
||||||
|> yLine(length = 231.81)
|
|> yLine(length = 231.81)
|
||||||
|> tangentialArc(radius = 80, angle = -90)
|
|> tangentialArc(radius = 80, angle = -90)
|
||||||
|> xLine(length = 384.93)
|
|> xLine(length = 384.93)
|
||||||
|
@ -28,7 +28,7 @@ segAng(tag: TagIdentifier): number
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [10, 0])
|
|> line(end = [10, 0])
|
||||||
|> line(end = [5, 10], tag = $seg01)
|
|> line(end = [5, 10], tag = $seg01)
|
||||||
|> line(end = [-10, 0])
|
|> line(end = [-10, 0])
|
||||||
|
@ -29,7 +29,7 @@ segEnd(tag: TagIdentifier): [number]
|
|||||||
```js
|
```js
|
||||||
w = 15
|
w = 15
|
||||||
cube = startSketchOn(XY)
|
cube = startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [w, 0], tag = $line1)
|
|> line(end = [w, 0], tag = $line1)
|
||||||
|> line(end = [0, w], tag = $line2)
|
|> line(end = [0, w], tag = $line2)
|
||||||
|> line(end = [-w, 0], tag = $line3)
|
|> line(end = [-w, 0], tag = $line3)
|
||||||
@ -39,7 +39,7 @@ cube = startSketchOn(XY)
|
|||||||
|
|
||||||
fn cylinder(radius, tag) {
|
fn cylinder(radius, tag) {
|
||||||
return startSketchOn(XY)
|
return startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> circle(radius = radius, center = segEnd(tag))
|
|> circle(radius = radius, center = segEnd(tag))
|
||||||
|> extrude(length = radius)
|
|> extrude(length = radius)
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ segEndX(tag: TagIdentifier): number
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [20, 0], tag = $thing)
|
|> line(end = [20, 0], tag = $thing)
|
||||||
|> line(end = [0, 5])
|
|> line(end = [0, 5])
|
||||||
|> line(end = [segEndX(thing), 0])
|
|> line(end = [segEndX(thing), 0])
|
||||||
|
@ -28,7 +28,7 @@ segEndY(tag: TagIdentifier): number
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [20, 0])
|
|> line(end = [20, 0])
|
||||||
|> line(end = [0, 3], tag = $thing)
|
|> line(end = [0, 3], tag = $thing)
|
||||||
|> line(end = [-10, 0])
|
|> line(end = [-10, 0])
|
||||||
|
@ -28,7 +28,7 @@ segLen(tag: TagIdentifier): number
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> angledLine(angle = 60, length = 10, tag = $thing)
|
|> angledLine(angle = 60, length = 10, tag = $thing)
|
||||||
|> tangentialArc(angle = -120, radius = 5)
|
|> tangentialArc(angle = -120, radius = 5)
|
||||||
|> angledLine(angle = -60, length = segLen(thing))
|
|> angledLine(angle = -60, length = segLen(thing))
|
||||||
|
@ -29,7 +29,7 @@ segStart(tag: TagIdentifier): [number]
|
|||||||
```js
|
```js
|
||||||
w = 15
|
w = 15
|
||||||
cube = startSketchOn(XY)
|
cube = startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [w, 0], tag = $line1)
|
|> line(end = [w, 0], tag = $line1)
|
||||||
|> line(end = [0, w], tag = $line2)
|
|> line(end = [0, w], tag = $line2)
|
||||||
|> line(end = [-w, 0], tag = $line3)
|
|> line(end = [-w, 0], tag = $line3)
|
||||||
@ -39,7 +39,7 @@ cube = startSketchOn(XY)
|
|||||||
|
|
||||||
fn cylinder(radius, tag) {
|
fn cylinder(radius, tag) {
|
||||||
return startSketchOn(XY)
|
return startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> circle(radius = radius, center = segStart(tag))
|
|> circle(radius = radius, center = segStart(tag))
|
||||||
|> extrude(length = radius)
|
|> extrude(length = radius)
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ segStartX(tag: TagIdentifier): number
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [20, 0], tag = $thing)
|
|> line(end = [20, 0], tag = $thing)
|
||||||
|> line(end = [0, 5])
|
|> line(end = [0, 5])
|
||||||
|> line(end = [20 - segStartX(thing), 0])
|
|> line(end = [20 - segStartX(thing), 0])
|
||||||
|
@ -28,7 +28,7 @@ segStartY(tag: TagIdentifier): number
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [20, 0])
|
|> line(end = [20, 0])
|
||||||
|> line(end = [0, 3], tag = $thing)
|
|> line(end = [0, 3], tag = $thing)
|
||||||
|> line(end = [-10, 0])
|
|> line(end = [-10, 0])
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
74
docs/kcl/startProfile.md
Normal file
74
docs/kcl/startProfile.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
@ -40,7 +40,7 @@ startSketchOn(
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XY)
|
exampleSketch = startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [10, 0])
|
|> line(end = [10, 0])
|
||||||
|> line(end = [0, 10])
|
|> line(end = [0, 10])
|
||||||
|> line(end = [-10, 0])
|
|> line(end = [-10, 0])
|
||||||
@ -49,7 +49,7 @@ exampleSketch = startSketchOn(XY)
|
|||||||
example = extrude(exampleSketch, length = 5)
|
example = extrude(exampleSketch, length = 5)
|
||||||
|
|
||||||
exampleSketch002 = startSketchOn(example, face = END)
|
exampleSketch002 = startSketchOn(example, face = END)
|
||||||
|> startProfileAt([1, 1], %)
|
|> startProfile(at = [1, 1])
|
||||||
|> line(end = [8, 0])
|
|> line(end = [8, 0])
|
||||||
|> line(end = [0, 8])
|
|> line(end = [0, 8])
|
||||||
|> line(end = [-8, 0])
|
|> line(end = [-8, 0])
|
||||||
@ -58,7 +58,7 @@ exampleSketch002 = startSketchOn(example, face = END)
|
|||||||
example002 = extrude(exampleSketch002, length = 5)
|
example002 = extrude(exampleSketch002, length = 5)
|
||||||
|
|
||||||
exampleSketch003 = startSketchOn(example002, face = END)
|
exampleSketch003 = startSketchOn(example002, face = END)
|
||||||
|> startProfileAt([2, 2], %)
|
|> startProfile(at = [2, 2])
|
||||||
|> line(end = [6, 0])
|
|> line(end = [6, 0])
|
||||||
|> line(end = [0, 6])
|
|> line(end = [0, 6])
|
||||||
|> line(end = [-6, 0])
|
|> line(end = [-6, 0])
|
||||||
@ -74,7 +74,7 @@ example003 = extrude(exampleSketch003, length = 5)
|
|||||||
|
|
||||||
|
|
||||||
exampleSketch = startSketchOn(XY)
|
exampleSketch = startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [10, 0])
|
|> line(end = [10, 0])
|
||||||
|> line(end = [0, 10])
|
|> line(end = [0, 10])
|
||||||
|> line(end = [-10, 0])
|
|> line(end = [-10, 0])
|
||||||
@ -83,7 +83,7 @@ exampleSketch = startSketchOn(XY)
|
|||||||
example = extrude(exampleSketch, length = 5, tagEnd = $end01)
|
example = extrude(exampleSketch, length = 5, tagEnd = $end01)
|
||||||
|
|
||||||
exampleSketch002 = startSketchOn(example, face = end01)
|
exampleSketch002 = startSketchOn(example, face = end01)
|
||||||
|> startProfileAt([1, 1], %)
|
|> startProfile(at = [1, 1])
|
||||||
|> line(end = [8, 0])
|
|> line(end = [8, 0])
|
||||||
|> line(end = [0, 8])
|
|> line(end = [0, 8])
|
||||||
|> line(end = [-8, 0])
|
|> line(end = [-8, 0])
|
||||||
@ -92,7 +92,7 @@ exampleSketch002 = startSketchOn(example, face = end01)
|
|||||||
example002 = extrude(exampleSketch002, length = 5, tagEnd = $end02)
|
example002 = extrude(exampleSketch002, length = 5, tagEnd = $end02)
|
||||||
|
|
||||||
exampleSketch003 = startSketchOn(example002, face = end02)
|
exampleSketch003 = startSketchOn(example002, face = end02)
|
||||||
|> startProfileAt([2, 2], %)
|
|> startProfile(at = [2, 2])
|
||||||
|> line(end = [6, 0])
|
|> line(end = [6, 0])
|
||||||
|> line(end = [0, 6])
|
|> line(end = [0, 6])
|
||||||
|> line(end = [-6, 0])
|
|> line(end = [-6, 0])
|
||||||
@ -105,7 +105,7 @@ example003 = extrude(exampleSketch003, length = 5)
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XY)
|
exampleSketch = startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [10, 0])
|
|> line(end = [10, 0])
|
||||||
|> line(end = [0, 10], tag = $sketchingFace)
|
|> line(end = [0, 10], tag = $sketchingFace)
|
||||||
|> line(end = [-10, 0])
|
|> line(end = [-10, 0])
|
||||||
@ -114,7 +114,7 @@ exampleSketch = startSketchOn(XY)
|
|||||||
example = extrude(exampleSketch, length = 10)
|
example = extrude(exampleSketch, length = 10)
|
||||||
|
|
||||||
exampleSketch002 = startSketchOn(example, face = sketchingFace)
|
exampleSketch002 = startSketchOn(example, face = sketchingFace)
|
||||||
|> startProfileAt([1, 1], %)
|
|> startProfile(at = [1, 1])
|
||||||
|> line(end = [8, 0])
|
|> line(end = [8, 0])
|
||||||
|> line(end = [0, 8])
|
|> line(end = [0, 8])
|
||||||
|> line(end = [-8, 0])
|
|> line(end = [-8, 0])
|
||||||
@ -123,7 +123,7 @@ exampleSketch002 = startSketchOn(example, face = sketchingFace)
|
|||||||
example002 = extrude(exampleSketch002, length = 10)
|
example002 = extrude(exampleSketch002, length = 10)
|
||||||
|
|
||||||
exampleSketch003 = startSketchOn(example002, face = sketchingFace002)
|
exampleSketch003 = startSketchOn(example002, face = sketchingFace002)
|
||||||
|> startProfileAt([-8, 12], %)
|
|> startProfile(at = [-8, 12])
|
||||||
|> line(end = [0, 6])
|
|> line(end = [0, 6])
|
||||||
|> line(end = [6, 0])
|
|> line(end = [6, 0])
|
||||||
|> line(end = [0, -6])
|
|> line(end = [0, -6])
|
||||||
@ -136,7 +136,7 @@ example003 = extrude(exampleSketch003, length = 5)
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XY)
|
exampleSketch = startSketchOn(XY)
|
||||||
|> startProfileAt([4, 12], %)
|
|> startProfile(at = [4, 12])
|
||||||
|> line(end = [2, 0])
|
|> line(end = [2, 0])
|
||||||
|> line(end = [0, -6])
|
|> line(end = [0, -6])
|
||||||
|> line(end = [4, -6])
|
|> line(end = [4, -6])
|
||||||
@ -149,7 +149,7 @@ exampleSketch = startSketchOn(XY)
|
|||||||
example = revolve(exampleSketch, axis = Y, angle = 180)
|
example = revolve(exampleSketch, axis = Y, angle = 180)
|
||||||
|
|
||||||
exampleSketch002 = startSketchOn(example, face = END)
|
exampleSketch002 = startSketchOn(example, face = END)
|
||||||
|> startProfileAt([4.5, -5], %)
|
|> startProfile(at = [4.5, -5])
|
||||||
|> line(end = [0, 5])
|
|> line(end = [0, 5])
|
||||||
|> line(end = [5, 0])
|
|> line(end = [5, 0])
|
||||||
|> line(end = [0, -5])
|
|> line(end = [0, -5])
|
||||||
@ -165,7 +165,7 @@ example002 = extrude(exampleSketch002, length = 5)
|
|||||||
|
|
||||||
|
|
||||||
exampleSketch = startSketchOn(XY)
|
exampleSketch = startSketchOn(XY)
|
||||||
|> startProfileAt([4, 12], %)
|
|> startProfile(at = [4, 12])
|
||||||
|> line(end = [2, 0])
|
|> line(end = [2, 0])
|
||||||
|> line(end = [0, -6])
|
|> line(end = [0, -6])
|
||||||
|> line(end = [4, -6])
|
|> line(end = [4, -6])
|
||||||
@ -183,7 +183,7 @@ example = revolve(
|
|||||||
)
|
)
|
||||||
|
|
||||||
exampleSketch002 = startSketchOn(example, face = end01)
|
exampleSketch002 = startSketchOn(example, face = end01)
|
||||||
|> startProfileAt([4.5, -5], %)
|
|> startProfile(at = [4.5, -5])
|
||||||
|> line(end = [0, 5])
|
|> line(end = [0, 5])
|
||||||
|> line(end = [5, 0])
|
|> line(end = [5, 0])
|
||||||
|> line(end = [0, -5])
|
|> line(end = [0, -5])
|
||||||
@ -201,7 +201,7 @@ a1 = startSketchOn({
|
|||||||
yAxis = { x = 0, y = 1, z = 0 },
|
yAxis = { x = 0, y = 1, z = 0 },
|
||||||
zAxis = { x = 0, y = 0, z = 1 }
|
zAxis = { x = 0, y = 0, z = 1 }
|
||||||
})
|
})
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [100.0, 0])
|
|> line(end = [100.0, 0])
|
||||||
|> yLine(length = -100.0)
|
|> yLine(length = -100.0)
|
||||||
|> xLine(length = -100.0)
|
|> xLine(length = -100.0)
|
||||||
|
@ -26,7 +26,7 @@ helix(
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `revolutions` | `number(_)` | Number of revolutions. | Yes |
|
| `revolutions` | `number(_)` | Number of revolutions. | Yes |
|
||||||
| `angleStart` | `number(Angle)` | Start angle (in degrees). | Yes |
|
| `angleStart` | `number(Angle)` | Start angle. | Yes |
|
||||||
| `ccw` | [`bool`](/docs/kcl/types/bool) | Is the helix rotation counter clockwise? The default is `false`. | No |
|
| `ccw` | [`bool`](/docs/kcl/types/bool) | Is the helix rotation counter clockwise? The default is `false`. | No |
|
||||||
| `radius` | `number(Length)` | Radius of the helix. | No |
|
| `radius` | `number(Length)` | Radius of the helix. | No |
|
||||||
| `axis` | `Axis3d | Edge` | Axis to use for the helix. | No |
|
| `axis` | `Axis3d | Edge` | Axis to use for the helix. | No |
|
||||||
@ -62,7 +62,7 @@ springSketch = startSketchOn(YZ)
|
|||||||
```js
|
```js
|
||||||
// Create a helix around an edge.
|
// Create a helix around an edge.
|
||||||
helper001 = startSketchOn(XZ)
|
helper001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfile(at = [0, 0])
|
||||||
|> line(end = [0, 10], tag = $edge001)
|
|> line(end = [0, 10], tag = $edge001)
|
||||||
|
|
||||||
helixPath = helix(
|
helixPath = helix(
|
||||||
@ -108,7 +108,7 @@ springSketch = startSketchOn(XY)
|
|||||||
// Create a helix on a cylinder.
|
// Create a helix on a cylinder.
|
||||||
|
|
||||||
part001 = startSketchOn(XY)
|
part001 = startSketchOn(XY)
|
||||||
|> circle( center= [5, 5], radius= 10 )
|
|> circle( center = [5, 5], radius= 10 )
|
||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
|
|
||||||
helix(
|
helix(
|
||||||
|
51
docs/kcl/std-math-abs.md
Normal file
51
docs/kcl/std-math-abs.md
Normal file
File diff suppressed because one or more lines are too long
45
docs/kcl/std-math-acos.md
Normal file
45
docs/kcl/std-math-acos.md
Normal file
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