Compare commits
1 Commits
kcl-62
...
achalmers/
Author | SHA1 | Date | |
---|---|---|---|
7711bf768c |
@ -1,3 +1,3 @@
|
|||||||
[codespell]
|
[codespell]
|
||||||
ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,atleast,ue,afterall,ser,fromM,FromM
|
ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,atleast,ue,afterall,ser,fromM,FromM
|
||||||
skip: **/target,node_modules,build,dist,./out,**/Cargo.lock,./docs/kcl/*.md,.package-lock.json,**/package-lock.json,./openapi/*.json,./packages/codemirror-lang-kcl/test/all.test.ts,./public/kcl-samples,./rust/kcl-lib/tests/kcl_samples,tsconfig.tsbuildinfo,./src/lib/machine-api.d.ts
|
skip: **/target,node_modules,build,dist,./out,**/Cargo.lock,./docs/kcl/*.md,.yarn.lock,**/yarn.lock,./openapi/*.json,./packages/codemirror-lang-kcl/test/all.test.ts,./public/kcl-samples,./rust/kcl-lib/tests/kcl_samples,tsconfig.tsbuildinfo
|
||||||
|
12
.github/ci-cd-scripts/playwright-electron.sh
vendored
12
.github/ci-cd-scripts/playwright-electron.sh
vendored
@ -7,11 +7,11 @@ if [[ ! -f "test-results/.last-run.json" ]]; then
|
|||||||
# If no last run artifact, than run Playwright normally
|
# If no last run artifact, than run Playwright normally
|
||||||
echo "run playwright normally"
|
echo "run playwright normally"
|
||||||
if [[ "$3" == *ubuntu* ]]; then
|
if [[ "$3" == *ubuntu* ]]; then
|
||||||
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:playwright:electron:ubuntu -- --shard=$1/$2 || true
|
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:playwright:electron:ubuntu -- --shard=$1/$2 || true
|
||||||
elif [[ "$3" == *windows* ]]; then
|
elif [[ "$3" == *windows* ]]; then
|
||||||
npm run test:playwright:electron:windows -- --shard=$1/$2 || true
|
yarn test:playwright:electron:windows -- --shard=$1/$2 || true
|
||||||
elif [[ "$3" == *macos* ]]; then
|
elif [[ "$3" == *macos* ]]; then
|
||||||
npm run test:playwright:electron:macos -- --shard=$1/$2 || true
|
yarn test:playwright:electron:macos -- --shard=$1/$2 || true
|
||||||
else
|
else
|
||||||
echo "Do not run Playwright. Unable to detect os runtime."
|
echo "Do not run Playwright. Unable to detect os runtime."
|
||||||
exit 1
|
exit 1
|
||||||
@ -31,11 +31,11 @@ while [[ $retry -le $max_retries ]]; do
|
|||||||
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
|
||||||
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:playwright:electron:ubuntu -- --last-failed || true
|
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:playwright:electron:ubuntu -- --last-failed || true
|
||||||
elif [[ "$3" == *windows* ]]; then
|
elif [[ "$3" == *windows* ]]; then
|
||||||
npm run test:playwright:electron:windows -- --last-failed || true
|
yarn test:playwright:electron:windows -- --last-failed || true
|
||||||
elif [[ "$3" == *macos* ]]; then
|
elif [[ "$3" == *macos* ]]; then
|
||||||
npm run test:playwright:electron:macos -- --last-failed || true
|
yarn test:playwright:electron:macos -- --last-failed || true
|
||||||
else
|
else
|
||||||
echo "Do not run playwright. Unable to detect os runtime."
|
echo "Do not run playwright. Unable to detect os runtime."
|
||||||
exit 1
|
exit 1
|
||||||
|
6
.github/workflows/build-and-store-wasm.yml
vendored
6
.github/workflows/build-and-store-wasm.yml
vendored
@ -13,9 +13,9 @@ jobs:
|
|||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'yarn'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm install
|
run: yarn
|
||||||
- name: Use correct Rust toolchain
|
- name: Use correct Rust toolchain
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@ -32,7 +32,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
workspaces: rust
|
workspaces: rust
|
||||||
- name: build wasm
|
- name: build wasm
|
||||||
run: npm run build:wasm
|
run: yarn build:wasm
|
||||||
|
|
||||||
|
|
||||||
# Upload the WASM bundle as an artifact
|
# Upload the WASM bundle as an artifact
|
||||||
|
56
.github/workflows/build-apps.yml
vendored
56
.github/workflows/build-apps.yml
vendored
@ -29,9 +29,9 @@ jobs:
|
|||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'yarn'
|
||||||
|
|
||||||
- run: npm install
|
- run: yarn install
|
||||||
|
|
||||||
- id: filter
|
- id: filter
|
||||||
name: Check for Rust changes
|
name: Check for Rust changes
|
||||||
@ -90,20 +90,20 @@ jobs:
|
|||||||
|
|
||||||
- name: Run build:wasm
|
- name: Run build:wasm
|
||||||
if: ${{ steps.wasm.outputs.should-build-wasm == 'true' }}
|
if: ${{ steps.wasm.outputs.should-build-wasm == 'true' }}
|
||||||
run: "npm run build:wasm"
|
run: "yarn build:wasm"
|
||||||
|
|
||||||
- name: Set nightly version, product name, release notes, and icons
|
- name: Set nightly version, product name, release notes, and icons
|
||||||
if: ${{ env.IS_NIGHTLY == 'true' }}
|
if: ${{ env.IS_NIGHTLY == 'true' }}
|
||||||
run: |
|
run: |
|
||||||
export VERSION=${GITHUB_REF_NAME#nightly-v}
|
export VERSION=${GITHUB_REF_NAME#nightly-v}
|
||||||
npm run files:set-version
|
yarn files:set-version
|
||||||
npm run files:flip-to-nightly
|
yarn files:flip-to-nightly
|
||||||
|
|
||||||
- name: Set release version
|
- name: Set release version
|
||||||
if: ${{ env.IS_RELEASE == 'true' }}
|
if: ${{ env.IS_RELEASE == 'true' }}
|
||||||
run: |
|
run: |
|
||||||
export VERSION=${GITHUB_REF_NAME#v}
|
export VERSION=${GITHUB_REF_NAME#v}
|
||||||
npm run files:set-version
|
yarn files:set-version
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -172,9 +172,16 @@ jobs:
|
|||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm' # Set this to npm, npm or pnpm.
|
cache: 'yarn' # Set this to npm, yarn or pnpm.
|
||||||
|
|
||||||
- run: npm install
|
- name: yarn install
|
||||||
|
# Windows is picky sometimes and fails on fetch. Step takes about ~30s
|
||||||
|
uses: nick-fields/retry@v3.0.2
|
||||||
|
with:
|
||||||
|
shell: bash
|
||||||
|
timeout_minutes: 2
|
||||||
|
max_attempts: 3
|
||||||
|
command: yarn install
|
||||||
|
|
||||||
- name: Prepare certificate and variables (Windows only)
|
- name: Prepare certificate and variables (Windows only)
|
||||||
if: ${{ (env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true') && matrix.os == 'windows-2022' }}
|
if: ${{ (env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true') && matrix.os == 'windows-2022' }}
|
||||||
@ -200,20 +207,13 @@ jobs:
|
|||||||
smctl.exe keypair ls
|
smctl.exe keypair ls
|
||||||
C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user
|
C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user
|
||||||
smksp_cert_sync.exe
|
smksp_cert_sync.exe
|
||||||
smctl windows certsync
|
|
||||||
# This last line `smctl windows certsync` was added after windows codesign failures started happening
|
|
||||||
# with nightly-v25.4.10. It looks like `smksp_cert_sync.exe` used to do the sync to the local cert store,
|
|
||||||
# but stopped doing it overnight. This extra call that I randomly got from this azure-related doc page
|
|
||||||
# https://docs.digicert.com/en/digicert-keylocker/code-signing/sign-with-third-party-signing-tools/windows-applications/sign-azure-apps-with-signtool-using-ksp-library.html#sync-certificates--windows-only--618365
|
|
||||||
# seems to be doing that extra sync that we need for scripts/sign-win.js to work.
|
|
||||||
# TODO: we still need to make sign-win.js errors fail the workflow, see issue #6276
|
|
||||||
shell: cmd
|
shell: cmd
|
||||||
|
|
||||||
- name: Build the app (debug)
|
- name: Build the app (debug)
|
||||||
if: ${{ env.IS_RELEASE == 'false' && env.IS_NIGHTLY == 'false' }}
|
if: ${{ env.IS_RELEASE == 'false' && env.IS_NIGHTLY == 'false' }}
|
||||||
# electron-builder doesn't have a concept of release vs debug,
|
# electron-builder doesn't have a concept of release vs debug,
|
||||||
# this is just not doing any codesign or release yml generation, and points to dev infra
|
# this is just not doing any codesign or release yml generation, and points to dev infra
|
||||||
run: npm run tronb:package:dev
|
run: yarn tronb:package:dev
|
||||||
|
|
||||||
- name: Build the app (release)
|
- name: Build the app (release)
|
||||||
if: ${{ env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true' }}
|
if: ${{ env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true' }}
|
||||||
@ -226,7 +226,14 @@ jobs:
|
|||||||
CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
||||||
CSC_KEYCHAIN: ${{ secrets.APPLE_SIGNING_IDENTITY }}
|
CSC_KEYCHAIN: ${{ secrets.APPLE_SIGNING_IDENTITY }}
|
||||||
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
|
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
|
||||||
run: npm run tronb:package:prod
|
DEBUG: "electron-notarize*"
|
||||||
|
# TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures
|
||||||
|
uses: nick-fields/retry@v3.0.2
|
||||||
|
with:
|
||||||
|
shell: bash
|
||||||
|
timeout_minutes: 10
|
||||||
|
max_attempts: 3
|
||||||
|
command: yarn tronb:package:prod
|
||||||
|
|
||||||
- name: List artifacts in out/
|
- name: List artifacts in out/
|
||||||
run: ls -R out
|
run: ls -R out
|
||||||
@ -281,7 +288,14 @@ jobs:
|
|||||||
CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
||||||
CSC_KEYCHAIN: ${{ secrets.APPLE_SIGNING_IDENTITY }}
|
CSC_KEYCHAIN: ${{ secrets.APPLE_SIGNING_IDENTITY }}
|
||||||
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
|
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
|
||||||
run: npm run tronb:package:prod
|
DEBUG: "electron-notarize*"
|
||||||
|
# TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures
|
||||||
|
uses: nick-fields/retry@v3.0.2
|
||||||
|
with:
|
||||||
|
shell: bash
|
||||||
|
timeout_minutes: 10
|
||||||
|
max_attempts: 3
|
||||||
|
command: yarn tronb:package:prod
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: ${{ env.IS_RELEASE == 'true' }}
|
if: ${{ env.IS_RELEASE == 'true' }}
|
||||||
@ -364,7 +378,7 @@ jobs:
|
|||||||
NOTES: ${{ needs.prepare-files.outputs.notes }}
|
NOTES: ${{ needs.prepare-files.outputs.notes }}
|
||||||
PUB_DATE: ${{ github.event.repository.updated_at }}
|
PUB_DATE: ${{ github.event.repository.updated_at }}
|
||||||
WEBSITE_DIR: ${{ env.IS_NIGHTLY == 'true' && 'dl.zoo.dev/releases/modeling-app/nightly' || 'dl.zoo.dev/releases/modeling-app' }}
|
WEBSITE_DIR: ${{ env.IS_NIGHTLY == 'true' && 'dl.zoo.dev/releases/modeling-app/nightly' || 'dl.zoo.dev/releases/modeling-app' }}
|
||||||
URL_CODED_NAME: ${{ env.IS_NIGHTLY == 'true' && 'Zoo%20Design%20Studio%20%28Nightly%29' || 'Zoo%20Design%20Studio' }}
|
URL_CODED_NAME: ${{ env.IS_NIGHTLY == 'true' && 'Zoo%20Modeling%20App%20%28Nightly%29' || 'Zoo%20Modeling%20App' }}
|
||||||
run: |
|
run: |
|
||||||
RELEASE_DIR=https://${WEBSITE_DIR}
|
RELEASE_DIR=https://${WEBSITE_DIR}
|
||||||
jq --null-input \
|
jq --null-input \
|
||||||
@ -421,7 +435,7 @@ jobs:
|
|||||||
export TAG="nightly-${VERSION}"
|
export TAG="nightly-${VERSION}"
|
||||||
export PREVIOUS_TAG=$(git tag --list --sort=-committerdate "nightly-v[0-9]*" | head -n2 | tail -n1)
|
export PREVIOUS_TAG=$(git tag --list --sort=-committerdate "nightly-v[0-9]*" | head -n2 | tail -n1)
|
||||||
export NOTES=$(./scripts/get-nightly-changelog.sh)
|
export NOTES=$(./scripts/get-nightly-changelog.sh)
|
||||||
npm run files:set-notes
|
yarn files:set-notes
|
||||||
|
|
||||||
- name: Authenticate to Google Cloud
|
- name: Authenticate to Google Cloud
|
||||||
if: ${{ env.IS_NIGHTLY == 'true' }}
|
if: ${{ env.IS_NIGHTLY == 'true' }}
|
||||||
@ -446,4 +460,4 @@ jobs:
|
|||||||
|
|
||||||
- name: Invalidate bucket cache on latest*.yml and last_download.json files
|
- name: Invalidate bucket cache on latest*.yml and last_download.json files
|
||||||
if: ${{ env.IS_NIGHTLY == 'true' }}
|
if: ${{ env.IS_NIGHTLY == 'true' }}
|
||||||
run: npm run files:invalidate-bucket:nightly
|
run: yarn files:invalidate-bucket:nightly
|
||||||
|
3
.github/workflows/check-exampleKcl.yml
vendored
3
.github/workflows/check-exampleKcl.yml
vendored
@ -5,7 +5,6 @@ on:
|
|||||||
types: [opened, synchronize]
|
types: [opened, synchronize]
|
||||||
paths:
|
paths:
|
||||||
- 'src/lib/exampleKcl.ts'
|
- 'src/lib/exampleKcl.ts'
|
||||||
- 'public/kcl-samples/bracket/main.kcl'
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@ -23,7 +22,7 @@ jobs:
|
|||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const message = '`public/kcl-samples/bracket/main.kcl` or `src/lib/exampleKcl.ts` has been updated in this PR, please review and update the `src/routes/onboarding`, if needed.';
|
const message = '`src/lib/exampleKcl.ts` has been updated in this PR, please review and update the `src/routes/onboarding`, if needed.';
|
||||||
const issue_number = context.payload.pull_request.number;
|
const issue_number = context.payload.pull_request.number;
|
||||||
const owner = context.repo.owner;
|
const owner = context.repo.owner;
|
||||||
const repo = context.repo.repo;
|
const repo = context.repo.repo;
|
||||||
|
13
.github/workflows/codemirror-lang-kcl.yml
vendored
13
.github/workflows/codemirror-lang-kcl.yml
vendored
@ -11,7 +11,7 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
npm-unit-test:
|
yarn-unit-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@ -19,11 +19,14 @@ jobs:
|
|||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'yarn'
|
||||||
|
|
||||||
- run: npm install
|
- run: yarn install
|
||||||
|
working-directory: packages/codemirror-lang-kcl
|
||||||
|
|
||||||
- run: npm run tsc --workspace=packages/codemirror-lang-kcl
|
- run: yarn tsc
|
||||||
|
working-directory: packages/codemirror-lang-kcl
|
||||||
|
|
||||||
- name: run unit tests
|
- name: run unit tests
|
||||||
run: npm run test --workspace=packages/codemirror-lang-kcl
|
run: yarn test
|
||||||
|
working-directory: packages/codemirror-lang-kcl
|
||||||
|
38
.github/workflows/e2e-tests.yml
vendored
38
.github/workflows/e2e-tests.yml
vendored
@ -97,11 +97,11 @@ jobs:
|
|||||||
if: needs.conditions.outputs.should-run == 'true'
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'yarn'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
if: needs.conditions.outputs.should-run == 'true'
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
run: npm install
|
run: yarn
|
||||||
|
|
||||||
- name: Download Wasm Cache
|
- name: Download Wasm Cache
|
||||||
id: download-wasm
|
id: download-wasm
|
||||||
@ -154,7 +154,7 @@ jobs:
|
|||||||
- name: Build Wasm
|
- name: Build Wasm
|
||||||
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: npm run build:wasm
|
run: yarn build:wasm
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: needs.conditions.outputs.should-run == 'true'
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
@ -197,12 +197,12 @@ jobs:
|
|||||||
if: needs.conditions.outputs.should-run == 'true'
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'yarn'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
id: deps-install
|
id: deps-install
|
||||||
if: needs.conditions.outputs.should-run == 'true'
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
run: npm install
|
run: yarn
|
||||||
|
|
||||||
- name: Cache Playwright Browsers
|
- name: Cache Playwright Browsers
|
||||||
if: needs.conditions.outputs.should-run == 'true'
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
@ -210,32 +210,27 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cache/ms-playwright/
|
~/.cache/ms-playwright/
|
||||||
key: ${{ runner.os }}-playwright-${{ hashFiles('package-lock.json') }}
|
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
|
||||||
|
|
||||||
- name: Install Playwright Browsers
|
- name: Install Playwright Browsers
|
||||||
if: needs.conditions.outputs.should-run == 'true'
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
run: npm run playwright install --with-deps
|
run: yarn playwright install --with-deps
|
||||||
|
|
||||||
- name: build web
|
- name: build web
|
||||||
if: needs.conditions.outputs.should-run == 'true'
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
run: npm run tronb:vite:dev
|
run: yarn tronb:vite:dev
|
||||||
|
|
||||||
- name: Run ubuntu/chrome snapshots
|
- name: Run ubuntu/chrome snapshots
|
||||||
if: needs.conditions.outputs.should-run == 'true'
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
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
|
command: yarn test:snapshots
|
||||||
timeout_minutes: 30
|
timeout_minutes: 30
|
||||||
max_attempts: 3
|
max_attempts: 3
|
||||||
env:
|
env:
|
||||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
|
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
|
||||||
TAB_API_URL: ${{ secrets.TAB_API_URL }}
|
|
||||||
TAB_API_KEY: ${{ secrets.TAB_API_KEY }}
|
|
||||||
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
|
|
||||||
CI_PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
||||||
TARGET: web
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
|
||||||
@ -321,12 +316,12 @@ jobs:
|
|||||||
if: needs.conditions.outputs.should-run == 'true'
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'yarn'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
id: deps-install
|
id: deps-install
|
||||||
if: needs.conditions.outputs.should-run == 'true'
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
run: npm install
|
run: yarn
|
||||||
|
|
||||||
- name: Cache Playwright Browsers
|
- name: Cache Playwright Browsers
|
||||||
if: needs.conditions.outputs.should-run == 'true'
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
@ -334,15 +329,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cache/ms-playwright/
|
~/.cache/ms-playwright/
|
||||||
key: ${{ runner.os }}-playwright-${{ hashFiles('package-lock.json') }}
|
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
|
||||||
|
|
||||||
- name: Install Playwright Browsers
|
- name: Install Playwright Browsers
|
||||||
if: needs.conditions.outputs.should-run == 'true'
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
run: npm run playwright install --with-deps
|
run: yarn playwright install --with-deps
|
||||||
|
|
||||||
- name: Build web
|
- name: Build web
|
||||||
if: needs.conditions.outputs.should-run == 'true'
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
run: npm run tronb:vite:dev
|
run: yarn tronb:vite:dev
|
||||||
|
|
||||||
- name: Start Vector
|
- name: Start Vector
|
||||||
if: ${{ needs.conditions.outputs.should-run == 'true' && !contains(matrix.os, 'windows') }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && !contains(matrix.os, 'windows') }}
|
||||||
@ -370,11 +365,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
FAIL_ON_CONSOLE_ERRORS: true
|
FAIL_ON_CONSOLE_ERRORS: true
|
||||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
TAB_API_URL: ${{ secrets.TAB_API_URL }}
|
|
||||||
TAB_API_KEY: ${{ secrets.TAB_API_KEY }}
|
|
||||||
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
|
|
||||||
CI_PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
||||||
TARGET: desktop
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: ${{ needs.conditions.outputs.should-run == 'true' && always() }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && always() }}
|
||||||
|
@ -21,10 +21,10 @@ jobs:
|
|||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'yarn'
|
||||||
- run: npm install
|
- run: yarn install
|
||||||
- run: npm run generate:machine-api
|
- run: yarn generate:machine-api
|
||||||
- run: npm run fmt || true
|
- run: yarn fmt
|
||||||
- name: check for changes
|
- name: check for changes
|
||||||
id: git-check
|
id: git-check
|
||||||
run: |
|
run: |
|
||||||
|
30
.github/workflows/kcl-language-server.yml
vendored
30
.github/workflows/kcl-language-server.yml
vendored
@ -56,19 +56,21 @@ jobs:
|
|||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
npm install
|
yarn install
|
||||||
|
cd rust/kcl-language-server
|
||||||
|
yarn install
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
cd rust/kcl-language-server
|
cd rust/kcl-language-server
|
||||||
npm run build
|
yarn build
|
||||||
npm run test-compile
|
yarn test-compile
|
||||||
ls -la dist
|
ls -la dist
|
||||||
xvfb-run -a npm run test
|
xvfb-run -a yarn test
|
||||||
if: runner.os == 'Linux'
|
if: runner.os == 'Linux'
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
cd rust/kcl-language-server
|
cd rust/kcl-language-server
|
||||||
npm run test
|
yarn test
|
||||||
if: runner.os != 'Linux'
|
if: runner.os != 'Linux'
|
||||||
build-release:
|
build-release:
|
||||||
strategy:
|
strategy:
|
||||||
@ -181,20 +183,19 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
cd rust/kcl-language-server
|
cd rust/kcl-language-server
|
||||||
# npm will symlink which will cause issues w tarballing later
|
|
||||||
yarn install
|
yarn install
|
||||||
|
|
||||||
- name: Package Extension (release)
|
- name: Package Extension (release)
|
||||||
if: startsWith(github.event.ref, 'refs/tags/')
|
if: startsWith(github.event.ref, 'refs/tags/')
|
||||||
run: |
|
run: |
|
||||||
cd rust/kcl-language-server
|
cd rust/kcl-language-server
|
||||||
npx vsce package --yarn -o "../build/kcl-language-server-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }}
|
npx vsce package -o "../build/kcl-language-server-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }}
|
||||||
|
|
||||||
- name: Package Extension (nightly)
|
- name: Package Extension (nightly)
|
||||||
if: startsWith(github.event.ref, 'refs/tags/') == false
|
if: startsWith(github.event.ref, 'refs/tags/') == false
|
||||||
run: |
|
run: |
|
||||||
cd rust/kcl-language-server
|
cd rust/kcl-language-server
|
||||||
npx vsce package --yarn -o "../build/kcl-language-server-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }} --pre-release
|
npx vsce package -o "../build/kcl-language-server-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }} --pre-release
|
||||||
|
|
||||||
- name: remove server
|
- name: remove server
|
||||||
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
||||||
@ -206,13 +207,13 @@ jobs:
|
|||||||
if: matrix.target == 'x86_64-unknown-linux-gnu' && startsWith(github.event.ref, 'refs/tags/')
|
if: matrix.target == 'x86_64-unknown-linux-gnu' && startsWith(github.event.ref, 'refs/tags/')
|
||||||
run: |
|
run: |
|
||||||
cd rust/kcl-language-server
|
cd rust/kcl-language-server
|
||||||
npx vsce package --yarn -o ../build/kcl-language-server-no-server.vsix
|
npx vsce package -o ../build/kcl-language-server-no-server.vsix
|
||||||
|
|
||||||
- name: Package Extension (no server, nightly)
|
- name: Package Extension (no server, nightly)
|
||||||
if: matrix.target == 'x86_64-unknown-linux-gnu' && startsWith(github.event.ref, 'refs/tags/') == false
|
if: matrix.target == 'x86_64-unknown-linux-gnu' && startsWith(github.event.ref, 'refs/tags/') == false
|
||||||
run: |
|
run: |
|
||||||
cd rust/kcl-language-server
|
cd rust/kcl-language-server
|
||||||
npx vsce package --yarn -o ../build/kcl-language-server-no-server.vsix --pre-release
|
npx vsce package -o ../build/kcl-language-server-no-server.vsix --pre-release
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@ -243,8 +244,8 @@ jobs:
|
|||||||
lld \
|
lld \
|
||||||
musl-dev \
|
musl-dev \
|
||||||
nodejs \
|
nodejs \
|
||||||
npm \
|
yarn \
|
||||||
yarn
|
npm
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -271,20 +272,19 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
cd rust/kcl-language-server
|
cd rust/kcl-language-server
|
||||||
# npm will symlink which will cause issues w tarballing later
|
|
||||||
yarn install
|
yarn install
|
||||||
|
|
||||||
- name: Package Extension (release)
|
- name: Package Extension (release)
|
||||||
if: startsWith(github.event.ref, 'refs/tags/')
|
if: startsWith(github.event.ref, 'refs/tags/')
|
||||||
run: |
|
run: |
|
||||||
cd rust/kcl-language-server
|
cd rust/kcl-language-server
|
||||||
npx vsce package --yarn -o "../build/kcl-language-server-alpine-x64.vsix" --target alpine-x64
|
npx vsce package -o "../build/kcl-language-server-alpine-x64.vsix" --target alpine-x64
|
||||||
|
|
||||||
- name: Package Extension (release)
|
- name: Package Extension (release)
|
||||||
if: startsWith(github.event.ref, 'refs/tags/') == false
|
if: startsWith(github.event.ref, 'refs/tags/') == false
|
||||||
run: |
|
run: |
|
||||||
cd rust/kcl-language-server
|
cd rust/kcl-language-server
|
||||||
npx vsce package --yarn -o "../build/kcl-language-server-alpine-x64.vsix" --target alpine-x64 --pre-release
|
npx vsce package -o "../build/kcl-language-server-alpine-x64.vsix" --target alpine-x64 --pre-release
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
55
.github/workflows/nix.yml
vendored
55
.github/workflows/nix.yml
vendored
@ -1,55 +0,0 @@
|
|||||||
name: Test Nix Flake
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
pull_request:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
jobs:
|
|
||||||
nix-flake-check:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
|
|
||||||
- uses: cachix/install-nix-action@v31
|
|
||||||
with:
|
|
||||||
nix_path: nixpkgs=channel:nixos-unstable
|
|
||||||
|
|
||||||
- name: nix flake check for all platforms
|
|
||||||
run: |
|
|
||||||
nix flake check --all-systems
|
|
||||||
|
|
||||||
nix-build-linux:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
|
|
||||||
- uses: cachix/install-nix-action@v31
|
|
||||||
with:
|
|
||||||
nix_path: nixpkgs=channel:nixos-unstable
|
|
||||||
|
|
||||||
- name: nix build . for x86_64-linux
|
|
||||||
run: nix build .
|
|
||||||
|
|
||||||
nix-build-macos:
|
|
||||||
runs-on: macos-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
|
|
||||||
- uses: cachix/install-nix-action@v31
|
|
||||||
with:
|
|
||||||
nix_path: nixpkgs=channel:nixos-unstable
|
|
||||||
|
|
||||||
- name: nix build . for x86_64-darwin
|
|
||||||
run: nix build .
|
|
||||||
|
|
6
.github/workflows/publish-apps-release.yml
vendored
6
.github/workflows/publish-apps-release.yml
vendored
@ -19,7 +19,7 @@ jobs:
|
|||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'yarn'
|
||||||
|
|
||||||
- name: Find tag workflow id
|
- name: Find tag workflow id
|
||||||
id: tag_workflow_id
|
id: tag_workflow_id
|
||||||
@ -105,7 +105,7 @@ jobs:
|
|||||||
- name: Override release notes
|
- name: Override release notes
|
||||||
env:
|
env:
|
||||||
NOTES: ${{ github.event.release.body }}
|
NOTES: ${{ github.event.release.body }}
|
||||||
run: npm run files:set-notes
|
run: yarn files:set-notes
|
||||||
|
|
||||||
- name: Authenticate to Google Cloud
|
- name: Authenticate to Google Cloud
|
||||||
uses: 'google-github-actions/auth@v2.1.8'
|
uses: 'google-github-actions/auth@v2.1.8'
|
||||||
@ -126,7 +126,7 @@ jobs:
|
|||||||
destination: 'dl.kittycad.io/releases/modeling-app'
|
destination: 'dl.kittycad.io/releases/modeling-app'
|
||||||
|
|
||||||
- name: Invalidate bucket cache on latest*.yml and last_download.json files
|
- name: Invalidate bucket cache on latest*.yml and last_download.json files
|
||||||
run: npm run files:invalidate-bucket
|
run: yarn files:invalidate-bucket
|
||||||
|
|
||||||
- name: Upload release files to Github
|
- name: Upload release files to Github
|
||||||
if: ${{ github.event_name == 'release' }}
|
if: ${{ github.event_name == 'release' }}
|
||||||
|
74
.github/workflows/static-analysis.yml
vendored
74
.github/workflows/static-analysis.yml
vendored
@ -16,18 +16,18 @@ permissions:
|
|||||||
actions: read
|
actions: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
npm-fmt-check:
|
yarn-fmt-check:
|
||||||
runs-on: 'ubuntu-22.04'
|
runs-on: 'ubuntu-22.04'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'yarn'
|
||||||
- run: npm install
|
- run: yarn install
|
||||||
- run: npm run fmt:check
|
- run: yarn fmt-check
|
||||||
|
|
||||||
npm-build-wasm:
|
yarn-build-wasm:
|
||||||
# Build the wasm blob once on the fastest runner.
|
# Build the wasm blob once on the fastest runner.
|
||||||
runs-on: runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64
|
runs-on: runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64
|
||||||
steps:
|
steps:
|
||||||
@ -36,10 +36,10 @@ jobs:
|
|||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'yarn'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm install
|
run: yarn install
|
||||||
|
|
||||||
- name: Use correct Rust toolchain
|
- name: Use correct Rust toolchain
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -62,7 +62,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build Wasm
|
- name: Build Wasm
|
||||||
shell: bash
|
shell: bash
|
||||||
run: npm run build:wasm
|
run: yarn build:wasm
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -76,17 +76,17 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
rust/kcl-lib/bindings/*
|
rust/kcl-lib/bindings/*
|
||||||
|
|
||||||
npm-tsc:
|
yarn-tsc:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: npm-build-wasm
|
needs: yarn-build-wasm
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'yarn'
|
||||||
- run: npm install
|
- run: yarn install
|
||||||
|
|
||||||
- name: Download all artifacts
|
- name: Download all artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
@ -104,19 +104,19 @@ jobs:
|
|||||||
mkdir rust/kcl-lib/bindings
|
mkdir rust/kcl-lib/bindings
|
||||||
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
||||||
|
|
||||||
- run: npm run tsc
|
- run: yarn tsc
|
||||||
|
|
||||||
npm-lint:
|
yarn-lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: npm-build-wasm
|
needs: yarn-build-wasm
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'yarn'
|
||||||
- run: npm install
|
- run: yarn install
|
||||||
|
|
||||||
- name: Download all artifacts
|
- name: Download all artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
@ -134,19 +134,19 @@ jobs:
|
|||||||
mkdir rust/kcl-lib/bindings
|
mkdir rust/kcl-lib/bindings
|
||||||
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
||||||
|
|
||||||
- run: npm run lint
|
- run: yarn lint
|
||||||
|
|
||||||
npm-circular-dependencies:
|
yarn-circular-dependencies:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: npm-build-wasm
|
needs: yarn-build-wasm
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'yarn'
|
||||||
- run: npm install
|
- run: yarn install
|
||||||
|
|
||||||
- name: Download all artifacts
|
- name: Download all artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
@ -164,7 +164,7 @@ jobs:
|
|||||||
mkdir rust/kcl-lib/bindings
|
mkdir rust/kcl-lib/bindings
|
||||||
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
||||||
|
|
||||||
- run: npm run circular-deps:diff
|
- run: yarn circular-deps:diff
|
||||||
|
|
||||||
python-codespell:
|
python-codespell:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
@ -179,18 +179,18 @@ jobs:
|
|||||||
- name: Run codespell
|
- name: Run codespell
|
||||||
run: codespell --config .codespellrc # Edit this file to tweak the typo list and other configuration.
|
run: codespell --config .codespellrc # Edit this file to tweak the typo list and other configuration.
|
||||||
|
|
||||||
npm-unit-test-kcl-samples:
|
yarn-unit-test-kcl-samples:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: npm-build-wasm
|
needs: yarn-build-wasm
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'yarn'
|
||||||
|
|
||||||
- run: npm install
|
- run: yarn install
|
||||||
- uses: taiki-e/install-action@d4635f2de61c8b8104d59cd4aede2060638378cc
|
- uses: taiki-e/install-action@d4635f2de61c8b8104d59cd4aede2060638378cc
|
||||||
with:
|
with:
|
||||||
tool: wasm-pack
|
tool: wasm-pack
|
||||||
@ -211,31 +211,31 @@ jobs:
|
|||||||
mkdir rust/kcl-lib/bindings
|
mkdir rust/kcl-lib/bindings
|
||||||
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
||||||
|
|
||||||
- run: npm run simpleserver:bg
|
- run: yarn simpleserver:bg
|
||||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||||
|
|
||||||
- name: Install Chromium Browser
|
- name: Install Chromium Browser
|
||||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||||
run: npm run playwright install chromium --with-deps
|
run: yarn playwright install chromium --with-deps
|
||||||
|
|
||||||
- name: run unit tests for kcl samples
|
- name: run unit tests for kcl samples
|
||||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||||
run: npm run test:unit:kcl-samples
|
run: yarn test:unit:kcl-samples
|
||||||
env:
|
env:
|
||||||
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
|
|
||||||
npm-unit-test:
|
yarn-unit-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: npm-build-wasm
|
needs: yarn-build-wasm
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'yarn'
|
||||||
|
|
||||||
- run: npm install
|
- run: yarn install
|
||||||
- uses: taiki-e/install-action@d4635f2de61c8b8104d59cd4aede2060638378cc
|
- uses: taiki-e/install-action@d4635f2de61c8b8104d59cd4aede2060638378cc
|
||||||
with:
|
with:
|
||||||
tool: wasm-pack
|
tool: wasm-pack
|
||||||
@ -256,16 +256,16 @@ jobs:
|
|||||||
mkdir rust/kcl-lib/bindings
|
mkdir rust/kcl-lib/bindings
|
||||||
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
||||||
|
|
||||||
- run: npm run simpleserver:bg
|
- run: yarn simpleserver:bg
|
||||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||||
|
|
||||||
- name: Install Chromium Browser
|
- name: Install Chromium Browser
|
||||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||||
run: npm run playwright install chromium --with-deps
|
run: yarn playwright install chromium --with-deps
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||||
run: xvfb-run -a npm run test:unit
|
run: xvfb-run -a yarn test:unit
|
||||||
env:
|
env:
|
||||||
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
|
|
||||||
|
2
.github/workflows/tag-nightly.yml
vendored
2
.github/workflows/tag-nightly.yml
vendored
@ -27,7 +27,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
|
|
||||||
- run: npm install
|
- run: yarn install
|
||||||
|
|
||||||
- name: Push tag
|
- name: Push tag
|
||||||
run: |
|
run: |
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -26,12 +26,10 @@ yarn-error.log*
|
|||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
.helix
|
.helix
|
||||||
result
|
|
||||||
|
|
||||||
# rust
|
# rust
|
||||||
rust/target
|
rust/target
|
||||||
rust/kcl-lib/bindings
|
rust/kcl-lib/bindings
|
||||||
rust/kcl-language-server/server
|
|
||||||
public/kcl_wasm_lib_bg.wasm
|
public/kcl_wasm_lib_bg.wasm
|
||||||
rust/lcov.info
|
rust/lcov.info
|
||||||
rust/kcl-wasm-lib/pkg
|
rust/kcl-wasm-lib/pkg
|
||||||
@ -84,4 +82,3 @@ dist
|
|||||||
venv
|
venv
|
||||||
|
|
||||||
.vscode-test
|
.vscode-test
|
||||||
.biome/
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
. "$(dirname -- "$0")/_/husky.sh"
|
. "$(dirname -- "$0")/_/husky.sh"
|
||||||
|
|
||||||
npm run fmt-check
|
yarn fmt-check
|
||||||
|
76
Makefile
76
Makefile
@ -5,38 +5,36 @@ all: install build check
|
|||||||
# INSTALL
|
# INSTALL
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
export WINDOWS := true
|
CARGO ?= ~/.cargo/bin/cargo.exe
|
||||||
ifndef MSYSTEM
|
WASM_PACK ?= ~/.cargo/bin/wasm-pack.exe
|
||||||
export POWERSHELL := true
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef WINDOWS
|
|
||||||
CARGO ?= $(USERPROFILE)/.cargo/bin/cargo.exe
|
|
||||||
WASM_PACK ?= $(USERPROFILE)/.cargo/bin/wasm-pack.exe
|
|
||||||
else
|
else
|
||||||
CARGO ?= ~/.cargo/bin/cargo
|
CARGO ?= ~/.cargo/bin/cargo
|
||||||
WASM_PACK ?= ~/.cargo/bin/wasm-pack
|
WASM_PACK ?= ~/.cargo/bin/wasm-pack
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: node_modules/.package-lock.json $(CARGO) $(WASM_PACK) ## Install dependencies
|
install: node_modules/.yarn-integrity $(CARGO) $(WASM_PACK) ## Install dependencies
|
||||||
|
|
||||||
node_modules/.package-lock.json: package.json package-lock.json
|
node_modules/.yarn-integrity: package.json yarn.lock
|
||||||
npm install
|
yarn install
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
@ type nul > $@
|
||||||
|
else
|
||||||
|
@ touch $@
|
||||||
|
endif
|
||||||
|
|
||||||
$(CARGO):
|
$(CARGO):
|
||||||
ifdef WINDOWS
|
ifeq ($(OS),Windows_NT)
|
||||||
npm run install:rust:windows
|
yarn install:rust:windows
|
||||||
else
|
else
|
||||||
npm run install:rust
|
yarn install:rust
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(WASM_PACK):
|
$(WASM_PACK):
|
||||||
ifdef WINDOWS
|
ifeq ($(OS),Windows_NT)
|
||||||
npm run install:wasm-pack:cargo
|
yarn install:wasm-pack:cargo
|
||||||
else
|
else
|
||||||
npm run install:wasm-pack:sh
|
yarn install:wasm-pack:sh
|
||||||
endif
|
endif
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -59,17 +57,17 @@ build-web: install public/kcl_wasm_lib_bg.wasm build/index.html
|
|||||||
build-desktop: install public/kcl_wasm_lib_bg.wasm .vite/build/main.js
|
build-desktop: install public/kcl_wasm_lib_bg.wasm .vite/build/main.js
|
||||||
|
|
||||||
public/kcl_wasm_lib_bg.wasm: $(CARGO_SOURCES) $(RUST_SOURCES)
|
public/kcl_wasm_lib_bg.wasm: $(CARGO_SOURCES) $(RUST_SOURCES)
|
||||||
ifdef WINDOWS
|
ifeq ($(OS),Windows_NT)
|
||||||
npm run build:wasm:dev:windows
|
yarn build:wasm:dev:windows
|
||||||
else
|
else
|
||||||
npm run build:wasm:dev
|
yarn build:wasm:dev
|
||||||
endif
|
endif
|
||||||
|
|
||||||
build/index.html: $(REACT_SOURCES) $(TYPESCRIPT_SOURCES) $(VITE_SOURCES)
|
build/index.html: $(REACT_SOURCES) $(TYPESCRIPT_SOURCES) $(VITE_SOURCES)
|
||||||
npm run build:local
|
yarn build:local
|
||||||
|
|
||||||
.vite/build/main.js: $(REACT_SOURCES) $(TYPESCRIPT_SOURCES) $(VITE_SOURCES)
|
.vite/build/main.js: $(REACT_SOURCES) $(TYPESCRIPT_SOURCES) $(VITE_SOURCES)
|
||||||
npm run tronb:vite:dev
|
yarn tronb:vite:dev
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# CHECK
|
# CHECK
|
||||||
@ -79,12 +77,12 @@ check: format lint
|
|||||||
|
|
||||||
.PHONY: format
|
.PHONY: format
|
||||||
format: install ## Format the code
|
format: install ## Format the code
|
||||||
npm run fmt
|
yarn fmt
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: install ## Lint the code
|
lint: install ## Lint the code
|
||||||
npm run tsc
|
yarn tsc
|
||||||
npm run lint
|
yarn lint
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# RUN
|
# RUN
|
||||||
@ -96,11 +94,11 @@ run: run-$(TARGET)
|
|||||||
|
|
||||||
.PHONY: run-web
|
.PHONY: run-web
|
||||||
run-web: install build-web ## Start the web app
|
run-web: install build-web ## Start the web app
|
||||||
npm run start
|
yarn start
|
||||||
|
|
||||||
.PHONY: run-desktop
|
.PHONY: run-desktop
|
||||||
run-desktop: install build-desktop ## Start the desktop app
|
run-desktop: install build-desktop ## Start the desktop app
|
||||||
npm run tron:start
|
yarn tron:start
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# TEST
|
# TEST
|
||||||
@ -115,7 +113,7 @@ test: test-unit test-e2e
|
|||||||
.PHONY: test-unit
|
.PHONY: test-unit
|
||||||
test-unit: install ## Run the unit tests
|
test-unit: install ## Run the unit tests
|
||||||
@ curl -fs localhost:3000 >/dev/null || ( echo "Error: localhost:3000 not available, 'make run-web' first" && exit 1 )
|
@ curl -fs localhost:3000 >/dev/null || ( echo "Error: localhost:3000 not available, 'make run-web' first" && exit 1 )
|
||||||
npm run test:unit
|
yarn test:unit
|
||||||
|
|
||||||
.PHONY: test-e2e
|
.PHONY: test-e2e
|
||||||
test-e2e: test-e2e-$(TARGET)
|
test-e2e: test-e2e-$(TARGET)
|
||||||
@ -124,17 +122,17 @@ test-e2e: test-e2e-$(TARGET)
|
|||||||
test-e2e-web: install build-web ## Run the web e2e tests
|
test-e2e-web: install build-web ## Run the web e2e tests
|
||||||
@ curl -fs localhost:3000 >/dev/null || ( echo "Error: localhost:3000 not available, 'make run-web' first" && exit 1 )
|
@ curl -fs localhost:3000 >/dev/null || ( echo "Error: localhost:3000 not available, 'make run-web' first" && exit 1 )
|
||||||
ifdef E2E_GREP
|
ifdef E2E_GREP
|
||||||
npm run chrome:test -- --headed --grep="$(E2E_GREP)" --max-failures=$(E2E_FAILURES)
|
yarn chrome:test --headed --grep="$(E2E_GREP)" --max-failures=$(E2E_FAILURES)
|
||||||
else
|
else
|
||||||
npm run chrome:test -- --headed --workers='100%'
|
yarn chrome:test --headed --workers='100%'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: test-e2e-desktop
|
.PHONY: test-e2e-desktop
|
||||||
test-e2e-desktop: install build-desktop ## Run the desktop e2e tests
|
test-e2e-desktop: install build-desktop ## Run the desktop e2e tests
|
||||||
ifdef E2E_GREP
|
ifdef E2E_GREP
|
||||||
npm run test:playwright:electron -- --grep="$(E2E_GREP)" --max-failures=$(E2E_FAILURES)
|
yarn test:playwright:electron --grep="$(E2E_GREP)" --max-failures=$(E2E_FAILURES)
|
||||||
else
|
else
|
||||||
npm run test:playwright:electron -- --workers='100%'
|
yarn test:playwright:electron --workers='100%'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -142,8 +140,8 @@ endif
|
|||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean: ## Delete all artifacts
|
clean: ## Delete all artifacts
|
||||||
ifdef POWERSHELL
|
ifeq ($(OS),Windows_NT)
|
||||||
git clean --force -d -x --exclude=.env* --exclude=**/*.env
|
git clean --force -d -X
|
||||||
else
|
else
|
||||||
rm -rf .vite/ build/
|
rm -rf .vite/ build/
|
||||||
rm -rf trace.zip playwright-report/ test-results/
|
rm -rf trace.zip playwright-report/ test-results/
|
||||||
@ -154,7 +152,7 @@ endif
|
|||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help: install
|
help: install
|
||||||
ifdef POWERSHELL
|
ifeq ($(OS),Windows_NT)
|
||||||
@ powershell -Command "Get-Content $(MAKEFILE_LIST) | Select-String -Pattern '^[^\s]+:.*##\s.*$$' | ForEach-Object { $$line = $$_.Line -split ':.*?##\s+'; Write-Host -NoNewline $$line[0].PadRight(30) -ForegroundColor Cyan; Write-Host $$line[1] }"
|
@ powershell -Command "Get-Content $(MAKEFILE_LIST) | Select-String -Pattern '^[^\s]+:.*##\s.*$$' | ForEach-Object { $$line = $$_.Line -split ':.*?##\s+'; Write-Host -NoNewline $$line[0].PadRight(30) -ForegroundColor Cyan; Write-Host $$line[1] }"
|
||||||
else
|
else
|
||||||
@ grep -E '^[^[:space:]]+:.*## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
@ grep -E '^[^[:space:]]+:.*## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||||
@ -169,5 +167,5 @@ endif
|
|||||||
# It should work for you other Linux users.
|
# It should work for you other Linux users.
|
||||||
lee-electron-test:
|
lee-electron-test:
|
||||||
Xephyr -br -ac -noreset -screen 1200x500 :2 &
|
Xephyr -br -ac -noreset -screen 1200x500 :2 &
|
||||||
DISPLAY=:2 NODE_ENV=development PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ npm run tron:test -g "when using the file tree"
|
DISPLAY=:2 NODE_ENV=development PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn tron:test -g "when using the file tree"
|
||||||
killall Xephyr
|
killall Xephyr
|
||||||
|
126
README.md
126
README.md
@ -62,39 +62,39 @@ fnm use
|
|||||||
Install the NPM dependencies with:
|
Install the NPM dependencies with:
|
||||||
|
|
||||||
```
|
```
|
||||||
npm install
|
yarn install
|
||||||
```
|
```
|
||||||
|
|
||||||
This project uses a lot of Rust compiled to [WASM](https://webassembly.org/) within it. We have package scripts to run rustup, see `package.json` for reference:
|
This project uses a lot of Rust compiled to [WASM](https://webassembly.org/) within it. We have package scripts to run rustup, see `package.json` for reference:
|
||||||
|
|
||||||
```
|
```
|
||||||
# macOS/Linux
|
# macOS/Linux
|
||||||
npm run install:rust
|
yarn install:rust
|
||||||
npm run install:wasm-pack:sh
|
yarn install:wasm-pack:sh
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
npm run install:rust:windows
|
yarn install:rust:windows
|
||||||
npm run install:wasm-pack:cargo
|
yarn install:wasm-pack:cargo
|
||||||
```
|
```
|
||||||
|
|
||||||
Then to build the WASM layer, run:
|
Then to build the WASM layer, run:
|
||||||
|
|
||||||
```
|
```
|
||||||
# macOS/Linux
|
# macOS/Linux
|
||||||
npm run build:wasm
|
yarn build:wasm
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
npm run build:wasm:windows
|
yarn build:wasm:windows
|
||||||
```
|
```
|
||||||
|
|
||||||
Or if you have the `gh` cli installed and want to download the latest main wasm bundle. Note that on Windows, you need to associate .ps1 files with PowerShell, which can be done via the right click menu, selecting `C:\Program Files\PowerShell\7\pwsh.exe`, and you can install tools like `gh` via `npm run install:tools:windows`.
|
Or if you have the `gh` cli installed and want to download the latest main wasm bundle. Note that on Windows, you need to associate .ps1 files with PowerShell, which can be done via the right click menu, selecting `C:\Program Files\PowerShell\7\pwsh.exe`, and you can install tools like `gh` via `yarn install:tools:windows`.
|
||||||
|
|
||||||
```
|
```
|
||||||
# macOS/Linux
|
# macOS/Linux
|
||||||
npm run fetch:wasm
|
yarn fetch:wasm
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
npm run fetch:wasm:windows
|
yarn fetch:wasm:windows
|
||||||
```
|
```
|
||||||
|
|
||||||
That will build the WASM binary and put in the `public` dir (though gitignored).
|
That will build the WASM binary and put in the `public` dir (though gitignored).
|
||||||
@ -102,7 +102,7 @@ That will build the WASM binary and put in the `public` dir (though gitignored).
|
|||||||
Finally, to run the web app only, run:
|
Finally, to run the web app only, run:
|
||||||
|
|
||||||
```
|
```
|
||||||
npm start
|
yarn start
|
||||||
```
|
```
|
||||||
|
|
||||||
If you're not a Zoo employee you won't be able to access the dev environment, you should copy everything from `.env.production` to `.env.development.local` to make it point to production instead, then when you navigate to `localhost:3000` the easiest way to sign in is to paste `localStorage.setItem('TOKEN_PERSIST_KEY', "your-token-from-https://zoo.dev/account/api-tokens")` replacing the with a real token from https://zoo.dev/account/api-tokens of course, then navigate to `localhost:3000` again. Note that navigating to `localhost:3000/signin` removes your token so you will need to set the token again.
|
If you're not a Zoo employee you won't be able to access the dev environment, you should copy everything from `.env.production` to `.env.development.local` to make it point to production instead, then when you navigate to `localhost:3000` the easiest way to sign in is to paste `localStorage.setItem('TOKEN_PERSIST_KEY', "your-token-from-https://zoo.dev/account/api-tokens")` replacing the with a real token from https://zoo.dev/account/api-tokens of course, then navigate to `localhost:3000` again. Note that navigating to `localhost:3000/signin` removes your token so you will need to set the token again.
|
||||||
@ -122,17 +122,17 @@ Third-Party Cookies".
|
|||||||
|
|
||||||
## Desktop
|
## Desktop
|
||||||
|
|
||||||
To spin up the desktop app, `npm install` and `npm run build:wasm` need to have been done before hand then:
|
To spin up the desktop app, `yarn install` and `yarn build:wasm` need to have been done before hand then:
|
||||||
|
|
||||||
```
|
```
|
||||||
npm run tron:start
|
yarn tron:start
|
||||||
```
|
```
|
||||||
|
|
||||||
This will start the application and hot-reload on changes.
|
This will start the application and hot-reload on changes.
|
||||||
|
|
||||||
Devtools can be opened with the usual Command-Option-I (macOS) or Ctrl-Shift-I (Linux and Windows).
|
Devtools can be opened with the usual Command-Option-I (macOS) or Ctrl-Shift-I (Linux and Windows).
|
||||||
|
|
||||||
To package the app for your platform with electron-builder, run `npm run tronb:package:dev` (or `npm run tronb:package:prod` to point to the .env.production variables).
|
To package the app for your platform with electron-builder, run `yarn tronb:package:dev` (or `yarn tronb:package:prod` to point to the .env.production variables).
|
||||||
|
|
||||||
## Checking out commits / Bisecting
|
## Checking out commits / Bisecting
|
||||||
|
|
||||||
@ -141,9 +141,9 @@ Which commands from setup are one off vs. need to be run every time?
|
|||||||
The following will need to be run when checking out a new commit and guarantees the build is not stale:
|
The following will need to be run when checking out a new commit and guarantees the build is not stale:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install
|
yarn install
|
||||||
npm run build:wasm
|
yarn build:wasm
|
||||||
npm start # or npm run build:local && npm run serve for slower but more production-like build
|
yarn start # or yarn build:local && yarn serve for slower but more production-like build
|
||||||
```
|
```
|
||||||
|
|
||||||
## Before submitting a PR
|
## Before submitting a PR
|
||||||
@ -153,10 +153,10 @@ Before you submit a contribution PR to this repo, please ensure that:
|
|||||||
- There is a corresponding issue for the changes you want to make, so that discussion of approach can be had before work begins.
|
- There is a corresponding issue for the changes you want to make, so that discussion of approach can be had before work begins.
|
||||||
- You have separated out refactoring commits from feature commits as much as possible
|
- You have separated out refactoring commits from feature commits as much as possible
|
||||||
- You have run all of the following commands locally:
|
- You have run all of the following commands locally:
|
||||||
- `npm run fmt`
|
- `yarn fmt`
|
||||||
- `npm run tsc`
|
- `yarn tsc`
|
||||||
- `npm run test`
|
- `yarn test`
|
||||||
- Here they are all together: `npm run fmt && npm run tsc && npm run test`
|
- Here they are all together: `yarn fmt && yarn tsc && yarn test`
|
||||||
|
|
||||||
## Release a new version
|
## Release a new version
|
||||||
|
|
||||||
@ -250,29 +250,55 @@ You will need a `./e2e/playwright/playwright-secrets.env` file:
|
|||||||
$ touch ./e2e/playwright/playwright-secrets.env
|
$ touch ./e2e/playwright/playwright-secrets.env
|
||||||
$ cat ./e2e/playwright/playwright-secrets.env
|
$ cat ./e2e/playwright/playwright-secrets.env
|
||||||
token=<dev.zoo.dev/account/api-tokens>
|
token=<dev.zoo.dev/account/api-tokens>
|
||||||
snapshottoken=<zoo.dev/account/api-tokens>
|
snapshottoken=<your-snapshot-token>
|
||||||
```
|
```
|
||||||
or use `export` to set the environment variables `token` and `snapshottoken`.
|
|
||||||
|
|
||||||
#### Snapshot tests (Google Chrome on Ubuntu only)
|
For a portable way to run Playwright you'll need Docker.
|
||||||
|
|
||||||
Only Ubunu and Google Chrome is supported for the set of tests evaluating screenshot snapshots.
|
#### Generic example
|
||||||
If you don't run Ubuntu locally or in a VM, you may use a GitHub Codespace.
|
|
||||||
|
After that, open a terminal and run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --network host --rm --init -it playwright/chrome:playwright-x.xx.x
|
||||||
```
|
```
|
||||||
npm run playwright -- install chrome
|
|
||||||
npm run test:snapshots
|
|
||||||
```
|
|
||||||
You may use `-- --update-snapshots` as needed.
|
|
||||||
|
|
||||||
#### Electron flow tests (Chromium on Ubuntu, macOS, Windows)
|
and in another terminal, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project="Google Chrome" <test suite>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Specific example
|
||||||
|
|
||||||
|
open a terminal and run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --network host --rm --init -it playwright/chrome:playwright-1.46.0
|
||||||
|
```
|
||||||
|
|
||||||
|
and in another terminal, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project="Google Chrome" e2e/playwright/command-bar-tests.spec.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
run a specific test change the test from `test('...` to `test.only('...`
|
||||||
|
(note if you commit this, the tests will instantly fail without running any of the tests)
|
||||||
|
|
||||||
|
**Gotcha**: running the docker container with a mismatched image against your `./node_modules/playwright` will cause a failure. Make sure the versions are matched and up to date.
|
||||||
|
|
||||||
|
run headed
|
||||||
|
|
||||||
```
|
```
|
||||||
npm run playwright -- install chromium
|
yarn playwright test --headed
|
||||||
npm run test:playwright:electron:local
|
|
||||||
```
|
```
|
||||||
You may use `-- -g "my test"` to match specific test titles, or `-- path/to/file.spec.ts` for a test file.
|
|
||||||
|
|
||||||
#### Debugger
|
run with step through debugger
|
||||||
|
|
||||||
|
```
|
||||||
|
PWDEBUG=1 yarn playwright test
|
||||||
|
```
|
||||||
|
|
||||||
However, if you want a debugger I recommend using VSCode and the `playwright` extension, as the above command is a cruder debugger that steps into every function call which is annoying.
|
However, if you want a debugger I recommend using VSCode and the `playwright` extension, as the above command is a cruder debugger that steps into every function call which is annoying.
|
||||||
With the extension you can set a breakpoint after `waitForDefaultPlanesVisibilityChange` in order to skip app loading, then the vscode debugger's "step over" is much better for being able to stay at the right level of abstraction as you debug the code.
|
With the extension you can set a breakpoint after `waitForDefaultPlanesVisibilityChange` in order to skip app loading, then the vscode debugger's "step over" is much better for being able to stay at the right level of abstraction as you debug the code.
|
||||||
@ -282,7 +308,7 @@ Or comment out browsers in `playwright.config.ts`.
|
|||||||
|
|
||||||
note chromium has encoder compat issues which is why were testing against the branded 'Google Chrome'
|
note chromium has encoder compat issues which is why were testing against the branded 'Google Chrome'
|
||||||
|
|
||||||
You may consider using the VSCode extension, it's useful for running individual threads, but some some reason the "record a test" is locked to chromium with we can't use. A work around is to us the CI `npm run playwright codegen -b wk --load-storage ./store localhost:3000`
|
You may consider using the VSCode extension, it's useful for running individual threads, but some some reason the "record a test" is locked to chromium with we can't use. A work around is to us the CI `yarn playwright codegen -b wk --load-storage ./store localhost:3000`
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>
|
<summary>
|
||||||
@ -325,21 +351,21 @@ However because much of our tests involve clicking in the stream at specific loc
|
|||||||
If you already haven't, run the following:
|
If you already haven't, run the following:
|
||||||
|
|
||||||
```
|
```
|
||||||
npm
|
yarn
|
||||||
npm run build:wasm
|
yarn build:wasm
|
||||||
npm start
|
yarn start
|
||||||
```
|
```
|
||||||
|
|
||||||
and finally:
|
and finally:
|
||||||
|
|
||||||
```
|
```
|
||||||
npm run test:unit
|
yarn test:unit
|
||||||
```
|
```
|
||||||
|
|
||||||
For individual testing:
|
For individual testing:
|
||||||
|
|
||||||
```
|
```
|
||||||
npm run test abstractSyntaxTree -t "unexpected closed curly brace" --silent=false
|
yarn test abstractSyntaxTree -t "unexpected closed curly brace" --silent=false
|
||||||
```
|
```
|
||||||
|
|
||||||
Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testing Library E2E](https://testing-library.com/docs/react-testing-library/intro) tests, in interactive mode by default.
|
Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testing Library E2E](https://testing-library.com/docs/react-testing-library/intro) tests, in interactive mode by default.
|
||||||
@ -413,16 +439,16 @@ Part of the CI CD pipeline performs static analysis on the code. Use the followi
|
|||||||
The following set of commands should get us closer to one and done commands to instantly retest issues.
|
The following set of commands should get us closer to one and done commands to instantly retest issues.
|
||||||
|
|
||||||
```
|
```
|
||||||
npm run test-setup
|
yarn test-setup
|
||||||
```
|
```
|
||||||
|
|
||||||
> Gotcha, are packages up to date and is the wasm built?
|
> Gotcha, are packages up to date and is the wasm built?
|
||||||
|
|
||||||
```
|
```
|
||||||
npm run tsc
|
yarn tsc
|
||||||
npm run fmt:check
|
yarn fmt-check
|
||||||
npm run lint
|
yarn lint
|
||||||
npm run test:unit:local
|
yarn test:unit:local
|
||||||
```
|
```
|
||||||
|
|
||||||
> Gotcha: Our unit tests have integration tests in them. You need to run a localhost server to run the unit tests.
|
> Gotcha: Our unit tests have integration tests in them. You need to run a localhost server to run the unit tests.
|
||||||
@ -434,10 +460,10 @@ npm run test:unit:local
|
|||||||
These E2E tests run in electron. There are tests that are skipped if they are ran in a windows, linux, or macos environment. We can use playwright tags to implement test skipping.
|
These E2E tests run in electron. There are tests that are skipped if they are ran in a windows, linux, or macos environment. We can use playwright tags to implement test skipping.
|
||||||
|
|
||||||
```
|
```
|
||||||
npm run test:playwright:electron:local
|
yarn test:playwright:electron:local
|
||||||
npm run test:playwright:electron:windows:local
|
yarn test:playwright:electron:windows:local
|
||||||
npm run test:playwright:electron:macos:local
|
yarn test:playwright:electron:macos:local
|
||||||
npm run test:playwright:electron:ubuntu:local
|
yarn test:playwright:electron:ubuntu:local
|
||||||
```
|
```
|
||||||
|
|
||||||
> Why does it say local? The CI CD commands that run in the pipeline cannot be ran locally. A single command will not properly setup the testing environment locally.
|
> Why does it say local? The CI CD commands that run in the pipeline cannot be ran locally. A single command will not properly setup the testing environment locally.
|
||||||
|
48
biome.json
48
biome.json
@ -1,48 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://biomejs.dev/schemas/1.6.0/schema.json",
|
|
||||||
"organizeImports": {
|
|
||||||
"enabled": true
|
|
||||||
},
|
|
||||||
"linter": {
|
|
||||||
"enabled": true,
|
|
||||||
"rules": {
|
|
||||||
"recommended": true,
|
|
||||||
"correctness": {
|
|
||||||
"noUnusedVariables": "error"
|
|
||||||
},
|
|
||||||
"suspicious": {
|
|
||||||
"noExplicitAny": "warn"
|
|
||||||
},
|
|
||||||
"style": {
|
|
||||||
"useBlockStatements": "error",
|
|
||||||
"useShorthandArrayType": "error"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"formatter": {
|
|
||||||
"enabled": true,
|
|
||||||
"indentWidth": 2,
|
|
||||||
"indentStyle": "space",
|
|
||||||
"lineWidth": 80,
|
|
||||||
"formatWithErrors": true
|
|
||||||
},
|
|
||||||
"javascript": {
|
|
||||||
"formatter": {
|
|
||||||
"quoteStyle": "single",
|
|
||||||
"jsxQuoteStyle": "double",
|
|
||||||
"trailingCommas": "es5",
|
|
||||||
"semicolons": "asNeeded"
|
|
||||||
},
|
|
||||||
"parser": {
|
|
||||||
"unsafeParameterDecoratorsEnabled": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"css": {
|
|
||||||
"parser": {
|
|
||||||
"cssModules": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"files": {
|
|
||||||
"ignore": ["**/*.json"]
|
|
||||||
}
|
|
||||||
}
|
|
@ -36,9 +36,9 @@ myAngle = -120
|
|||||||
sketch001 = startSketchOn(XZ)
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line(end = [8, 0])
|
|> line(end = [8, 0])
|
||||||
|> angledLine(angle = abs(myAngle), length = 5)
|
|> angledLine({ angle = abs(myAngle), length = 5 }, %)
|
||||||
|> line(end = [-5, 0])
|
|> line(end = [-5, 0])
|
||||||
|> angledLine(angle = myAngle, length = 5)
|
|> angledLine({ angle = myAngle, length = 5 }, %)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
baseExtrusion = extrude(sketch001, length = 5)
|
baseExtrusion = extrude(sketch001, length = 5)
|
||||||
|
@ -33,7 +33,10 @@ acos(num: number): number
|
|||||||
```js
|
```js
|
||||||
sketch001 = startSketchOn(XZ)
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(angle = toDegrees(acos(0.5)), length = 10)
|
|> angledLine({
|
||||||
|
angle = toDegrees(acos(0.5)),
|
||||||
|
length = 10
|
||||||
|
}, %)
|
||||||
|> line(end = [5, 0])
|
|> line(end = [5, 0])
|
||||||
|> line(endAbsolute = [12, 0])
|
|> line(endAbsolute = [12, 0])
|
||||||
|> close()
|
|> close()
|
||||||
|
@ -36,7 +36,7 @@ angleToMatchLengthX(
|
|||||||
sketch001 = startSketchOn(XZ)
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line(end = [2, 5], tag = $seg01)
|
|> line(end = [2, 5], tag = $seg01)
|
||||||
|> angledLine(angle = -angleToMatchLengthX(seg01, 7, %), endAbsoluteX = 10)
|
|> angledLineToX([-angleToMatchLengthX(seg01, 7, %), 10], %)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
extrusion = extrude(sketch001, length = 5)
|
extrusion = extrude(sketch001, length = 5)
|
||||||
|
@ -36,7 +36,10 @@ angleToMatchLengthY(
|
|||||||
sketch001 = startSketchOn(XZ)
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line(end = [1, 2], tag = $seg01)
|
|> line(end = [1, 2], tag = $seg01)
|
||||||
|> angledLine(angle = angleToMatchLengthY(seg01, 15, %), length = 5)
|
|> angledLine({
|
||||||
|
angle = angleToMatchLengthY(seg01, 15, %),
|
||||||
|
length = 5
|
||||||
|
}, %)
|
||||||
|> yLine(endAbsolute = 0)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
|
@ -10,13 +10,8 @@ Draw a line segment relative to the current origin using the polar measure of so
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
angledLine(
|
angledLine(
|
||||||
|
data: AngledLineData,
|
||||||
sketch: Sketch,
|
sketch: Sketch,
|
||||||
angle: number,
|
|
||||||
length?: number,
|
|
||||||
lengthX?: number,
|
|
||||||
lengthY?: number,
|
|
||||||
endAbsoluteX?: number,
|
|
||||||
endAbsoluteY?: number,
|
|
||||||
tag?: TagDeclarator,
|
tag?: TagDeclarator,
|
||||||
): Sketch
|
): Sketch
|
||||||
```
|
```
|
||||||
@ -26,14 +21,9 @@ angledLine(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
|
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
||||||
| `angle` | [`number`](/docs/kcl/types/number) | Which angle should the line be drawn at? | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
| `length` | [`number`](/docs/kcl/types/number) | Draw the line this distance along the given angle. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
|
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
| `lengthX` | [`number`](/docs/kcl/types/number) | Draw the line this distance along the X axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
|
|
||||||
| `lengthY` | [`number`](/docs/kcl/types/number) | Draw the line this distance along the Y axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
|
|
||||||
| `endAbsoluteX` | [`number`](/docs/kcl/types/number) | Draw the line along the given angle until it reaches this point along the X axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
|
|
||||||
| `endAbsoluteY` | [`number`](/docs/kcl/types/number) | Draw the line along the given angle until it reaches this point along the Y axis. Only one of `length`, `lengthX`, `lengthY`, `endAbsoluteX`, `endAbsoluteY` can be given. | No |
|
|
||||||
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
|
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@ -46,7 +36,7 @@ angledLine(
|
|||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([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])
|
||||||
|> yLine(endAbsolute = 0)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
48
docs/kcl/angledLineOfXLength.md
Normal file
48
docs/kcl/angledLineOfXLength.md
Normal file
File diff suppressed because one or more lines are too long
50
docs/kcl/angledLineOfYLength.md
Normal file
50
docs/kcl/angledLineOfYLength.md
Normal file
File diff suppressed because one or more lines are too long
@ -10,10 +10,8 @@ Draw an angled line from the current origin, constructing a line segment such th
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineThatIntersects(
|
angledLineThatIntersects(
|
||||||
|
data: AngledLineThatIntersectsData,
|
||||||
sketch: Sketch,
|
sketch: Sketch,
|
||||||
angle: number,
|
|
||||||
intersectTag: TagIdentifier,
|
|
||||||
offset?: number,
|
|
||||||
tag?: TagDeclarator,
|
tag?: TagDeclarator,
|
||||||
): Sketch
|
): Sketch
|
||||||
```
|
```
|
||||||
@ -23,11 +21,9 @@ angledLineThatIntersects(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
|
| `data` | [`AngledLineThatIntersectsData`](/docs/kcl/types/AngledLineThatIntersectsData) | Data for drawing an angled line that intersects with a given line. | Yes |
|
||||||
| `angle` | [`number`](/docs/kcl/types/number) | Which angle should the line be drawn at? | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
| `intersectTag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | The tag of the line to intersect with | Yes |
|
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
| `offset` | [`number`](/docs/kcl/types/number) | The offset from the intersecting line. Defaults to 0. | No |
|
|
||||||
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
|
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@ -42,7 +38,11 @@ exampleSketch = startSketchOn(XZ)
|
|||||||
|> 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])
|
||||||
|> angledLineThatIntersects(angle = 80, intersectTag = lineToIntersect, offset = 10)
|
|> angledLineThatIntersects({
|
||||||
|
angle = 80,
|
||||||
|
intersectTag = lineToIntersect,
|
||||||
|
offset = 10
|
||||||
|
}, %)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
example = extrude(exampleSketch, length = 10)
|
example = extrude(exampleSketch, length = 10)
|
||||||
|
48
docs/kcl/angledLineToX.md
Normal file
48
docs/kcl/angledLineToX.md
Normal file
File diff suppressed because one or more lines are too long
48
docs/kcl/angledLineToY.md
Normal file
48
docs/kcl/angledLineToY.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
@ -33,7 +33,10 @@ asin(num: number): number
|
|||||||
```js
|
```js
|
||||||
sketch001 = startSketchOn(XZ)
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(angle = toDegrees(asin(0.5)), length = 20)
|
|> angledLine({
|
||||||
|
angle = toDegrees(asin(0.5)),
|
||||||
|
length = 20
|
||||||
|
}, %)
|
||||||
|> yLine(endAbsolute = 0)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
|
@ -33,7 +33,10 @@ atan(num: number): number
|
|||||||
```js
|
```js
|
||||||
sketch001 = startSketchOn(XZ)
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(angle = toDegrees(atan(1.25)), length = 20)
|
|> angledLine({
|
||||||
|
angle = toDegrees(atan(1.25)),
|
||||||
|
length = 20
|
||||||
|
}, %)
|
||||||
|> yLine(endAbsolute = 0)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ atan2(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `y` | [`number`](/docs/kcl/types/number) | Y | Yes |
|
| `y` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `x` | [`number`](/docs/kcl/types/number) | X | Yes |
|
| `x` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@ -37,7 +37,10 @@ atan2(
|
|||||||
```js
|
```js
|
||||||
sketch001 = startSketchOn(XZ)
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(angle = toDegrees(atan2(y = 1.25, x = 2)), length = 20)
|
|> angledLine({
|
||||||
|
angle = toDegrees(atan2(1.25, 2)),
|
||||||
|
length = 20
|
||||||
|
}, %)
|
||||||
|> yLine(endAbsolute = 0)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ part001 = cube([0, 0], 20)
|
|||||||
// We tag the chamfer to reference it later.
|
// We tag the chamfer to reference it later.
|
||||||
|> chamfer(length = 10, tags = [getOppositeEdge(line1)], tag = $chamfer1)
|
|> chamfer(length = 10, tags = [getOppositeEdge(line1)], tag = $chamfer1)
|
||||||
|
|
||||||
sketch001 = startSketchOn(part001, face = chamfer1)
|
sketch001 = startSketchOn(part001, chamfer1)
|
||||||
|> startProfileAt([10, 10], %)
|
|> startProfileAt([10, 10], %)
|
||||||
|> line(end = [2, 0])
|
|> line(end = [2, 0])
|
||||||
|> line(end = [0, 2])
|
|> line(end = [0, 2])
|
||||||
|
@ -9,8 +9,6 @@ layout: manual
|
|||||||
|
|
||||||
### `std`
|
### `std`
|
||||||
|
|
||||||
- [`END`](/docs/kcl/consts/std-END)
|
|
||||||
- [`START`](/docs/kcl/consts/std-START)
|
|
||||||
- [`X`](/docs/kcl/consts/std-X)
|
- [`X`](/docs/kcl/consts/std-X)
|
||||||
- [`XY`](/docs/kcl/consts/std-XY)
|
- [`XY`](/docs/kcl/consts/std-XY)
|
||||||
- [`XZ`](/docs/kcl/consts/std-XZ)
|
- [`XZ`](/docs/kcl/consts/std-XZ)
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "std::END"
|
|
||||||
excerpt: "Identifies the ending face of an extrusion. I.e., the new face created by an extrusion."
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
Identifies the ending face of an extrusion. I.e., the new face created by an extrusion.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
std::END: string = 'end'
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "std::START"
|
|
||||||
excerpt: "Identifies the starting face of an extrusion. I.e., the face which is extruded."
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
Identifies the starting face of an extrusion. I.e., the face which is extruded.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
std::START: string = 'start'
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
@ -17,10 +17,10 @@ std::math::E: number = 2.71828182845904523536028747135266250_
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(
|
|> angledLine({
|
||||||
angle = 30,
|
angle = 30,
|
||||||
length = 2 * E ^ 2,
|
length = 2 * E ^ 2,
|
||||||
)
|
}, %)
|
||||||
|> yLine(endAbsolute = 0)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
|
@ -17,10 +17,10 @@ std::math::TAU: number = 6.28318530717958647692528676655900577_
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(
|
|> angledLine({
|
||||||
angle = 50,
|
angle = 50,
|
||||||
length = 10 * TAU,
|
length = 10 * TAU,
|
||||||
)
|
}, %)
|
||||||
|> yLine(endAbsolute = 0)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ e(): number
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(angle = 30, length = 2 * e() ^ 2)
|
|> angledLine({ angle = 30, length = 2 * e() ^ 2 }, %)
|
||||||
|> yLine(endAbsolute = 0)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -30,10 +30,10 @@ getNextAdjacentEdge(tag: TagIdentifier): Uuid
|
|||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([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 }, %)
|
||||||
|> line(end = [-10, 0])
|
|> line(end = [-10, 0])
|
||||||
|> angledLine(angle = 240, length = 10, tag = $referenceEdge)
|
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
example = extrude(exampleSketch, length = 5)
|
example = extrude(exampleSketch, length = 5)
|
||||||
|
@ -30,10 +30,10 @@ getOppositeEdge(tag: TagIdentifier): Uuid
|
|||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([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 }, %)
|
||||||
|> line(end = [-10, 0])
|
|> line(end = [-10, 0])
|
||||||
|> angledLine(angle = 240, length = 10, tag = $referenceEdge)
|
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
example = extrude(exampleSketch, length = 5)
|
example = extrude(exampleSketch, length = 5)
|
||||||
|
@ -30,10 +30,10 @@ getPreviousAdjacentEdge(tag: TagIdentifier): Uuid
|
|||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([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 }, %)
|
||||||
|> line(end = [-10, 0])
|
|> line(end = [-10, 0])
|
||||||
|> angledLine(angle = 240, length = 10, tag = $referenceEdge)
|
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
example = extrude(exampleSketch, length = 5)
|
example = extrude(exampleSketch, length = 5)
|
||||||
|
@ -65,15 +65,15 @@ case = startSketchOn(-XZ)
|
|||||||
|> startProfileAt([-size, -size], %)
|
|> startProfileAt([-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])
|
|> tangentialArcTo([-size, size], %)
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(length = 65)
|
|> extrude(length = 65)
|
||||||
|
|
||||||
thing1 = startSketchOn(case, face = END)
|
thing1 = startSketchOn(case, 'end')
|
||||||
|> circle(center = [-size / 2, -size / 2], radius = 25)
|
|> circle(center = [-size / 2, -size / 2], radius = 25)
|
||||||
|> extrude(length = 50)
|
|> extrude(length = 50)
|
||||||
|
|
||||||
thing2 = startSketchOn(case, face = END)
|
thing2 = startSketchOn(case, 'end')
|
||||||
|> circle(center = [size / 2, -size / 2], radius = 25)
|
|> circle(center = [size / 2, -size / 2], radius = 25)
|
||||||
|> extrude(length = 50)
|
|> extrude(length = 50)
|
||||||
|
|
||||||
|
80
docs/kcl/import.md
Normal file
80
docs/kcl/import.md
Normal file
File diff suppressed because one or more lines are too long
@ -24,14 +24,12 @@ layout: manual
|
|||||||
* **std**
|
* **std**
|
||||||
* [`Axis2d`](kcl/types/Axis2d)
|
* [`Axis2d`](kcl/types/Axis2d)
|
||||||
* [`Axis3d`](kcl/types/Axis3d)
|
* [`Axis3d`](kcl/types/Axis3d)
|
||||||
* [`END`](kcl/consts/std-END)
|
|
||||||
* [`Edge`](kcl/types/Edge)
|
* [`Edge`](kcl/types/Edge)
|
||||||
* [`Face`](kcl/types/Face)
|
* [`Face`](kcl/types/Face)
|
||||||
* [`Helix`](kcl/types/Helix)
|
* [`Helix`](kcl/types/Helix)
|
||||||
* [`Plane`](kcl/types/Plane)
|
* [`Plane`](kcl/types/Plane)
|
||||||
* [`Point2d`](kcl/types/Point2d)
|
* [`Point2d`](kcl/types/Point2d)
|
||||||
* [`Point3d`](kcl/types/Point3d)
|
* [`Point3d`](kcl/types/Point3d)
|
||||||
* [`START`](kcl/consts/std-START)
|
|
||||||
* [`Sketch`](kcl/types/Sketch)
|
* [`Sketch`](kcl/types/Sketch)
|
||||||
* [`Solid`](kcl/types/Solid)
|
* [`Solid`](kcl/types/Solid)
|
||||||
* [`X`](kcl/consts/std-X)
|
* [`X`](kcl/consts/std-X)
|
||||||
@ -45,7 +43,11 @@ layout: manual
|
|||||||
* [`angleToMatchLengthX`](kcl/angleToMatchLengthX)
|
* [`angleToMatchLengthX`](kcl/angleToMatchLengthX)
|
||||||
* [`angleToMatchLengthY`](kcl/angleToMatchLengthY)
|
* [`angleToMatchLengthY`](kcl/angleToMatchLengthY)
|
||||||
* [`angledLine`](kcl/angledLine)
|
* [`angledLine`](kcl/angledLine)
|
||||||
|
* [`angledLineOfXLength`](kcl/angledLineOfXLength)
|
||||||
|
* [`angledLineOfYLength`](kcl/angledLineOfYLength)
|
||||||
* [`angledLineThatIntersects`](kcl/angledLineThatIntersects)
|
* [`angledLineThatIntersects`](kcl/angledLineThatIntersects)
|
||||||
|
* [`angledLineToX`](kcl/angledLineToX)
|
||||||
|
* [`angledLineToY`](kcl/angledLineToY)
|
||||||
* [`appearance`](kcl/appearance)
|
* [`appearance`](kcl/appearance)
|
||||||
* [`arc`](kcl/arc)
|
* [`arc`](kcl/arc)
|
||||||
* [`arcTo`](kcl/arcTo)
|
* [`arcTo`](kcl/arcTo)
|
||||||
@ -79,8 +81,6 @@ layout: manual
|
|||||||
* [`helix`](kcl/std-helix)
|
* [`helix`](kcl/std-helix)
|
||||||
* [`hole`](kcl/hole)
|
* [`hole`](kcl/hole)
|
||||||
* [`hollow`](kcl/hollow)
|
* [`hollow`](kcl/hollow)
|
||||||
* [`intersect`](kcl/intersect)
|
|
||||||
* [`involuteCircular`](kcl/involuteCircular)
|
|
||||||
* [`lastSegX`](kcl/lastSegX)
|
* [`lastSegX`](kcl/lastSegX)
|
||||||
* [`lastSegY`](kcl/lastSegY)
|
* [`lastSegY`](kcl/lastSegY)
|
||||||
* [`legAngX`](kcl/legAngX)
|
* [`legAngX`](kcl/legAngX)
|
||||||
@ -127,14 +127,14 @@ layout: manual
|
|||||||
* [`sqrt`](kcl/sqrt)
|
* [`sqrt`](kcl/sqrt)
|
||||||
* [`startProfileAt`](kcl/startProfileAt)
|
* [`startProfileAt`](kcl/startProfileAt)
|
||||||
* [`startSketchOn`](kcl/startSketchOn)
|
* [`startSketchOn`](kcl/startSketchOn)
|
||||||
* [`subtract`](kcl/subtract)
|
|
||||||
* [`sweep`](kcl/sweep)
|
* [`sweep`](kcl/sweep)
|
||||||
* [`tangentToEnd`](kcl/tangentToEnd)
|
* [`tangentToEnd`](kcl/tangentToEnd)
|
||||||
* [`tangentialArc`](kcl/tangentialArc)
|
* [`tangentialArc`](kcl/tangentialArc)
|
||||||
|
* [`tangentialArcTo`](kcl/tangentialArcTo)
|
||||||
|
* [`tangentialArcToRelative`](kcl/tangentialArcToRelative)
|
||||||
* [`toDegrees`](kcl/toDegrees)
|
* [`toDegrees`](kcl/toDegrees)
|
||||||
* [`toRadians`](kcl/toRadians)
|
* [`toRadians`](kcl/toRadians)
|
||||||
* [`translate`](kcl/translate)
|
* [`translate`](kcl/translate)
|
||||||
* [`union`](kcl/union)
|
|
||||||
* [`xLine`](kcl/xLine)
|
* [`xLine`](kcl/xLine)
|
||||||
* [`yLine`](kcl/yLine)
|
* [`yLine`](kcl/yLine)
|
||||||
* **std::math**
|
* **std::math**
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -37,7 +37,7 @@ line(
|
|||||||
```js
|
```js
|
||||||
triangle = startSketchOn(XZ)
|
triangle = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
// The END argument means it ends at exactly [10, 0].
|
// The 'end' argument means it ends at exactly [10, 0].
|
||||||
// This is an absolute measurement, it is NOT relative to
|
// This is an absolute measurement, it is NOT relative to
|
||||||
// the start of the sketch.
|
// the start of the sketch.
|
||||||
|> line(endAbsolute = [10, 0])
|
|> line(endAbsolute = [10, 0])
|
||||||
|
@ -33,7 +33,10 @@ max(args: [number]): number
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(angle = 70, length = max(15, 31, 4, 13, 22))
|
|> angledLine({
|
||||||
|
angle = 70,
|
||||||
|
length = max(15, 31, 4, 13, 22)
|
||||||
|
}, %)
|
||||||
|> line(end = [20, 0])
|
|> line(end = [20, 0])
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
|
@ -33,7 +33,10 @@ min(args: [number]): number
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(angle = 70, length = min(15, 31, 4, 13, 22))
|
|> angledLine({
|
||||||
|
angle = 70,
|
||||||
|
length = min(15, 31, 4, 13, 22)
|
||||||
|
}, %)
|
||||||
|> line(end = [20, 0])
|
|> line(end = [20, 0])
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ offsetPlane(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `plane` | [`PlaneData`](/docs/kcl/types/PlaneData) | The plane (e.g. XY) which this new plane is created from. | Yes |
|
| `plane` | [`PlaneData`](/docs/kcl/types/PlaneData) | The plane (e.g. 'XY') which this new plane is created from. | Yes |
|
||||||
| `offset` | [`number`](/docs/kcl/types/number) | Distance from the standard plane this new plane will be created at. | Yes |
|
| `offset` | [`number`](/docs/kcl/types/number) | Distance from the standard plane this new plane will be created at. | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
@ -57,15 +57,15 @@ case = startSketchOn(XY)
|
|||||||
|> startProfileAt([-size, -size], %)
|
|> startProfileAt([-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])
|
|> tangentialArcTo([-size, size], %)
|
||||||
|> close(%)
|
|> close(%)
|
||||||
|> extrude(length = 65)
|
|> extrude(length = 65)
|
||||||
|
|
||||||
thing1 = startSketchOn(case, face = END)
|
thing1 = startSketchOn(case, 'end')
|
||||||
|> circle(center = [-size / 2, -size / 2], radius = 25)
|
|> circle(center = [-size / 2, -size / 2], radius = 25)
|
||||||
|> extrude(length = 50)
|
|> extrude(length = 50)
|
||||||
|
|
||||||
thing2 = startSketchOn(case, face = END)
|
thing2 = startSketchOn(case, 'end')
|
||||||
|> circle(center = [size / 2, -size / 2], radius = 25)
|
|> circle(center = [size / 2, -size / 2], radius = 25)
|
||||||
|> extrude(length = 50)
|
|> extrude(length = 50)
|
||||||
|
|
||||||
@ -88,11 +88,11 @@ case = startSketchOn(XY)
|
|||||||
|> startProfileAt([-size, -size], %)
|
|> startProfileAt([-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])
|
|> tangentialArcTo([-size, size], %)
|
||||||
|> close(%)
|
|> close(%)
|
||||||
|> extrude(length = 65)
|
|> extrude(length = 65)
|
||||||
|
|
||||||
thing1 = startSketchOn(case, face = END)
|
thing1 = startSketchOn(case, 'end')
|
||||||
|> circle(center = [-size / 2, -size / 2], radius = 25)
|
|> circle(center = [-size / 2, -size / 2], radius = 25)
|
||||||
|> extrude(length = 50)
|
|> extrude(length = 50)
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ pow(
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(angle = 50, length = pow(5, 2))
|
|> angledLine({ angle = 50, length = pow(5, 2) }, %)
|
||||||
|> yLine(endAbsolute = 0)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
|
@ -29,8 +29,11 @@ profileStart(sketch: Sketch): [number]
|
|||||||
```js
|
```js
|
||||||
sketch001 = startSketchOn(XY)
|
sketch001 = startSketchOn(XY)
|
||||||
|> startProfileAt([5, 2], %)
|
|> startProfileAt([5, 2], %)
|
||||||
|> angledLine(angle = 120, length = 50, tag = $seg01)
|
|> angledLine({ angle = 120, length = 50 }, %, $seg01)
|
||||||
|> angledLine(angle = segAng(seg01) + 120, length = 50)
|
|> angledLine({
|
||||||
|
angle = segAng(seg01) + 120,
|
||||||
|
length = 50
|
||||||
|
}, %)
|
||||||
|> line(end = profileStart(%))
|
|> line(end = profileStart(%))
|
||||||
|> close()
|
|> close()
|
||||||
|> extrude(length = 20)
|
|> extrude(length = 20)
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -78,7 +78,7 @@ assertEqual(sum, 6, 0.00001, "1 + 2 + 3 summed is 6")
|
|||||||
```js
|
```js
|
||||||
// Declare a function that sketches a decagon.
|
// Declare a function that sketches a decagon.
|
||||||
fn decagon(radius) {
|
fn decagon(radius) {
|
||||||
// Each side of the decagon is turned this many radians from the previous angle.
|
// Each side of the decagon is turned this many degrees from the previous angle.
|
||||||
stepAngle = 1 / 10 * TAU
|
stepAngle = 1 / 10 * TAU
|
||||||
|
|
||||||
// Start the decagon sketch at this point.
|
// Start the decagon sketch at this point.
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -32,9 +32,9 @@ exampleSketch = startSketchOn(XZ)
|
|||||||
|> 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])
|
||||||
|> angledLine(angle = segAng(seg01), length = 10)
|
|> angledLine([segAng(seg01), 10], %)
|
||||||
|> line(end = [-10, 0])
|
|> line(end = [-10, 0])
|
||||||
|> angledLine(angle = segAng(seg01), length = -15)
|
|> angledLine([segAng(seg01), -15], %)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
example = extrude(exampleSketch, length = 4)
|
example = extrude(exampleSketch, length = 4)
|
||||||
|
@ -29,9 +29,9 @@ segLen(tag: TagIdentifier): number
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(angle = 60, length = 10, tag = $thing)
|
|> angledLine({ angle = 60, length = 10 }, %, $thing)
|
||||||
|> tangentialArc(angle = -120, radius = 5)
|
|> tangentialArc({ offset = -120, radius = 5 }, %)
|
||||||
|> angledLine(angle = -60, length = segLen(thing))
|
|> angledLine({ angle = -60, length = segLen(thing) }, %)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
example = extrude(exampleSketch, length = 5)
|
example = extrude(exampleSketch, length = 5)
|
||||||
|
File diff suppressed because one or more lines are too long
@ -33,7 +33,7 @@ sqrt(num: number): number
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(angle = 50, length = sqrt(2500))
|
|> angledLine({ angle = 50, length = sqrt(2500) }, %)
|
||||||
|> yLine(endAbsolute = 0)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ The point is if you want to export the result of a sketch on a face, you only ne
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
startSketchOn(
|
startSketchOn(
|
||||||
planeOrSolid: SketchData,
|
data: SketchData,
|
||||||
face?: FaceTag,
|
tag?: FaceTag,
|
||||||
): SketchSurface
|
): SketchSurface
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -28,8 +28,8 @@ startSketchOn(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `planeOrSolid` | [`SketchData`](/docs/kcl/types/SketchData) | The plane or solid to sketch on | Yes |
|
| `data` | [`SketchData`](/docs/kcl/types/SketchData) | Data for start sketch on. You can start a sketch on a plane or an solid. | Yes |
|
||||||
| `face` | [`FaceTag`](/docs/kcl/types/FaceTag) | Identify a face of a solid if a solid is specified as the input argument (`plane_or_solid`) | No |
|
| [`tag`](/docs/kcl/types/tag) | [`FaceTag`](/docs/kcl/types/FaceTag) | A tag for a face. | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ exampleSketch = startSketchOn(XY)
|
|||||||
|
|
||||||
example = extrude(exampleSketch, length = 5)
|
example = extrude(exampleSketch, length = 5)
|
||||||
|
|
||||||
exampleSketch002 = startSketchOn(example, face = END)
|
exampleSketch002 = startSketchOn(example, 'end')
|
||||||
|> startProfileAt([1, 1], %)
|
|> startProfileAt([1, 1], %)
|
||||||
|> line(end = [8, 0])
|
|> line(end = [8, 0])
|
||||||
|> line(end = [0, 8])
|
|> line(end = [0, 8])
|
||||||
@ -57,7 +57,7 @@ exampleSketch002 = startSketchOn(example, face = END)
|
|||||||
|
|
||||||
example002 = extrude(exampleSketch002, length = 5)
|
example002 = extrude(exampleSketch002, length = 5)
|
||||||
|
|
||||||
exampleSketch003 = startSketchOn(example002, face = END)
|
exampleSketch003 = startSketchOn(example002, 'end')
|
||||||
|> startProfileAt([2, 2], %)
|
|> startProfileAt([2, 2], %)
|
||||||
|> line(end = [6, 0])
|
|> line(end = [6, 0])
|
||||||
|> line(end = [0, 6])
|
|> line(end = [0, 6])
|
||||||
@ -82,7 +82,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, end01)
|
||||||
|> startProfileAt([1, 1], %)
|
|> startProfileAt([1, 1], %)
|
||||||
|> line(end = [8, 0])
|
|> line(end = [8, 0])
|
||||||
|> line(end = [0, 8])
|
|> line(end = [0, 8])
|
||||||
@ -91,7 +91,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, end02)
|
||||||
|> startProfileAt([2, 2], %)
|
|> startProfileAt([2, 2], %)
|
||||||
|> line(end = [6, 0])
|
|> line(end = [6, 0])
|
||||||
|> line(end = [0, 6])
|
|> line(end = [0, 6])
|
||||||
@ -113,7 +113,7 @@ exampleSketch = startSketchOn(XY)
|
|||||||
|
|
||||||
example = extrude(exampleSketch, length = 10)
|
example = extrude(exampleSketch, length = 10)
|
||||||
|
|
||||||
exampleSketch002 = startSketchOn(example, face = sketchingFace)
|
exampleSketch002 = startSketchOn(example, sketchingFace)
|
||||||
|> startProfileAt([1, 1], %)
|
|> startProfileAt([1, 1], %)
|
||||||
|> line(end = [8, 0])
|
|> line(end = [8, 0])
|
||||||
|> line(end = [0, 8])
|
|> line(end = [0, 8])
|
||||||
@ -122,7 +122,7 @@ exampleSketch002 = startSketchOn(example, face = sketchingFace)
|
|||||||
|
|
||||||
example002 = extrude(exampleSketch002, length = 10)
|
example002 = extrude(exampleSketch002, length = 10)
|
||||||
|
|
||||||
exampleSketch003 = startSketchOn(example002, face = sketchingFace002)
|
exampleSketch003 = startSketchOn(example002, sketchingFace002)
|
||||||
|> startProfileAt([-8, 12], %)
|
|> startProfileAt([-8, 12], %)
|
||||||
|> line(end = [0, 6])
|
|> line(end = [0, 6])
|
||||||
|> line(end = [6, 0])
|
|> line(end = [6, 0])
|
||||||
@ -148,7 +148,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, 'end')
|
||||||
|> startProfileAt([4.5, -5], %)
|
|> startProfileAt([4.5, -5], %)
|
||||||
|> line(end = [0, 5])
|
|> line(end = [0, 5])
|
||||||
|> line(end = [5, 0])
|
|> line(end = [5, 0])
|
||||||
@ -182,7 +182,7 @@ example = revolve(
|
|||||||
tagEnd = $end01,
|
tagEnd = $end01,
|
||||||
)
|
)
|
||||||
|
|
||||||
exampleSketch002 = startSketchOn(example, face = end01)
|
exampleSketch002 = startSketchOn(example, end01)
|
||||||
|> startProfileAt([4.5, -5], %)
|
|> startProfileAt([4.5, -5], %)
|
||||||
|> line(end = [0, 5])
|
|> line(end = [0, 5])
|
||||||
|> line(end = [5, 0])
|
|> line(end = [5, 0])
|
||||||
@ -196,10 +196,12 @@ example002 = extrude(exampleSketch002, length = 5)
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
a1 = startSketchOn({
|
a1 = startSketchOn({
|
||||||
origin = { x = 0, y = 0, z = 0 },
|
plane = {
|
||||||
xAxis = { x = 1, y = 0, z = 0 },
|
origin = { x = 0, y = 0, z = 0 },
|
||||||
yAxis = { x = 0, y = 1, z = 0 },
|
xAxis = { x = 1, y = 0, z = 0 },
|
||||||
zAxis = { x = 0, y = 0, z = 1 }
|
yAxis = { x = 0, y = 1, z = 0 },
|
||||||
|
zAxis = { x = 0, y = 0, z = 1 }
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line(end = [100.0, 0])
|
|> line(end = [100.0, 0])
|
||||||
|
@ -9,15 +9,7 @@ Create a helix.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
helix(
|
helix(revolutions: number(_), angleStart: number(deg), ccw?: bool, radius?: number(mm), axis?: Axis3d | Edge, length?: number(mm), cylinder?: Solid): Helix
|
||||||
revolutions: number(_),
|
|
||||||
angleStart: number(Angle),
|
|
||||||
ccw?: bool,
|
|
||||||
radius?: number(Length),
|
|
||||||
axis?: Axis3d | Edge,
|
|
||||||
length?: number(Length),
|
|
||||||
cylinder?: Solid,
|
|
||||||
): Helix
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -26,11 +18,11 @@ 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(deg)` | Start angle (in degrees). | 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(mm)` | 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 |
|
||||||
| `length` | `number(Length)` | Length of the helix. This is not necessary if the helix is created around an edge. If not given the length of the edge is used. | No |
|
| `length` | `number(mm)` | Length of the helix. This is not necessary if the helix is created around an edge. If not given the length of the edge is used. | No |
|
||||||
| `cylinder` | [`Solid`](/docs/kcl/types/Solid) | Cylinder to create the helix on. | No |
|
| `cylinder` | [`Solid`](/docs/kcl/types/Solid) | Cylinder to create the helix on. | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
@ -9,7 +9,7 @@ Compute the cosine of a number (in radians).
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
cos(@num: number(Angle)): number(_)
|
cos(@num: number(rad)): number(_)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ cos(@num: number(Angle)): number(_)
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `num` | `number(Angle)` | | Yes |
|
| `num` | `number(rad)` | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@ -29,10 +29,10 @@ cos(@num: number(Angle)): number(_)
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(
|
|> angledLine({
|
||||||
angle = 30,
|
angle = 30,
|
||||||
length = 3 / cos(toRadians(30)),
|
length = 3 / cos(toRadians(30)),
|
||||||
)
|
}, %)
|
||||||
|> yLine(endAbsolute = 0)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
|
@ -6,14 +6,10 @@ layout: manual
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Convert polar/sphere (azimuth, elevation, distance) coordinates to
|
Convert polar/sphere (azimuth, elevation, distance) coordinates tocartesian (x/y/z grid) coordinates.
|
||||||
cartesian (x/y/z grid) coordinates.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
polar(
|
polar(angle: number(deg), length: number(mm)): [number(mm); 2]
|
||||||
angle: number(Angle),
|
|
||||||
length: number(Length),
|
|
||||||
): Point2d
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -21,12 +17,12 @@ polar(
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `angle` | `number(Angle)` | | Yes |
|
| `angle` | `number(deg)` | | Yes |
|
||||||
| `length` | `number(Length)` | | Yes |
|
| `length` | `number(mm)` | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Point2d`](/docs/kcl/types/Point2d)
|
`[number(mm); 2]`
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
File diff suppressed because one or more lines are too long
@ -9,7 +9,7 @@ Compute the tangent of a number (in radians).
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
tan(@num: number(Angle)): number(_)
|
tan(@num: number(rad)): number(_)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ tan(@num: number(Angle)): number(_)
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `num` | `number(Angle)` | | Yes |
|
| `num` | `number(rad)` | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@ -29,10 +29,10 @@ tan(@num: number(Angle)): number(_)
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(
|
|> angledLine({
|
||||||
angle = 50,
|
angle = 50,
|
||||||
length = 50 * tan(1/2),
|
length = 50 * tan(1/2),
|
||||||
)
|
}, %)
|
||||||
|> yLine(endAbsolute = 0)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -6,16 +6,10 @@ layout: manual
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Construct a 2-dimensional circle, of the specified radius, centered at
|
Construct a 2-dimensional circle, of the specified radius, centered atthe provided (x, y) origin point.
|
||||||
the provided (x, y) origin point.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
circle(
|
circle(@sketch_or_surface: Sketch | Plane | Face, center: Point2d, radius: number, tag?: tag): Sketch
|
||||||
@sketch_or_surface: Sketch | Plane | Face,
|
|
||||||
center: Point2d,
|
|
||||||
radius: number(Length),
|
|
||||||
tag?: tag,
|
|
||||||
): Sketch
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -25,7 +19,7 @@ circle(
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketch_or_surface` | [`Sketch`](/docs/kcl/types/Sketch) OR [`Plane`](/docs/kcl/types/Plane) OR [`Face`](/docs/kcl/types/Face) | Sketch to extend, or plane or surface to sketch on. | Yes |
|
| `sketch_or_surface` | [`Sketch`](/docs/kcl/types/Sketch) OR [`Plane`](/docs/kcl/types/Plane) OR [`Face`](/docs/kcl/types/Face) | Sketch to extend, or plane or surface to sketch on. | Yes |
|
||||||
| `center` | [`Point2d`](/docs/kcl/types/Point2d) | The center of the circle. | Yes |
|
| `center` | [`Point2d`](/docs/kcl/types/Point2d) | The center of the circle. | Yes |
|
||||||
| `radius` | `number(Length)` | The radius of the circle. | Yes |
|
| `radius` | [`number`](/docs/kcl/types/number) | The radius of the circle. | Yes |
|
||||||
| [`tag`](/docs/kcl/types/tag) | [`tag`](/docs/kcl/types/tag) | Create a new tag which refers to this circle. | No |
|
| [`tag`](/docs/kcl/types/tag) | [`tag`](/docs/kcl/types/tag) | Create a new tag which refers to this circle. | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
@ -11,10 +11,7 @@ Only works on unclosed sketches for now.
|
|||||||
Mirror occurs around a local sketch axis rather than a global axis.
|
Mirror occurs around a local sketch axis rather than a global axis.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
mirror2d(
|
mirror2d(@sketches: [Sketch; 1+], axis: Axis2d | Edge): Sketch
|
||||||
@sketches: [Sketch; 1+],
|
|
||||||
axis: Axis2d | Edge,
|
|
||||||
): Sketch
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -103,14 +100,14 @@ example = extrude(sketch001, length = 10)
|
|||||||
sketch0011 = startSketchOn(XY)
|
sketch0011 = startSketchOn(XY)
|
||||||
|> startProfileAt([6.77, 0], %)
|
|> startProfileAt([6.77, 0], %)
|
||||||
|> yLine(length = 1.27)
|
|> yLine(length = 1.27)
|
||||||
|> tangentialArc(endAbsolute = [5.96, 2.37])
|
|> tangentialArcTo([5.96, 2.37], %)
|
||||||
|> tangentialArc(endAbsolute = [-6.2, 2.44])
|
|> tangentialArcTo([-6.2, 2.44], %)
|
||||||
|> tangentialArc(endAbsolute = [-6.6, 1.82])
|
|> tangentialArcTo([-6.6, 1.82], %)
|
||||||
|> yLine(length = -1.82)
|
|> yLine(length = -1.82)
|
||||||
|> mirror2d( axis = X )
|
|> mirror2d( axis = X )
|
||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
|
|
||||||
sketch002 = startSketchOn(sketch0011, face = END)
|
sketch002 = startSketchOn(sketch0011, 'END')
|
||||||
|> circle( center = [-0.01, 1.58], radius = 1.2 )
|
|> circle( center = [-0.01, 1.58], radius = 1.2 )
|
||||||
|> extrude(length = 1.2)
|
|> extrude(length = 1.2)
|
||||||
|
|
||||||
|
77261
docs/kcl/std.json
77261
docs/kcl/std.json
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -31,9 +31,12 @@ tangentToEnd(tag: TagIdentifier): number
|
|||||||
pillSketch = startSketchOn(XZ)
|
pillSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line(end = [20, 0])
|
|> line(end = [20, 0])
|
||||||
|> tangentialArc(end = [0, 10], tag = $arc1)
|
|> tangentialArcToRelative([0, 10], %, $arc1)
|
||||||
|> angledLine(angle = tangentToEnd(arc1), length = 20)
|
|> angledLine({
|
||||||
|> tangentialArc(end = [0, -10])
|
angle = tangentToEnd(arc1),
|
||||||
|
length = 20
|
||||||
|
}, %)
|
||||||
|
|> tangentialArcToRelative([0, -10], %)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
pillExtrude = extrude(pillSketch, length = 10)
|
pillExtrude = extrude(pillSketch, length = 10)
|
||||||
@ -46,9 +49,12 @@ pillExtrude = extrude(pillSketch, length = 10)
|
|||||||
pillSketch = startSketchOn(XZ)
|
pillSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line(end = [0, 20])
|
|> line(end = [0, 20])
|
||||||
|> tangentialArc(endAbsolute = [10, 20], tag = $arc1)
|
|> tangentialArcTo([10, 20], %, $arc1)
|
||||||
|> angledLine(angle = tangentToEnd(arc1), length = 20)
|
|> angledLine({
|
||||||
|> tangentialArc(end = [-10, 0])
|
angle = tangentToEnd(arc1),
|
||||||
|
length = 20
|
||||||
|
}, %)
|
||||||
|
|> tangentialArcToRelative([-10, 0], %)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
pillExtrude = extrude(pillSketch, length = 10)
|
pillExtrude = extrude(pillSketch, length = 10)
|
||||||
@ -60,7 +66,10 @@ pillExtrude = extrude(pillSketch, length = 10)
|
|||||||
rectangleSketch = startSketchOn(XZ)
|
rectangleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line(end = [10, 0], tag = $seg1)
|
|> line(end = [10, 0], tag = $seg1)
|
||||||
|> angledLine(angle = tangentToEnd(seg1), length = 10)
|
|> angledLine({
|
||||||
|
angle = tangentToEnd(seg1),
|
||||||
|
length = 10
|
||||||
|
}, %)
|
||||||
|> line(end = [0, 10])
|
|> line(end = [0, 10])
|
||||||
|> line(end = [-20, 0])
|
|> line(end = [-20, 0])
|
||||||
|> close()
|
|> close()
|
||||||
@ -74,7 +83,7 @@ rectangleExtrude = extrude(rectangleSketch, length = 10)
|
|||||||
bottom = startSketchOn(XY)
|
bottom = startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> arcTo({ end = [10, 10], interior = [5, 1] }, %, $arc1)
|
|> arcTo({ end = [10, 10], interior = [5, 1] }, %, $arc1)
|
||||||
|> angledLine(angle = tangentToEnd(arc1), length = 20)
|
|> angledLine([tangentToEnd(arc1), 20], %)
|
||||||
|> close()
|
|> close()
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -86,7 +95,7 @@ circSketch = startSketchOn(XY)
|
|||||||
|
|
||||||
triangleSketch = startSketchOn(XY)
|
triangleSketch = startSketchOn(XY)
|
||||||
|> startProfileAt([-5, 0], %)
|
|> startProfileAt([-5, 0], %)
|
||||||
|> angledLine(angle = tangentToEnd(circ), length = 10)
|
|> angledLine([tangentToEnd(circ), 10], %)
|
||||||
|> line(end = [-15, 0])
|
|> line(end = [-15, 0])
|
||||||
|> close()
|
|> close()
|
||||||
```
|
```
|
||||||
|
File diff suppressed because one or more lines are too long
@ -35,7 +35,7 @@ tangentialArcTo(
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(angle = 60, length = 10)
|
|> angledLine({ angle = 60, length = 10 }, %)
|
||||||
|> tangentialArcTo([15, 15], %)
|
|> tangentialArcTo([15, 15], %)
|
||||||
|> line(end = [10, -15])
|
|> line(end = [10, -15])
|
||||||
|> close()
|
|> close()
|
||||||
|
@ -35,7 +35,7 @@ tangentialArcToRelative(
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(angle = 45, length = 10)
|
|> angledLine({ angle = 45, length = 10 }, %)
|
||||||
|> tangentialArcToRelative([0, -10], %)
|
|> tangentialArcToRelative([0, -10], %)
|
||||||
|> line(end = [-10, 0])
|
|> line(end = [-10, 0])
|
||||||
|> close()
|
|> close()
|
||||||
|
@ -30,7 +30,7 @@ tau(): number
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(angle = 50, length = 10 * tau())
|
|> angledLine({ angle = 50, length = 10 * tau() }, %)
|
||||||
|> yLine(endAbsolute = 0)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
|
@ -33,7 +33,10 @@ toDegrees(num: number): number
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(angle = 50, length = 70 * cos(toDegrees(pi() / 4)))
|
|> angledLine({
|
||||||
|
angle = 50,
|
||||||
|
length = 70 * cos(toDegrees(pi() / 4))
|
||||||
|
}, %)
|
||||||
|> yLine(endAbsolute = 0)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
|
@ -33,7 +33,10 @@ toRadians(num: number): number
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn(XZ)
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine(angle = 50, length = 70 * cos(toRadians(45)))
|
|> angledLine({
|
||||||
|
angle = 50,
|
||||||
|
length = 70 * cos(toRadians(45))
|
||||||
|
}, %)
|
||||||
|> yLine(endAbsolute = 0)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -184,17 +184,15 @@ way:
|
|||||||
```norun
|
```norun
|
||||||
startSketchOn('XZ')
|
startSketchOn('XZ')
|
||||||
|> startProfileAt(origin, %)
|
|> startProfileAt(origin, %)
|
||||||
|> angledLine(angle = 0, length = 191.26, tag = $rectangleSegmentA001)
|
|> angledLine({angle = 0, length = 191.26}, %, $rectangleSegmentA001)
|
||||||
|> angledLine(
|
|> angledLine({
|
||||||
angle = segAng(rectangleSegmentA001) - 90,
|
angle = segAng(rectangleSegmentA001) - 90,
|
||||||
length = 196.99,
|
length = 196.99,
|
||||||
tag = $rectangleSegmentB001,
|
}, %, $rectangleSegmentB001)
|
||||||
)
|
|> angledLine({
|
||||||
|> angledLine(
|
|
||||||
angle = segAng(rectangleSegmentA001),
|
angle = segAng(rectangleSegmentA001),
|
||||||
length = -segLen(rectangleSegmentA001),
|
length = -segLen(rectangleSegmentA001),
|
||||||
tag = $rectangleSegmentC001,
|
}, %, $rectangleSegmentC001)
|
||||||
)
|
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> close()
|
|> close()
|
||||||
```
|
```
|
||||||
@ -219,17 +217,15 @@ However if the code was written like this:
|
|||||||
fn rect(origin) {
|
fn rect(origin) {
|
||||||
return startSketchOn('XZ')
|
return startSketchOn('XZ')
|
||||||
|> startProfileAt(origin, %)
|
|> startProfileAt(origin, %)
|
||||||
|> angledLine(angle = 0, length = 191.26, tag = $rectangleSegmentA001)
|
|> angledLine({angle = 0, length = 191.26}, %, $rectangleSegmentA001)
|
||||||
|> angledLine(
|
|> angledLine({
|
||||||
angle = segAng(rectangleSegmentA001) - 90,
|
angle = segAng(rectangleSegmentA001) - 90,
|
||||||
length = 196.99,
|
length = 196.99
|
||||||
tag = $rectangleSegmentB001,
|
}, %, $rectangleSegmentB001)
|
||||||
)
|
|> angledLine({
|
||||||
|> angledLine(
|
|
||||||
angle = segAng(rectangleSegmentA001),
|
angle = segAng(rectangleSegmentA001),
|
||||||
length = -segLen(rectangleSegmentA001)
|
length = -segLen(rectangleSegmentA001)
|
||||||
tag = $rectangleSegmentC001,
|
}, %, $rectangleSegmentC001)
|
||||||
)
|
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> close()
|
|> close()
|
||||||
}
|
}
|
||||||
@ -249,17 +245,15 @@ For example the following code works.
|
|||||||
fn rect(origin) {
|
fn rect(origin) {
|
||||||
return startSketchOn('XZ')
|
return startSketchOn('XZ')
|
||||||
|> startProfileAt(origin, %)
|
|> startProfileAt(origin, %)
|
||||||
|> angledLine(angle = 0, length = 191.26, tag = $rectangleSegmentA001)
|
|> angledLine({angle = 0, length = 191.26}, %, $rectangleSegmentA001)
|
||||||
|> angledLine(
|
|> angledLine({
|
||||||
angle = segAng(rectangleSegmentA001) - 90,
|
angle = segAng(rectangleSegmentA001) - 90,
|
||||||
length = 196.99,
|
length = 196.99
|
||||||
tag = $rectangleSegmentB001,
|
}, %, $rectangleSegmentB001)
|
||||||
)
|
|> angledLine({
|
||||||
|> angledLine(
|
|
||||||
angle = segAng(rectangleSegmentA001),
|
angle = segAng(rectangleSegmentA001),
|
||||||
length = -segLen(rectangleSegmentA001)
|
length = -segLen(rectangleSegmentA001)
|
||||||
tag = $rectangleSegmentC001,
|
}, %, $rectangleSegmentC001)
|
||||||
)
|
|
||||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||||
|> close()
|
|> close()
|
||||||
}
|
}
|
||||||
|
46
docs/kcl/types/AngledLineData.md
Normal file
46
docs/kcl/types/AngledLineData.md
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
---
|
||||||
|
title: "AngledLineData"
|
||||||
|
excerpt: "Data to draw an angled line."
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
Data to draw an angled line.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**This schema accepts any of the following:**
|
||||||
|
|
||||||
|
An angle and length with explicitly named parameters
|
||||||
|
|
||||||
|
**Type:** `object`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
| Property | Type | Description | Required |
|
||||||
|
|----------|------|-------------|----------|
|
||||||
|
| `angle` |[`number`](/docs/kcl/types/number)| The angle of the line (in degrees). | No |
|
||||||
|
| `length` |[`number`](/docs/kcl/types/number)| The length of the line. | No |
|
||||||
|
|
||||||
|
|
||||||
|
----
|
||||||
|
An angle and length given as a pair
|
||||||
|
|
||||||
|
**Type:** `array`
|
||||||
|
|
||||||
|
`[number, number]`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -16,8 +16,8 @@ Data for drawing an angled line that intersects with a given line.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `angle` |`TyF64`| The angle of the line. | No |
|
| `angle` |[`number`](/docs/kcl/types/number)| The angle of the line. | No |
|
||||||
| `intersectTag` |[`TagIdentifier`](/docs/kcl/types#tag-identifier)| The tag of the line to intersect with. | No |
|
| `intersectTag` |[`TagIdentifier`](/docs/kcl/types#tag-identifier)| The tag of the line to intersect with. | No |
|
||||||
| `offset` |`TyF64`| The offset from the intersecting line. | No |
|
| `offset` |[`number`](/docs/kcl/types/number)| The offset from the intersecting line. | No |
|
||||||
|
|
||||||
|
|
||||||
|
22
docs/kcl/types/AngledLineToData.md
Normal file
22
docs/kcl/types/AngledLineToData.md
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
title: "AngledLineToData"
|
||||||
|
excerpt: "Data to draw an angled line to a point."
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
Data to draw an angled line to a point.
|
||||||
|
|
||||||
|
**Type:** `object`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
| Property | Type | Description | Required |
|
||||||
|
|----------|------|-------------|----------|
|
||||||
|
| `angle` |[`number`](/docs/kcl/types/number)| The angle of the line. | No |
|
||||||
|
| `to` |[`number`](/docs/kcl/types/number)| The point to draw to. | No |
|
||||||
|
|
||||||
|
|
@ -23,9 +23,9 @@ Angles and radius with an optional tag.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `angleStart` |`TyF64`| The start angle. | No |
|
| `angleStart` |[`number`](/docs/kcl/types/number) (**maximum:** 360.0) (**minimum:** -360.0)| The start angle. | No |
|
||||||
| `angleEnd` |`TyF64`| The end angle. | No |
|
| `angleEnd` |[`number`](/docs/kcl/types/number) (**maximum:** 360.0) (**minimum:** -360.0)| The end angle. | No |
|
||||||
| `radius` |`TyF64`| The radius. | No |
|
| `radius` |[`number`](/docs/kcl/types/number)| The radius. | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -41,9 +41,9 @@ Center, to and radius with an optional tag.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `center` |`[, `TyF64`, `TyF64`]`| The center. | No |
|
| `center` |`[number, number]`| The center. | No |
|
||||||
| `to` |`[, `TyF64`, `TyF64`]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `radius` |`TyF64`| The radius. | No |
|
| `radius` |[`number`](/docs/kcl/types/number)| The radius. | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
@ -16,7 +16,7 @@ Data to draw a three point arc (arcTo).
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `end` |`[, `TyF64`, `TyF64`]`| End point of the arc. A point in 3D space | No |
|
| `end` |`[number, number]`| End point of the arc. A point in 3D space | No |
|
||||||
| `interior` |`[, `TyF64`, `TyF64`]`| Interior point of the arc. A point in 3D space | No |
|
| `interior` |`[number, number]`| Interior point of the arc. A point in 3D space | No |
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ Data to draw a bezier curve.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `to` |`[, `TyF64`, `TyF64`]`| The to point. | No |
|
| `to` |`[number, number]`| The to point. | No |
|
||||||
| `control1` |`[, `TyF64`, `TyF64`]`| The first control point. | No |
|
| `control1` |`[number, number]`| The first control point. | No |
|
||||||
| `control2` |`[, `TyF64`, `TyF64`]`| The second control point. | No |
|
| `control2` |`[number, number]`| The second control point. | No |
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ A fillet.
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `fillet`| | No |
|
| `type` |enum: `fillet`| | No |
|
||||||
| `id` |[`string`](/docs/kcl/types/string)| The id of the engine command that called this fillet. | No |
|
| `id` |[`string`](/docs/kcl/types/string)| The id of the engine command that called this fillet. | No |
|
||||||
| `radius` |`TyF64`| | No |
|
| `radius` |[`number`](/docs/kcl/types/number)| | No |
|
||||||
| `edgeId` |[`string`](/docs/kcl/types/string)| The engine id of the edge to fillet. | No |
|
| `edgeId` |[`string`](/docs/kcl/types/string)| The engine id of the edge to fillet. | No |
|
||||||
| [`tag`](/docs/kcl/types/tag) |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
| [`tag`](/docs/kcl/types/tag) |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ A chamfer.
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `chamfer`| | No |
|
| `type` |enum: `chamfer`| | No |
|
||||||
| `id` |[`string`](/docs/kcl/types/string)| The id of the engine command that called this chamfer. | No |
|
| `id` |[`string`](/docs/kcl/types/string)| The id of the engine command that called this chamfer. | No |
|
||||||
| `length` |`TyF64`| | No |
|
| `length` |[`number`](/docs/kcl/types/number)| | No |
|
||||||
| `edgeId` |[`string`](/docs/kcl/types/string)| The engine id of the edge to chamfer. | No |
|
| `edgeId` |[`string`](/docs/kcl/types/string)| The engine id of the edge to chamfer. | No |
|
||||||
| [`tag`](/docs/kcl/types/tag) |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
| [`tag`](/docs/kcl/types/tag) |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| | No |
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ Data for an imported geometry.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `ImportedGeometry`| | No |
|
| `type` |enum: [`ImportedGeometry`](/docs/kcl/types/ImportedGeometry)| | No |
|
||||||
| `id` |[`string`](/docs/kcl/types/string)| The ID of the imported geometry. | No |
|
| `id` |[`string`](/docs/kcl/types/string)| The ID of the imported geometry. | No |
|
||||||
| `value` |`[` [`string`](/docs/kcl/types/string) `]`| The original file paths. | No |
|
| `value` |`[` [`string`](/docs/kcl/types/string) `]`| The original file paths. | No |
|
||||||
|
|
||||||
|
@ -130,21 +130,6 @@ A unit of length.
|
|||||||
| `type` |enum: `Yards`| | No |
|
| `type` |enum: `Yards`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
**Type:** `object`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description | Required |
|
|
||||||
|----------|------|-------------|----------|
|
|
||||||
| `type` |enum: `Unknown`| | No |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
||||||
@ -193,21 +178,6 @@ A unit of angle.
|
|||||||
| `type` |enum: `Radians`| | No |
|
| `type` |enum: `Radians`| | No |
|
||||||
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
**Type:** `object`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description | Required |
|
|
||||||
|----------|------|-------------|----------|
|
|
||||||
| `type` |enum: `Unknown`| | No |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ layout: manual
|
|||||||
A point in two dimensional space.
|
A point in two dimensional space.
|
||||||
|
|
||||||
```kcl
|
```kcl
|
||||||
type Point2d = [number(Length); 2]
|
type Point2d = [number; 2]
|
||||||
```
|
```
|
||||||
|
|
||||||
[`Point2d`](/docs/kcl/types/Point2d) is an alias for a two-element array of [number](/docs/kcl/types/number)s. To write a value
|
[`Point2d`](/docs/kcl/types/Point2d) is an alias for a two-element array of [number](/docs/kcl/types/number)s. To write a value
|
||||||
|
@ -7,7 +7,7 @@ layout: manual
|
|||||||
A point in three dimensional space.
|
A point in three dimensional space.
|
||||||
|
|
||||||
```kcl
|
```kcl
|
||||||
type Point3d = [number(Length); 3]
|
type Point3d = [number; 3]
|
||||||
```
|
```
|
||||||
|
|
||||||
[`Point3d`](/docs/kcl/types/Point3d) is an alias for a three-element array of [number](/docs/kcl/types/number)s. To write a value
|
[`Point3d`](/docs/kcl/types/Point3d) is an alias for a three-element array of [number](/docs/kcl/types/number)s. To write a value
|
||||||
|
@ -16,9 +16,9 @@ Data for drawing a polygon
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `radius` |`TyF64`| The radius of the polygon | No |
|
| `radius` |[`number`](/docs/kcl/types/number)| The radius of the polygon | No |
|
||||||
| `numSides` |`integer`| The number of sides in the polygon | No |
|
| `numSides` |`integer`| The number of sides in the polygon | No |
|
||||||
| `center` |`[, `TyF64`, `TyF64`]`| The center point of the polygon | No |
|
| `center` |`[number, number]`| The center point of the polygon | No |
|
||||||
| `inscribed` |`boolean`| Whether the polygon is inscribed (true) or circumscribed (false) about a circle with the specified radius | No |
|
| `inscribed` |`boolean`| Whether the polygon is inscribed (true) or circumscribed (false) about a circle with the specified radius | No |
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ Data to draw a tangential arc.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `radius` |`TyF64`| Radius of the arc. Not to be confused with Raiders of the Lost Ark. | No |
|
| `radius` |[`number`](/docs/kcl/types/number)| Radius of the arc. Not to be confused with Raiders of the Lost Ark. | No |
|
||||||
| `offset` |`TyF64`| Offset of the arc, in degrees. | No |
|
| `offset` |[`number`](/docs/kcl/types/number)| Offset of the arc, in degrees. | No |
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,21 +43,6 @@ A unit of angle.
|
|||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
**Type:** `object`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description | Required |
|
|
||||||
|----------|------|-------------|----------|
|
|
||||||
| `type` |enum: `Unknown`| | No |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user