Compare commits
191 Commits
v0.36.0
...
achalmers/
Author | SHA1 | Date | |
---|---|---|---|
0dab8d6f05 | |||
28b5a088d2 | |||
f8f44743fa | |||
f262eda12a | |||
9e1136195a | |||
057face2e2 | |||
57f3cd1ba4 | |||
32d2fb639c | |||
4ff07ddaee | |||
95ad629558 | |||
ae9731b21a | |||
c4ceaaf6b2 | |||
60299c6520 | |||
fcfdffaab8 | |||
fe3ab30627 | |||
259844ef11 | |||
f7ab29047c | |||
82ad0ac8c7 | |||
4463833460 | |||
f48c8fefd6 | |||
73a878b0aa | |||
d04ac2bbb4 | |||
f5ec62ab27 | |||
2c28ad6866 | |||
989a2278cb | |||
01cb6df3b4 | |||
ab00c7bcc8 | |||
1c589960bf | |||
1e565379a7 | |||
a6b2d32b95 | |||
78e1bec0c7 | |||
76e34ac4da | |||
c18c8f9e81 | |||
95b647676b | |||
b5182c89d0 | |||
069b1cb370 | |||
4cd427bf91 | |||
012da726ec | |||
7b3cfb1c2f | |||
5f3cf61d0f | |||
1f3455e840 | |||
260ec9fe45 | |||
f321ecdff0 | |||
1ae55c2946 | |||
d114ab798c | |||
0400f33fc3 | |||
734e590e09 | |||
69fec37107 | |||
2a5433a2a7 | |||
519041c8fa | |||
8ca8c49cc3 | |||
b25fc302fd | |||
c6d563f08f | |||
648b37c1dd | |||
18e5da5ca4 | |||
46524cda10 | |||
4585671a5d | |||
82d6446e5e | |||
e34a4db077 | |||
665ec8a6b5 | |||
ef8131f33d | |||
b7ec0eeb6e | |||
43c12e523b | |||
b74216378d | |||
7031b6f0a7 | |||
e1ce83a72e | |||
f6c335181e | |||
25d9c19763 | |||
871890415c | |||
7f9526bb81 | |||
aafa1a398d | |||
fda7acf0ff | |||
bf306e774d | |||
2abd516db4 | |||
e26d7e741f | |||
91df6b9511 | |||
3cecb99aa1 | |||
e8961d4190 | |||
da3788afba | |||
12ed315244 | |||
9c35c06e58 | |||
a69da088cd | |||
38e59df85c | |||
8bac097743 | |||
09df8a734a | |||
da2072e005 | |||
cb4a47705c | |||
1227b38e12 | |||
8e343a254f | |||
2559309f85 | |||
26f01bce76 | |||
729a34efed | |||
5191013db2 | |||
d653b852dd | |||
f3a2922ba0 | |||
ce8aeab508 | |||
ee6014d0cf | |||
bd329de3e3 | |||
5d1df40de5 | |||
21ea1d785a | |||
987152e166 | |||
6b37bf1809 | |||
617dcfee34 | |||
10c446151b | |||
99866b5f9a | |||
cd022fb087 | |||
fda4aeb505 | |||
d9fe9bafba | |||
9dc06f6b92 | |||
9e778280b3 | |||
141c38c92b | |||
fc7e6993ca | |||
ad8336ef57 | |||
a819d16798 | |||
1c8cc54c9d | |||
70766cef69 | |||
a69ccf960f | |||
308b7121fb | |||
6522f1cbe7 | |||
2943ea1fd6 | |||
ae0860a775 | |||
ff71250d5d | |||
81e2fd201d | |||
de2dfc24dc | |||
84cd2c0c88 | |||
440173d045 | |||
ddafbf059c | |||
e86a5fa614 | |||
d386c92c8e | |||
248b2d2a2b | |||
72f84c3a8f | |||
ecec739632 | |||
cd28a4a9a1 | |||
18b1d84e5c | |||
fb59996c54 | |||
d66c7cfe33 | |||
e917eb9af6 | |||
cc9a14ddd9 | |||
235e526e2d | |||
725ffd952c | |||
2848d6c77c | |||
989ca83971 | |||
bdeda51078 | |||
b079af20da | |||
641efb0750 | |||
69f036e61b | |||
57ca6d52d5 | |||
a186517bd0 | |||
e7203b9e7a | |||
ab375f4b92 | |||
04ed6f52ee | |||
2332338ca1 | |||
41b97de3d1 | |||
8ef31a0be1 | |||
3adb42b5f2 | |||
20016b101e | |||
8d9dbf36c3 | |||
440704ed9f | |||
2261217a5d | |||
10da986649 | |||
10789d9c3c | |||
67cc4f5835 | |||
2692f2b73a | |||
965cb18059 | |||
a022b8ef6c | |||
4d24bf7c94 | |||
9a537da183 | |||
df81b76b8b | |||
ac3f7ab712 | |||
dac91d3b79 | |||
0698432abf | |||
0592d3b5da | |||
31e4d60045 | |||
c0817b00e4 | |||
4ea1d16fb6 | |||
d049bf33e8 | |||
7b11047d07 | |||
412e9568f2 | |||
9be208e5e1 | |||
842ef5ede9 | |||
3f855d7bad | |||
0a1a6e50cf | |||
d4e955289c | |||
c147a219f4 | |||
38513a1e25 | |||
c0c5c790ca | |||
8b60f75220 | |||
f91ad4331f | |||
59103a2118 | |||
9737c2550a | |||
bf9d01a8dd |
@ -1,3 +1,3 @@
|
|||||||
[codespell]
|
[codespell]
|
||||||
ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,atleast,ue,afterall
|
ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,atleast,ue,afterall,ser
|
||||||
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,tsconfig.tsbuildinfo
|
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,tsconfig.tsbuildinfo
|
||||||
|
2
.github/workflows/build-and-store-wasm.yml
vendored
2
.github/workflows/build-and-store-wasm.yml
vendored
@ -27,7 +27,7 @@ jobs:
|
|||||||
|
|
||||||
|
|
||||||
# Upload the WASM bundle as an artifact
|
# Upload the WASM bundle as an artifact
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: wasm-bundle
|
name: wasm-bundle
|
||||||
path: src/wasm-lib/pkg
|
path: src/wasm-lib/pkg
|
||||||
|
8
.github/workflows/build-apps.yml
vendored
8
.github/workflows/build-apps.yml
vendored
@ -126,7 +126,13 @@ jobs:
|
|||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'yarn' # Set this to npm, yarn or pnpm.
|
cache: 'yarn' # Set this to npm, yarn or pnpm.
|
||||||
|
|
||||||
- run: yarn install
|
- name: yarn install
|
||||||
|
# Windows is picky sometimes and fails on fetch. Step takes about ~30s
|
||||||
|
uses: nick-fields/retry@v3.0.0
|
||||||
|
with:
|
||||||
|
timeout_minutes: 2
|
||||||
|
max_attempts: 3
|
||||||
|
command: yarn install
|
||||||
|
|
||||||
- run: yarn tronb:vite
|
- run: yarn tronb:vite
|
||||||
|
|
||||||
|
44
.github/workflows/cargo-bench.yml
vendored
44
.github/workflows/cargo-bench.yml
vendored
@ -1,44 +0,0 @@
|
|||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- '**.rs'
|
|
||||||
- '**/Cargo.toml'
|
|
||||||
- '**/Cargo.lock'
|
|
||||||
- '**/rust-toolchain.toml'
|
|
||||||
- .github/workflows/cargo-bench.yml
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- '**.rs'
|
|
||||||
- '**/Cargo.toml'
|
|
||||||
- '**/Cargo.lock'
|
|
||||||
- '**/rust-toolchain.toml'
|
|
||||||
- .github/workflows/cargo-bench.yml
|
|
||||||
workflow_dispatch:
|
|
||||||
permissions: read-all
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
name: cargo bench
|
|
||||||
jobs:
|
|
||||||
cargo-bench:
|
|
||||||
name: Benchmark with iai
|
|
||||||
runs-on: ubuntu-latest-8-cores
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
cargo install cargo-criterion
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y valgrind
|
|
||||||
- name: Rust Cache
|
|
||||||
uses: Swatinem/rust-cache@v2.6.1
|
|
||||||
- name: Benchmark kcl library
|
|
||||||
shell: bash
|
|
||||||
run: |-
|
|
||||||
cd src/wasm-lib/kcl; cargo bench --all-features -- iai
|
|
||||||
env:
|
|
||||||
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
|
|
||||||
|
|
56
.github/workflows/e2e-tests.yml
vendored
56
.github/workflows/e2e-tests.yml
vendored
@ -126,20 +126,20 @@ jobs:
|
|||||||
- name: build electron
|
- name: build electron
|
||||||
shell: bash
|
shell: bash
|
||||||
run: yarn tron:package
|
run: yarn tron:package
|
||||||
- name: Run ubuntu/chrome snapshots
|
# - name: Run ubuntu/chrome snapshots
|
||||||
if: ${{ matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 }}
|
# if: ${{ matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 }}
|
||||||
shell: bash
|
# shell: bash
|
||||||
# TODO: break this in its own job, for now it's not slowing down the overall execution as ubuntu is the quickest,
|
# # TODO: break this in its own job, for now it's not slowing down the overall execution as ubuntu is the quickest,
|
||||||
# but we could do better. This forces a large 1/1 shard of all 20 snapshot tests that runs in about 3 minutes.
|
# # but we could do better. This forces a large 1/1 shard of all 20 snapshot tests that runs in about 3 minutes.
|
||||||
run: |
|
# run: |
|
||||||
PLATFORM=web yarn playwright test --config=playwright.config.ts --retries="3" --update-snapshots --grep=@snapshot --shard=1/1
|
# PLATFORM=web yarn playwright test --config=playwright.config.ts --retries="3" --update-snapshots --grep=@snapshot --shard=1/1
|
||||||
env:
|
# env:
|
||||||
CI: true
|
# CI: true
|
||||||
NODE_ENV: development
|
# NODE_ENV: development
|
||||||
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
# VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
VITE_KC_SKIP_AUTH: true
|
# VITE_KC_SKIP_AUTH: true
|
||||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
# token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
|
# snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: ${{ !cancelled() && (success() || failure()) }}
|
if: ${{ !cancelled() && (success() || failure()) }}
|
||||||
with:
|
with:
|
||||||
@ -162,20 +162,20 @@ jobs:
|
|||||||
then echo "modified=true" >> $GITHUB_OUTPUT
|
then echo "modified=true" >> $GITHUB_OUTPUT
|
||||||
else echo "modified=false" >> $GITHUB_OUTPUT
|
else echo "modified=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
- name: Commit changes, if any
|
# - name: Commit changes, if any
|
||||||
if: steps.git-check.outputs.modified == 'true'
|
# if: steps.git-check.outputs.modified == 'true'
|
||||||
shell: bash
|
# shell: bash
|
||||||
run: |
|
# run: |
|
||||||
git add .
|
# git add .
|
||||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
# git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git config --local user.name "github-actions[bot]"
|
# git config --local user.name "github-actions[bot]"
|
||||||
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
|
# git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
|
||||||
git fetch origin
|
# git fetch origin
|
||||||
echo ${{ github.head_ref }}
|
# echo ${{ github.head_ref }}
|
||||||
git checkout ${{ github.head_ref }}
|
# git checkout ${{ github.head_ref }}
|
||||||
git commit -am "A snapshot a day keeps the bugs away! 📷🐛 (OS: ${{matrix.os}})" || true
|
# git commit -am "A snapshot a day keeps the bugs away! 📷🐛 (OS: ${{matrix.os}})" || true
|
||||||
git push
|
# git push
|
||||||
git push origin ${{ github.head_ref }}
|
# git push origin ${{ github.head_ref }}
|
||||||
# only upload artifacts if there's actually changes
|
# only upload artifacts if there's actually changes
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: steps.git-check.outputs.modified == 'true'
|
if: steps.git-check.outputs.modified == 'true'
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -25,6 +25,7 @@ yarn-error.log*
|
|||||||
|
|
||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
|
.helix
|
||||||
src/wasm-lib/.idea
|
src/wasm-lib/.idea
|
||||||
src/wasm-lib/.vscode
|
src/wasm-lib/.vscode
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ e2e/playwright/temp3.png
|
|||||||
e2e/playwright/export-snapshots/*
|
e2e/playwright/export-snapshots/*
|
||||||
!e2e/playwright/export-snapshots/*.png
|
!e2e/playwright/export-snapshots/*.png
|
||||||
|
|
||||||
|
/kcl-samples
|
||||||
/test-results/
|
/test-results/
|
||||||
/playwright-report/
|
/playwright-report/
|
||||||
/blob-report/
|
/blob-report/
|
||||||
|
2
.helix/config.toml
Normal file
2
.helix/config.toml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[editor]
|
||||||
|
auto-format = true
|
10
.helix/languages.toml
Normal file
10
.helix/languages.toml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[language-server.eslint]
|
||||||
|
args = ["--stdio"]
|
||||||
|
command = "vscode-eslint-language-server"
|
||||||
|
|
||||||
|
[[language]]
|
||||||
|
name = "typescript"
|
||||||
|
auto-format = true
|
||||||
|
formatter = { command = "node_modules/.bin/prettier", args = ["--parser", "typescript"] }
|
||||||
|
language-servers = [ { name = "eslint", only-features = [ "diagnostics" ] }, "typescript-language-server" ]
|
||||||
|
|
@ -24,5 +24,3 @@ once fixed in engine will just start working here with no language changes.
|
|||||||
chamfer cases work currently.
|
chamfer cases work currently.
|
||||||
|
|
||||||
- **Appearance**: Changing the appearance on a loft does not work.
|
- **Appearance**: Changing the appearance on a loft does not work.
|
||||||
|
|
||||||
- **Helix**: Currently sweeping a helix does not work.
|
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -31,12 +31,12 @@ appearance(data: AppearanceData, solid_set: SolidSet) -> SolidSet
|
|||||||
// Add color to an extruded solid.
|
// Add color to an extruded solid.
|
||||||
exampleSketch = startSketchOn("XZ")
|
exampleSketch = startSketchOn("XZ")
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> lineTo([10, 0], %)
|
|> line(endAbsolute = [10, 0])
|
||||||
|> lineTo([0, 10], %)
|
|> line(endAbsolute = [0, 10])
|
||||||
|> lineTo([-10, 0], %)
|
|> line(endAbsolute = [-10, 0])
|
||||||
|> close(%)
|
|> close()
|
||||||
|
|
||||||
example = extrude(5, exampleSketch)
|
example = extrude(exampleSketch, length = 5)
|
||||||
|> appearance({
|
|> appearance({
|
||||||
color = '#ff0000',
|
color = '#ff0000',
|
||||||
metalness = 50,
|
metalness = 50,
|
||||||
@ -65,11 +65,11 @@ sketch001 = startSketchOn('XY')
|
|||||||
fn cube(center) {
|
fn cube(center) {
|
||||||
return startSketchOn('XY')
|
return startSketchOn('XY')
|
||||||
|> startProfileAt([center[0] - 10, center[1] - 10], %)
|
|> startProfileAt([center[0] - 10, center[1] - 10], %)
|
||||||
|> lineTo([center[0] + 10, center[1] - 10], %)
|
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|
||||||
|> lineTo([center[0] + 10, center[1] + 10], %)
|
|> line(endAbsolute = [center[0] + 10, center[1] + 10])
|
||||||
|> lineTo([center[0] - 10, center[1] + 10], %)
|
|> line(endAbsolute = [center[0] - 10, center[1] + 10])
|
||||||
|> close(%)
|
|> close()
|
||||||
|> extrude(10, %)
|
|> extrude(length = 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
example0 = cube([0, 0])
|
example0 = cube([0, 0])
|
||||||
@ -95,11 +95,11 @@ appearance({
|
|||||||
// This example shows setting the appearance _after_ the shell.
|
// This example shows setting the appearance _after_ the shell.
|
||||||
firstSketch = startSketchOn('XY')
|
firstSketch = startSketchOn('XY')
|
||||||
|> startProfileAt([-12, 12], %)
|
|> startProfileAt([-12, 12], %)
|
||||||
|> line([24, 0], %)
|
|> line(end = [24, 0])
|
||||||
|> line([0, -24], %)
|
|> line(end = [0, -24])
|
||||||
|> line([-24, 0], %)
|
|> line(end = [-24, 0])
|
||||||
|> close(%)
|
|> close()
|
||||||
|> extrude(6, %)
|
|> extrude(length = 6)
|
||||||
|
|
||||||
shell({ faces = ['end'], thickness = 0.25 }, firstSketch)
|
shell({ faces = ['end'], thickness = 0.25 }, firstSketch)
|
||||||
|> appearance({
|
|> appearance({
|
||||||
@ -116,11 +116,11 @@ shell({ faces = ['end'], thickness = 0.25 }, firstSketch)
|
|||||||
// This example shows setting the appearance _before_ the shell.
|
// This example shows setting the appearance _before_ the shell.
|
||||||
firstSketch = startSketchOn('XY')
|
firstSketch = startSketchOn('XY')
|
||||||
|> startProfileAt([-12, 12], %)
|
|> startProfileAt([-12, 12], %)
|
||||||
|> line([24, 0], %)
|
|> line(end = [24, 0])
|
||||||
|> line([0, -24], %)
|
|> line(end = [0, -24])
|
||||||
|> line([-24, 0], %)
|
|> line(end = [-24, 0])
|
||||||
|> close(%)
|
|> close()
|
||||||
|> extrude(6, %)
|
|> extrude(length = 6)
|
||||||
|> appearance({
|
|> appearance({
|
||||||
color = '#ff0000',
|
color = '#ff0000',
|
||||||
metalness = 90,
|
metalness = 90,
|
||||||
@ -137,12 +137,12 @@ shell({ faces = ['end'], thickness = 0.25 }, firstSketch)
|
|||||||
// This example shows _before_ the pattern.
|
// This example shows _before_ the pattern.
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn('XZ')
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line([0, 2], %)
|
|> line(end = [0, 2])
|
||||||
|> line([3, 1], %)
|
|> line(end = [3, 1])
|
||||||
|> line([0, -4], %)
|
|> line(end = [0, -4])
|
||||||
|> close(%)
|
|> close()
|
||||||
|
|
||||||
example = extrude(1, exampleSketch)
|
example = extrude(exampleSketch, length = 1)
|
||||||
|> appearance({
|
|> appearance({
|
||||||
color = '#ff0000',
|
color = '#ff0000',
|
||||||
metalness = 90,
|
metalness = 90,
|
||||||
@ -162,12 +162,12 @@ example = extrude(1, exampleSketch)
|
|||||||
// This example shows _after_ the pattern.
|
// This example shows _after_ the pattern.
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn('XZ')
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line([0, 2], %)
|
|> line(end = [0, 2])
|
||||||
|> line([3, 1], %)
|
|> line(end = [3, 1])
|
||||||
|> line([0, -4], %)
|
|> line(end = [0, -4])
|
||||||
|> close(%)
|
|> close()
|
||||||
|
|
||||||
example = extrude(1, exampleSketch)
|
example = extrude(exampleSketch, length = 1)
|
||||||
|> patternLinear3d({
|
|> patternLinear3d({
|
||||||
axis = [1, 0, 1],
|
axis = [1, 0, 1],
|
||||||
instances = 7,
|
instances = 7,
|
||||||
@ -186,10 +186,10 @@ example = extrude(1, exampleSketch)
|
|||||||
// Color the result of a 2D pattern that was extruded.
|
// Color the result of a 2D pattern that was extruded.
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn('XZ')
|
||||||
|> startProfileAt([.5, 25], %)
|
|> startProfileAt([.5, 25], %)
|
||||||
|> line([0, 5], %)
|
|> line(end = [0, 5])
|
||||||
|> line([-1, 0], %)
|
|> line(end = [-1, 0])
|
||||||
|> line([0, -5], %)
|
|> line(end = [0, -5])
|
||||||
|> close(%)
|
|> close()
|
||||||
|> patternCircular2d({
|
|> patternCircular2d({
|
||||||
center = [0, 0],
|
center = [0, 0],
|
||||||
instances = 13,
|
instances = 13,
|
||||||
@ -197,7 +197,7 @@ exampleSketch = startSketchOn('XZ')
|
|||||||
rotateDuplicates = true
|
rotateDuplicates = true
|
||||||
}, %)
|
}, %)
|
||||||
|
|
||||||
example = extrude(1, exampleSketch)
|
example = extrude(exampleSketch, length = 1)
|
||||||
|> appearance({
|
|> appearance({
|
||||||
color = '#ff0000',
|
color = '#ff0000',
|
||||||
metalness = 90,
|
metalness = 90,
|
||||||
@ -214,11 +214,11 @@ example = extrude(1, exampleSketch)
|
|||||||
// Create a path for the sweep.
|
// Create a path for the sweep.
|
||||||
sweepPath = startSketchOn('XZ')
|
sweepPath = startSketchOn('XZ')
|
||||||
|> startProfileAt([0.05, 0.05], %)
|
|> startProfileAt([0.05, 0.05], %)
|
||||||
|> line([0, 7], %)
|
|> line(end = [0, 7])
|
||||||
|> tangentialArc({ offset = 90, radius = 5 }, %)
|
|> tangentialArc({ offset = 90, radius = 5 }, %)
|
||||||
|> line([-3, 0], %)
|
|> line(end = [-3, 0])
|
||||||
|> tangentialArc({ offset = -90, radius = 5 }, %)
|
|> tangentialArc({ offset = -90, radius = 5 }, %)
|
||||||
|> line([0, 7], %)
|
|> line(end = [0, 7])
|
||||||
|
|
||||||
pipeHole = startSketchOn('XY')
|
pipeHole = startSketchOn('XY')
|
||||||
|> circle({ center = [0, 0], radius = 1.5 }, %)
|
|> circle({ center = [0, 0], radius = 1.5 }, %)
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -36,12 +36,12 @@ filletRadius = 2
|
|||||||
|
|
||||||
mountingPlateSketch = startSketchOn("XY")
|
mountingPlateSketch = startSketchOn("XY")
|
||||||
|> startProfileAt([-width / 2, -length / 2], %)
|
|> startProfileAt([-width / 2, -length / 2], %)
|
||||||
|> lineTo([width / 2, -length / 2], %, $edge1)
|
|> line(endAbsolute = [width / 2, -length / 2], tag = $edge1)
|
||||||
|> lineTo([width / 2, length / 2], %, $edge2)
|
|> line(endAbsolute = [width / 2, length / 2], tag = $edge2)
|
||||||
|> lineTo([-width / 2, length / 2], %, $edge3)
|
|> line(endAbsolute = [-width / 2, length / 2], tag = $edge3)
|
||||||
|> close(%, $edge4)
|
|> close(tag = $edge4)
|
||||||
|
|
||||||
mountingPlate = extrude(thickness, mountingPlateSketch)
|
mountingPlate = extrude(mountingPlateSketch, length = thickness)
|
||||||
|> fillet({
|
|> fillet({
|
||||||
radius = filletRadius,
|
radius = filletRadius,
|
||||||
tags = [
|
tags = [
|
||||||
@ -63,12 +63,12 @@ filletRadius = 1
|
|||||||
|
|
||||||
mountingPlateSketch = startSketchOn("XY")
|
mountingPlateSketch = startSketchOn("XY")
|
||||||
|> startProfileAt([-width / 2, -length / 2], %)
|
|> startProfileAt([-width / 2, -length / 2], %)
|
||||||
|> lineTo([width / 2, -length / 2], %, $edge1)
|
|> line(endAbsolute = [width / 2, -length / 2], tag = $edge1)
|
||||||
|> lineTo([width / 2, length / 2], %, $edge2)
|
|> line(endAbsolute = [width / 2, length / 2], tag = $edge2)
|
||||||
|> lineTo([-width / 2, length / 2], %, $edge3)
|
|> line(endAbsolute = [-width / 2, length / 2], tag = $edge3)
|
||||||
|> close(%, $edge4)
|
|> close(tag = $edge4)
|
||||||
|
|
||||||
mountingPlate = extrude(thickness, mountingPlateSketch)
|
mountingPlate = extrude(mountingPlateSketch, length = thickness)
|
||||||
|> fillet({
|
|> fillet({
|
||||||
radius = filletRadius,
|
radius = filletRadius,
|
||||||
tolerance = 0.000001,
|
tolerance = 0.000001,
|
||||||
|
File diff suppressed because one or more lines are too long
@ -29,14 +29,14 @@ getNextAdjacentEdge(tag: TagIdentifier) -> Uuid
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn('XZ')
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line([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([-10, 0], %)
|
|> line(end = [-10, 0])
|
||||||
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|
||||||
|> close(%)
|
|> close()
|
||||||
|
|
||||||
example = extrude(5, exampleSketch)
|
example = extrude(exampleSketch, length = 5)
|
||||||
|> fillet({
|
|> fillet({
|
||||||
radius = 3,
|
radius = 3,
|
||||||
tags = [getNextAdjacentEdge(referenceEdge)]
|
tags = [getNextAdjacentEdge(referenceEdge)]
|
||||||
|
@ -29,14 +29,14 @@ getOppositeEdge(tag: TagIdentifier) -> Uuid
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn('XZ')
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line([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([-10, 0], %)
|
|> line(end = [-10, 0])
|
||||||
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|
||||||
|> close(%)
|
|> close()
|
||||||
|
|
||||||
example = extrude(5, exampleSketch)
|
example = extrude(exampleSketch, length = 5)
|
||||||
|> fillet({
|
|> fillet({
|
||||||
radius = 3,
|
radius = 3,
|
||||||
tags = [getOppositeEdge(referenceEdge)]
|
tags = [getOppositeEdge(referenceEdge)]
|
||||||
|
@ -29,14 +29,14 @@ getPreviousAdjacentEdge(tag: TagIdentifier) -> Uuid
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn('XZ')
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line([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([-10, 0], %)
|
|> line(end = [-10, 0])
|
||||||
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|
|> angledLine({ angle = 240, length = 10 }, %, $referenceEdge)
|
||||||
|> close(%)
|
|> close()
|
||||||
|
|
||||||
example = extrude(5, exampleSketch)
|
example = extrude(exampleSketch, length = 5)
|
||||||
|> fillet({
|
|> fillet({
|
||||||
radius = 3,
|
radius = 3,
|
||||||
tags = [getPreviousAdjacentEdge(referenceEdge)]
|
tags = [getPreviousAdjacentEdge(referenceEdge)]
|
||||||
|
File diff suppressed because one or more lines are too long
@ -30,7 +30,7 @@ helixRevolutions(data: HelixRevolutionsData, solid: Solid) -> Solid
|
|||||||
```js
|
```js
|
||||||
part001 = startSketchOn('XY')
|
part001 = startSketchOn('XY')
|
||||||
|> circle({ center = [5, 5], radius = 10 }, %)
|
|> circle({ center = [5, 5], radius = 10 }, %)
|
||||||
|> extrude(10, %)
|
|> extrude(length = 10)
|
||||||
|> helixRevolutions({
|
|> helixRevolutions({
|
||||||
angleStart = 0,
|
angleStart = 0,
|
||||||
ccw = true,
|
ccw = true,
|
||||||
|
File diff suppressed because one or more lines are too long
@ -31,11 +31,11 @@ hollow(thickness: number, solid: Solid) -> Solid
|
|||||||
// Hollow a basic sketch.
|
// Hollow a basic sketch.
|
||||||
firstSketch = startSketchOn('XY')
|
firstSketch = startSketchOn('XY')
|
||||||
|> startProfileAt([-12, 12], %)
|
|> startProfileAt([-12, 12], %)
|
||||||
|> line([24, 0], %)
|
|> line(end = [24, 0])
|
||||||
|> line([0, -24], %)
|
|> line(end = [0, -24])
|
||||||
|> line([-24, 0], %)
|
|> line(end = [-24, 0])
|
||||||
|> close(%)
|
|> close()
|
||||||
|> extrude(6, %)
|
|> extrude(length = 6)
|
||||||
|> hollow(0.25, %)
|
|> hollow(0.25, %)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -45,11 +45,11 @@ firstSketch = startSketchOn('XY')
|
|||||||
// Hollow a basic sketch.
|
// Hollow a basic sketch.
|
||||||
firstSketch = startSketchOn('-XZ')
|
firstSketch = startSketchOn('-XZ')
|
||||||
|> startProfileAt([-12, 12], %)
|
|> startProfileAt([-12, 12], %)
|
||||||
|> line([24, 0], %)
|
|> line(end = [24, 0])
|
||||||
|> line([0, -24], %)
|
|> line(end = [0, -24])
|
||||||
|> line([-24, 0], %)
|
|> line(end = [-24, 0])
|
||||||
|> close(%)
|
|> close()
|
||||||
|> extrude(6, %)
|
|> extrude(length = 6)
|
||||||
|> hollow(0.5, %)
|
|> hollow(0.5, %)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -60,25 +60,25 @@ firstSketch = startSketchOn('-XZ')
|
|||||||
size = 100
|
size = 100
|
||||||
case = startSketchOn('-XZ')
|
case = startSketchOn('-XZ')
|
||||||
|> startProfileAt([-size, -size], %)
|
|> startProfileAt([-size, -size], %)
|
||||||
|> line([2 * size, 0], %)
|
|> line(end = [2 * size, 0])
|
||||||
|> line([0, 2 * size], %)
|
|> line(end = [0, 2 * size])
|
||||||
|> tangentialArcTo([-size, size], %)
|
|> tangentialArcTo([-size, size], %)
|
||||||
|> close(%)
|
|> close()
|
||||||
|> extrude(65, %)
|
|> extrude(length = 65)
|
||||||
|
|
||||||
thing1 = startSketchOn(case, 'end')
|
thing1 = startSketchOn(case, 'end')
|
||||||
|> circle({
|
|> circle({
|
||||||
center = [-size / 2, -size / 2],
|
center = [-size / 2, -size / 2],
|
||||||
radius = 25
|
radius = 25
|
||||||
}, %)
|
}, %)
|
||||||
|> extrude(50, %)
|
|> extrude(length = 50)
|
||||||
|
|
||||||
thing2 = startSketchOn(case, 'end')
|
thing2 = startSketchOn(case, 'end')
|
||||||
|> circle({
|
|> circle({
|
||||||
center = [size / 2, -size / 2],
|
center = [size / 2, -size / 2],
|
||||||
radius = 25
|
radius = 25
|
||||||
}, %)
|
}, %)
|
||||||
|> extrude(50, %)
|
|> extrude(length = 50)
|
||||||
|
|
||||||
hollow(0.5, case)
|
hollow(0.5, case)
|
||||||
```
|
```
|
||||||
|
@ -4,14 +4,16 @@ excerpt: "Import a CAD file."
|
|||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**WARNING:** This function is deprecated.
|
||||||
|
|
||||||
Import a CAD file.
|
Import a CAD file.
|
||||||
|
|
||||||
|
**DEPRECATED** Prefer to use import statements.
|
||||||
|
|
||||||
For formats lacking unit data (such as STL, OBJ, or PLY files), the default unit of measurement is millimeters. Alternatively you may specify the unit by passing your desired measurement unit in the options parameter. When importing a GLTF file, the bin file will be imported as well. Import paths are relative to the current project directory.
|
For formats lacking unit data (such as STL, OBJ, or PLY files), the default unit of measurement is millimeters. Alternatively you may specify the unit by passing your desired measurement unit in the options parameter. When importing a GLTF file, the bin file will be imported as well. Import paths are relative to the current project directory.
|
||||||
|
|
||||||
Note: The import command currently only works when using the native Modeling App.
|
Note: The import command currently only works when using the native Modeling App.
|
||||||
|
|
||||||
For importing KCL functions using the `import` statement, see the docs on [KCL modules](/docs/kcl/modules).
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import(file_path: String, options?: ImportFormat) -> ImportedGeometry
|
import(file_path: String, options?: ImportFormat) -> ImportedGeometry
|
||||||
```
|
```
|
||||||
|
@ -51,16 +51,13 @@ layout: manual
|
|||||||
* [`helixRevolutions`](kcl/helixRevolutions)
|
* [`helixRevolutions`](kcl/helixRevolutions)
|
||||||
* [`hole`](kcl/hole)
|
* [`hole`](kcl/hole)
|
||||||
* [`hollow`](kcl/hollow)
|
* [`hollow`](kcl/hollow)
|
||||||
* [`import`](kcl/import)
|
|
||||||
* [`inch`](kcl/inch)
|
* [`inch`](kcl/inch)
|
||||||
* [`int`](kcl/int)
|
|
||||||
* [`lastSegX`](kcl/lastSegX)
|
* [`lastSegX`](kcl/lastSegX)
|
||||||
* [`lastSegY`](kcl/lastSegY)
|
* [`lastSegY`](kcl/lastSegY)
|
||||||
* [`legAngX`](kcl/legAngX)
|
* [`legAngX`](kcl/legAngX)
|
||||||
* [`legAngY`](kcl/legAngY)
|
* [`legAngY`](kcl/legAngY)
|
||||||
* [`legLen`](kcl/legLen)
|
* [`legLen`](kcl/legLen)
|
||||||
* [`line`](kcl/line)
|
* [`line`](kcl/line)
|
||||||
* [`lineTo`](kcl/lineTo)
|
|
||||||
* [`ln`](kcl/ln)
|
* [`ln`](kcl/ln)
|
||||||
* [`loft`](kcl/loft)
|
* [`loft`](kcl/loft)
|
||||||
* [`log`](kcl/log)
|
* [`log`](kcl/log)
|
||||||
|
@ -4,6 +4,8 @@ excerpt: "Convert a number to an integer."
|
|||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**WARNING:** This function is deprecated.
|
||||||
|
|
||||||
Convert a number to an integer.
|
Convert a number to an integer.
|
||||||
|
|
||||||
DEPRECATED use floor(), ceil(), or round().
|
DEPRECATED use floor(), ceil(), or round().
|
||||||
@ -36,7 +38,7 @@ assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3")
|
|||||||
// Draw n cylinders.
|
// Draw n cylinders.
|
||||||
startSketchOn('XZ')
|
startSketchOn('XZ')
|
||||||
|> circle({ center = [0, 0], radius = 2 }, %)
|
|> circle({ center = [0, 0], radius = 2 }, %)
|
||||||
|> extrude(5, %)
|
|> extrude(length = 5)
|
||||||
|> patternTransform(n, fn(id) {
|
|> patternTransform(n, fn(id) {
|
||||||
return { translate = [4 * id, 0, 0] }
|
return { translate = [4 * id, 0, 0] }
|
||||||
}, %)
|
}, %)
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -31,7 +31,7 @@ patternCircular3d(data: CircularPattern3dData, solid_set: SolidSet) -> [Solid]
|
|||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn('XZ')
|
||||||
|> circle({ center = [0, 0], radius = 1 }, %)
|
|> circle({ center = [0, 0], radius = 1 }, %)
|
||||||
|
|
||||||
example = extrude(-5, exampleSketch)
|
example = extrude(exampleSketch, length = -5)
|
||||||
|> patternCircular3d({
|
|> patternCircular3d({
|
||||||
axis = [1, -1, 0],
|
axis = [1, -1, 0],
|
||||||
center = [10, -20, 0],
|
center = [10, -20, 0],
|
||||||
|
File diff suppressed because one or more lines are too long
@ -30,12 +30,12 @@ patternLinear3d(data: LinearPattern3dData, solid_set: SolidSet) -> [Solid]
|
|||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn('XZ')
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line([0, 2], %)
|
|> line(end = [0, 2])
|
||||||
|> line([3, 1], %)
|
|> line(end = [3, 1])
|
||||||
|> line([0, -4], %)
|
|> line(end = [0, -4])
|
||||||
|> close(%)
|
|> close()
|
||||||
|
|
||||||
example = extrude(1, exampleSketch)
|
example = extrude(exampleSketch, length = 1)
|
||||||
|> patternLinear3d({
|
|> patternLinear3d({
|
||||||
axis = [1, 0, 1],
|
axis = [1, 0, 1],
|
||||||
instances = 7,
|
instances = 7,
|
||||||
|
@ -63,7 +63,7 @@ fn transform(id) {
|
|||||||
// Sketch 4 cylinders.
|
// Sketch 4 cylinders.
|
||||||
sketch001 = startSketchOn('XZ')
|
sketch001 = startSketchOn('XZ')
|
||||||
|> circle({ center = [0, 0], radius = 2 }, %)
|
|> circle({ center = [0, 0], radius = 2 }, %)
|
||||||
|> extrude(5, %)
|
|> extrude(length = 5)
|
||||||
|> patternTransform(4, transform, %)
|
|> patternTransform(4, transform, %)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ fn transform(id) {
|
|||||||
|
|
||||||
sketch001 = startSketchOn('XZ')
|
sketch001 = startSketchOn('XZ')
|
||||||
|> circle({ center = [0, 0], radius = 2 }, %)
|
|> circle({ center = [0, 0], radius = 2 }, %)
|
||||||
|> extrude(5, %)
|
|> extrude(length = 5)
|
||||||
|> patternTransform(4, transform, %)
|
|> patternTransform(4, transform, %)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -97,12 +97,12 @@ fn cube(length, center) {
|
|||||||
|
|
||||||
return startSketchOn('XY')
|
return startSketchOn('XY')
|
||||||
|> startProfileAt(p0, %)
|
|> startProfileAt(p0, %)
|
||||||
|> lineTo(p1, %)
|
|> line(endAbsolute = p1)
|
||||||
|> lineTo(p2, %)
|
|> line(endAbsolute = p2)
|
||||||
|> lineTo(p3, %)
|
|> line(endAbsolute = p3)
|
||||||
|> lineTo(p0, %)
|
|> line(endAbsolute = p0)
|
||||||
|> close(%)
|
|> close()
|
||||||
|> extrude(length, %)
|
|> extrude(length = length)
|
||||||
}
|
}
|
||||||
|
|
||||||
width = 20
|
width = 20
|
||||||
@ -135,12 +135,12 @@ fn cube(length, center) {
|
|||||||
|
|
||||||
return startSketchOn('XY')
|
return startSketchOn('XY')
|
||||||
|> startProfileAt(p0, %)
|
|> startProfileAt(p0, %)
|
||||||
|> lineTo(p1, %)
|
|> line(endAbsolute = p1)
|
||||||
|> lineTo(p2, %)
|
|> line(endAbsolute = p2)
|
||||||
|> lineTo(p3, %)
|
|> line(endAbsolute = p3)
|
||||||
|> lineTo(p0, %)
|
|> line(endAbsolute = p0)
|
||||||
|> close(%)
|
|> close()
|
||||||
|> extrude(length, %)
|
|> extrude(length = length)
|
||||||
}
|
}
|
||||||
|
|
||||||
width = 20
|
width = 20
|
||||||
@ -179,7 +179,7 @@ fn layer() {
|
|||||||
return startSketchOn("XY")
|
return startSketchOn("XY")
|
||||||
// or some other plane idk
|
// or some other plane idk
|
||||||
|> circle({ center = [0, 0], radius = 1 }, %, $tag1)
|
|> circle({ center = [0, 0], radius = 1 }, %, $tag1)
|
||||||
|> extrude(h, %)
|
|> extrude(length = h)
|
||||||
}
|
}
|
||||||
// The vase is 100 layers tall.
|
// The vase is 100 layers tall.
|
||||||
// The 100 layers are replica of each other, with a slight transformation applied to each.
|
// The 100 layers are replica of each other, with a slight transformation applied to each.
|
||||||
@ -205,7 +205,7 @@ startSketchOn('XY')
|
|||||||
center = [0, 0],
|
center = [0, 0],
|
||||||
inscribed = false
|
inscribed = false
|
||||||
}, %)
|
}, %)
|
||||||
|> extrude(4, %)
|
|> extrude(length = 4)
|
||||||
|> patternTransform(3, transform, %)
|
|> patternTransform(3, transform, %)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -30,12 +30,12 @@ segEnd(tag: TagIdentifier) -> [number]
|
|||||||
w = 15
|
w = 15
|
||||||
cube = startSketchOn('XY')
|
cube = startSketchOn('XY')
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line([w, 0], %, $line1)
|
|> line(end = [w, 0], tag = $line1)
|
||||||
|> line([0, w], %, $line2)
|
|> line(end = [0, w], tag = $line2)
|
||||||
|> line([-w, 0], %, $line3)
|
|> line(end = [-w, 0], tag = $line3)
|
||||||
|> line([0, -w], %, $line4)
|
|> line(end = [0, -w], tag = $line4)
|
||||||
|> close(%)
|
|> close()
|
||||||
|> extrude(5, %)
|
|> extrude(length = 5)
|
||||||
|
|
||||||
fn cylinder(radius, tag) {
|
fn cylinder(radius, tag) {
|
||||||
return startSketchOn('XY')
|
return startSketchOn('XY')
|
||||||
@ -44,7 +44,7 @@ fn cylinder(radius, tag) {
|
|||||||
radius = radius,
|
radius = radius,
|
||||||
center = segEnd(tag)
|
center = segEnd(tag)
|
||||||
}, %)
|
}, %)
|
||||||
|> extrude(radius, %)
|
|> extrude(length = radius)
|
||||||
}
|
}
|
||||||
|
|
||||||
cylinder(1, line1)
|
cylinder(1, line1)
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -30,12 +30,12 @@ segStart(tag: TagIdentifier) -> [number]
|
|||||||
w = 15
|
w = 15
|
||||||
cube = startSketchOn('XY')
|
cube = startSketchOn('XY')
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line([w, 0], %, $line1)
|
|> line(end = [w, 0], tag = $line1)
|
||||||
|> line([0, w], %, $line2)
|
|> line(end = [0, w], tag = $line2)
|
||||||
|> line([-w, 0], %, $line3)
|
|> line(end = [-w, 0], tag = $line3)
|
||||||
|> line([0, -w], %, $line4)
|
|> line(end = [0, -w], tag = $line4)
|
||||||
|> close(%)
|
|> close()
|
||||||
|> extrude(5, %)
|
|> extrude(length = 5)
|
||||||
|
|
||||||
fn cylinder(radius, tag) {
|
fn cylinder(radius, tag) {
|
||||||
return startSketchOn('XY')
|
return startSketchOn('XY')
|
||||||
@ -44,7 +44,7 @@ fn cylinder(radius, tag) {
|
|||||||
radius = radius,
|
radius = radius,
|
||||||
center = segStart(tag)
|
center = segStart(tag)
|
||||||
}, %)
|
}, %)
|
||||||
|> extrude(radius, %)
|
|> extrude(length = radius)
|
||||||
}
|
}
|
||||||
|
|
||||||
cylinder(1, line1)
|
cylinder(1, line1)
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -31,11 +31,11 @@ shell(data: ShellData, solid_set: SolidSet) -> SolidSet
|
|||||||
// Remove the end face for the extrusion.
|
// Remove the end face for the extrusion.
|
||||||
firstSketch = startSketchOn('XY')
|
firstSketch = startSketchOn('XY')
|
||||||
|> startProfileAt([-12, 12], %)
|
|> startProfileAt([-12, 12], %)
|
||||||
|> line([24, 0], %)
|
|> line(end = [24, 0])
|
||||||
|> line([0, -24], %)
|
|> line(end = [0, -24])
|
||||||
|> line([-24, 0], %)
|
|> line(end = [-24, 0])
|
||||||
|> close(%)
|
|> close()
|
||||||
|> extrude(6, %)
|
|> extrude(length = 6)
|
||||||
|
|
||||||
// Remove the end face for the extrusion.
|
// Remove the end face for the extrusion.
|
||||||
shell({ faces = ['end'], thickness = 0.25 }, firstSketch)
|
shell({ faces = ['end'], thickness = 0.25 }, firstSketch)
|
||||||
@ -47,11 +47,11 @@ shell({ faces = ['end'], thickness = 0.25 }, firstSketch)
|
|||||||
// Remove the start face for the extrusion.
|
// Remove the start face for the extrusion.
|
||||||
firstSketch = startSketchOn('-XZ')
|
firstSketch = startSketchOn('-XZ')
|
||||||
|> startProfileAt([-12, 12], %)
|
|> startProfileAt([-12, 12], %)
|
||||||
|> line([24, 0], %)
|
|> line(end = [24, 0])
|
||||||
|> line([0, -24], %)
|
|> line(end = [0, -24])
|
||||||
|> line([-24, 0], %)
|
|> line(end = [-24, 0])
|
||||||
|> close(%)
|
|> close()
|
||||||
|> extrude(6, %)
|
|> extrude(length = 6)
|
||||||
|
|
||||||
// Remove the start face for the extrusion.
|
// Remove the start face for the extrusion.
|
||||||
shell({ faces = ['start'], thickness = 0.25 }, firstSketch)
|
shell({ faces = ['start'], thickness = 0.25 }, firstSketch)
|
||||||
@ -63,11 +63,11 @@ shell({ faces = ['start'], thickness = 0.25 }, firstSketch)
|
|||||||
// Remove a tagged face and the end face for the extrusion.
|
// Remove a tagged face and the end face for the extrusion.
|
||||||
firstSketch = startSketchOn('XY')
|
firstSketch = startSketchOn('XY')
|
||||||
|> startProfileAt([-12, 12], %)
|
|> startProfileAt([-12, 12], %)
|
||||||
|> line([24, 0], %)
|
|> line(end = [24, 0])
|
||||||
|> line([0, -24], %)
|
|> line(end = [0, -24])
|
||||||
|> line([-24, 0], %, $myTag)
|
|> line(end = [-24, 0], tag = $myTag)
|
||||||
|> close(%)
|
|> close()
|
||||||
|> extrude(6, %)
|
|> extrude(length = 6)
|
||||||
|
|
||||||
// Remove a tagged face for the extrusion.
|
// Remove a tagged face for the extrusion.
|
||||||
shell({ faces = [myTag], thickness = 0.25 }, firstSketch)
|
shell({ faces = [myTag], thickness = 0.25 }, firstSketch)
|
||||||
@ -79,11 +79,11 @@ shell({ faces = [myTag], thickness = 0.25 }, firstSketch)
|
|||||||
// Remove multiple faces at once.
|
// Remove multiple faces at once.
|
||||||
firstSketch = startSketchOn('XY')
|
firstSketch = startSketchOn('XY')
|
||||||
|> startProfileAt([-12, 12], %)
|
|> startProfileAt([-12, 12], %)
|
||||||
|> line([24, 0], %)
|
|> line(end = [24, 0])
|
||||||
|> line([0, -24], %)
|
|> line(end = [0, -24])
|
||||||
|> line([-24, 0], %, $myTag)
|
|> line(end = [-24, 0], tag = $myTag)
|
||||||
|> close(%)
|
|> close()
|
||||||
|> extrude(6, %)
|
|> extrude(length = 6)
|
||||||
|
|
||||||
// Remove a tagged face and the end face for the extrusion.
|
// Remove a tagged face and the end face for the extrusion.
|
||||||
shell({
|
shell({
|
||||||
@ -99,25 +99,25 @@ shell({
|
|||||||
size = 100
|
size = 100
|
||||||
case = startSketchOn('-XZ')
|
case = startSketchOn('-XZ')
|
||||||
|> startProfileAt([-size, -size], %)
|
|> startProfileAt([-size, -size], %)
|
||||||
|> line([2 * size, 0], %)
|
|> line(end = [2 * size, 0])
|
||||||
|> line([0, 2 * size], %)
|
|> line(end = [0, 2 * size])
|
||||||
|> tangentialArcTo([-size, size], %)
|
|> tangentialArcTo([-size, size], %)
|
||||||
|> close(%)
|
|> close()
|
||||||
|> extrude(65, %)
|
|> extrude(length = 65)
|
||||||
|
|
||||||
thing1 = startSketchOn(case, 'end')
|
thing1 = startSketchOn(case, 'end')
|
||||||
|> circle({
|
|> circle({
|
||||||
center = [-size / 2, -size / 2],
|
center = [-size / 2, -size / 2],
|
||||||
radius = 25
|
radius = 25
|
||||||
}, %)
|
}, %)
|
||||||
|> extrude(50, %)
|
|> extrude(length = 50)
|
||||||
|
|
||||||
thing2 = startSketchOn(case, 'end')
|
thing2 = startSketchOn(case, 'end')
|
||||||
|> circle({
|
|> circle({
|
||||||
center = [size / 2, -size / 2],
|
center = [size / 2, -size / 2],
|
||||||
radius = 25
|
radius = 25
|
||||||
}, %)
|
}, %)
|
||||||
|> extrude(50, %)
|
|> extrude(length = 50)
|
||||||
|
|
||||||
// We put "case" in the shell function to shell the entire object.
|
// We put "case" in the shell function to shell the entire object.
|
||||||
shell({ faces = ['start'], thickness = 5 }, case)
|
shell({ faces = ['start'], thickness = 5 }, case)
|
||||||
@ -130,25 +130,25 @@ shell({ faces = ['start'], thickness = 5 }, case)
|
|||||||
size = 100
|
size = 100
|
||||||
case = startSketchOn('XY')
|
case = startSketchOn('XY')
|
||||||
|> startProfileAt([-size, -size], %)
|
|> startProfileAt([-size, -size], %)
|
||||||
|> line([2 * size, 0], %)
|
|> line(end = [2 * size, 0])
|
||||||
|> line([0, 2 * size], %)
|
|> line(end = [0, 2 * size])
|
||||||
|> tangentialArcTo([-size, size], %)
|
|> tangentialArcTo([-size, size], %)
|
||||||
|> close(%)
|
|> close()
|
||||||
|> extrude(65, %)
|
|> extrude(length = 65)
|
||||||
|
|
||||||
thing1 = startSketchOn(case, 'end')
|
thing1 = startSketchOn(case, 'end')
|
||||||
|> circle({
|
|> circle({
|
||||||
center = [-size / 2, -size / 2],
|
center = [-size / 2, -size / 2],
|
||||||
radius = 25
|
radius = 25
|
||||||
}, %)
|
}, %)
|
||||||
|> extrude(50, %)
|
|> extrude(length = 50)
|
||||||
|
|
||||||
thing2 = startSketchOn(case, 'end')
|
thing2 = startSketchOn(case, 'end')
|
||||||
|> circle({
|
|> circle({
|
||||||
center = [size / 2, -size / 2],
|
center = [size / 2, -size / 2],
|
||||||
radius = 25
|
radius = 25
|
||||||
}, %)
|
}, %)
|
||||||
|> extrude(50, %)
|
|> extrude(length = 50)
|
||||||
|
|
||||||
// We put "thing1" in the shell function to shell the end face of the object.
|
// We put "thing1" in the shell function to shell the end face of the object.
|
||||||
shell({ faces = ['end'], thickness = 5 }, thing1)
|
shell({ faces = ['end'], thickness = 5 }, thing1)
|
||||||
@ -164,25 +164,25 @@ shell({ faces = ['end'], thickness = 5 }, thing1)
|
|||||||
size = 100
|
size = 100
|
||||||
case = startSketchOn('XY')
|
case = startSketchOn('XY')
|
||||||
|> startProfileAt([-size, -size], %)
|
|> startProfileAt([-size, -size], %)
|
||||||
|> line([2 * size, 0], %)
|
|> line(end = [2 * size, 0])
|
||||||
|> line([0, 2 * size], %)
|
|> line(end = [0, 2 * size])
|
||||||
|> tangentialArcTo([-size, size], %)
|
|> tangentialArcTo([-size, size], %)
|
||||||
|> close(%)
|
|> close()
|
||||||
|> extrude(65, %)
|
|> extrude(length = 65)
|
||||||
|
|
||||||
thing1 = startSketchOn(case, 'end')
|
thing1 = startSketchOn(case, 'end')
|
||||||
|> circle({
|
|> circle({
|
||||||
center = [-size / 2, -size / 2],
|
center = [-size / 2, -size / 2],
|
||||||
radius = 25
|
radius = 25
|
||||||
}, %)
|
}, %)
|
||||||
|> extrude(50, %)
|
|> extrude(length = 50)
|
||||||
|
|
||||||
thing2 = startSketchOn(case, 'end')
|
thing2 = startSketchOn(case, 'end')
|
||||||
|> circle({
|
|> circle({
|
||||||
center = [size / 2, -size / 2],
|
center = [size / 2, -size / 2],
|
||||||
radius = 25
|
radius = 25
|
||||||
}, %)
|
}, %)
|
||||||
|> extrude(50, %)
|
|> extrude(length = 50)
|
||||||
|
|
||||||
// We put "thing1" and "thing2" in the shell function to shell the end face of the object.
|
// We put "thing1" and "thing2" in the shell function to shell the end face of the object.
|
||||||
shell({ faces = ['end'], thickness = 5 }, [thing1, thing2])
|
shell({ faces = ['end'], thickness = 5 }, [thing1, thing2])
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
29260
docs/kcl/std.json
29260
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
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
28
docs/kcl/types/Face.md
Normal file
28
docs/kcl/types/Face.md
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
title: "Face"
|
||||||
|
excerpt: "A face."
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
A face.
|
||||||
|
|
||||||
|
**Type:** `object`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
| Property | Type | Description | Required |
|
||||||
|
|----------|------|-------------|----------|
|
||||||
|
| `id` |`string`| The id of the face. | No |
|
||||||
|
| `value` |`string`| The tag of the face. | No |
|
||||||
|
| `xAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the face’s X axis be? | No |
|
||||||
|
| `yAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the face’s Y axis be? | No |
|
||||||
|
| `zAxis` |[`Point3d`](/docs/kcl/types/Point3d)| The z-axis (normal). | No |
|
||||||
|
| `solid` |[`Solid`](/docs/kcl/types/Solid)| The solid the face is on. | No |
|
||||||
|
| `units` |[`UnitLen`](/docs/kcl/types/UnitLen)| A face. | No |
|
||||||
|
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
||||||
|
|
||||||
|
|
@ -20,6 +20,7 @@ A helix.
|
|||||||
| `revolutions` |`number`| Number of revolutions. | No |
|
| `revolutions` |`number`| Number of revolutions. | No |
|
||||||
| `angleStart` |`number`| Start angle (in degrees). | No |
|
| `angleStart` |`number`| Start angle (in degrees). | No |
|
||||||
| `ccw` |`boolean`| Is the helix rotation counter clockwise? | No |
|
| `ccw` |`boolean`| Is the helix rotation counter clockwise? | No |
|
||||||
|
| `units` |[`UnitLen`](/docs/kcl/types/UnitLen)| A helix. | No |
|
||||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ A helix.
|
|||||||
| `revolutions` |`number`| Number of revolutions. | No |
|
| `revolutions` |`number`| Number of revolutions. | No |
|
||||||
| `angleStart` |`number`| Start angle (in degrees). | No |
|
| `angleStart` |`number`| Start angle (in degrees). | No |
|
||||||
| `ccw` |`boolean`| Is the helix rotation counter clockwise? | No |
|
| `ccw` |`boolean`| Is the helix rotation counter clockwise? | No |
|
||||||
|
| `units` |[`UnitLen`](/docs/kcl/types/UnitLen)| A helix. | No |
|
||||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
||||||
|
|
||||||
|
|
||||||
|
@ -168,7 +168,6 @@ Any KCL value.
|
|||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
A plane.
|
|
||||||
|
|
||||||
**Type:** `object`
|
**Type:** `object`
|
||||||
|
|
||||||
@ -181,17 +180,10 @@ A plane.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`Plane`](/docs/kcl/types/Plane)| | No |
|
| `type` |enum: [`Plane`](/docs/kcl/types/Plane)| | No |
|
||||||
| `id` |`string`| The id of the plane. | No |
|
| `value` |[`Plane`](/docs/kcl/types/Plane)| Any KCL value. | No |
|
||||||
| `value` |[`PlaneType`](/docs/kcl/types/PlaneType)| Any KCL value. | No |
|
|
||||||
| `origin` |[`Point3d`](/docs/kcl/types/Point3d)| Origin of the plane. | No |
|
|
||||||
| `xAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the plane’s X axis be? | No |
|
|
||||||
| `yAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the plane’s Y axis be? | No |
|
|
||||||
| `zAxis` |[`Point3d`](/docs/kcl/types/Point3d)| The z-axis (normal). | No |
|
|
||||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
A face.
|
|
||||||
|
|
||||||
**Type:** `object`
|
**Type:** `object`
|
||||||
|
|
||||||
@ -203,14 +195,8 @@ A face.
|
|||||||
|
|
||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `Face`| | No |
|
| `type` |enum: [`Face`](/docs/kcl/types/Face)| | No |
|
||||||
| `id` |`string`| The id of the face. | No |
|
| `value` |[`Face`](/docs/kcl/types/Face)| Any KCL value. | No |
|
||||||
| `value` |`string`| The tag of the face. | No |
|
|
||||||
| `xAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the face’s X axis be? | No |
|
|
||||||
| `yAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the face’s Y axis be? | No |
|
|
||||||
| `zAxis` |[`Point3d`](/docs/kcl/types/Point3d)| The z-axis (normal). | No |
|
|
||||||
| `solid` |[`Solid`](/docs/kcl/types/Solid)| The solid the face is on. | No |
|
|
||||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -246,7 +232,6 @@ A face.
|
|||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
An solid is a collection of extrude surfaces.
|
|
||||||
|
|
||||||
**Type:** `object`
|
**Type:** `object`
|
||||||
|
|
||||||
@ -259,14 +244,7 @@ An solid is a collection of extrude surfaces.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`Solid`](/docs/kcl/types/Solid)| | No |
|
| `type` |enum: [`Solid`](/docs/kcl/types/Solid)| | No |
|
||||||
| `id` |`string`| The id of the solid. | No |
|
| `value` |[`Solid`](/docs/kcl/types/Solid)| Any KCL value. | No |
|
||||||
| `value` |`[` [`ExtrudeSurface`](/docs/kcl/types/ExtrudeSurface) `]`| The extrude surfaces. | No |
|
|
||||||
| `sketch` |[`Sketch`](/docs/kcl/types/Sketch)| The sketch. | No |
|
|
||||||
| `height` |`number`| The height of the solid. | No |
|
|
||||||
| `startCapId` |`string`| The id of the extrusion start cap | No |
|
|
||||||
| `endCapId` |`string`| The id of the extrusion end cap | No |
|
|
||||||
| `edgeCuts` |`[` [`EdgeCut`](/docs/kcl/types/EdgeCut) `]`| Chamfers or fillets on this solid. | No |
|
|
||||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| Metadata. | No |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -286,7 +264,6 @@ An solid is a collection of extrude surfaces.
|
|||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
A helix.
|
|
||||||
|
|
||||||
**Type:** `object`
|
**Type:** `object`
|
||||||
|
|
||||||
@ -299,11 +276,7 @@ A helix.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: [`Helix`](/docs/kcl/types/Helix)| | No |
|
| `type` |enum: [`Helix`](/docs/kcl/types/Helix)| | No |
|
||||||
| `value` |`string`| The id of the helix. | No |
|
| `value` |[`Helix`](/docs/kcl/types/Helix)| Any KCL value. | No |
|
||||||
| `revolutions` |`number`| Number of revolutions. | No |
|
|
||||||
| `angleStart` |`number`| Start angle (in degrees). | No |
|
|
||||||
| `ccw` |`boolean`| Is the helix rotation counter clockwise? | No |
|
|
||||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
|
||||||
|
|
||||||
|
|
||||||
----
|
----
|
||||||
|
@ -22,6 +22,7 @@ A plane.
|
|||||||
| `xAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the plane’s X axis be? | No |
|
| `xAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the plane’s X axis be? | No |
|
||||||
| `yAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the plane’s Y axis be? | No |
|
| `yAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the plane’s Y axis be? | No |
|
||||||
| `zAxis` |[`Point3d`](/docs/kcl/types/Point3d)| The z-axis (normal). | No |
|
| `zAxis` |[`Point3d`](/docs/kcl/types/Point3d)| The z-axis (normal). | No |
|
||||||
|
| `units` |[`UnitLen`](/docs/kcl/types/UnitLen)| A plane. | No |
|
||||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
||||||
|
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user