Compare commits
1 Commits
jtran/plus
...
nrc-doc-si
| Author | SHA1 | Date | |
|---|---|---|---|
| ff1be99351 |
@ -9,7 +9,6 @@ VITE_KC_SITE_BASE_URL=https://dev.zoo.dev
|
||||
VITE_KC_SITE_APP_URL=https://app.dev.zoo.dev
|
||||
VITE_KC_SKIP_AUTH=false
|
||||
VITE_KC_CONNECTION_TIMEOUT_MS=5000
|
||||
#VITE_WASM_URL="optional way of overriding the wasm url, particular for unit tests which need this if you running not on the default 3000 port"
|
||||
#VITE_KC_DEV_TOKEN="optional token to skip auth in the app"
|
||||
#token="required token for playwright. TODO: clean up env vars in #3973"
|
||||
|
||||
|
||||
11
.github/ISSUE_TEMPLATE/release.md
vendored
11
.github/ISSUE_TEMPLATE/release.md
vendored
@ -2,7 +2,7 @@
|
||||
name: Release
|
||||
about: Create a new release for the Zoo Design Studio
|
||||
title: "Cut release v1.?.?"
|
||||
labels: [meta/release]
|
||||
labels: [release]
|
||||
---
|
||||
|
||||
> Instructions: https://github.com/KittyCAD/modeling-app/blob/main/CONTRIBUTING.md#shipping-releases
|
||||
@ -19,8 +19,7 @@ Release builds URL: ???
|
||||
* [ ] Confirm the application opens (dismiss the updater)
|
||||
* [ ] Create a project with a basic Text-to-CAD prompt
|
||||
* [ ] Confirm the result is viewable in an engine stream
|
||||
* [ ] Use 'Check for updates' to bring back the updater toast
|
||||
* [ ] Confirm the app can update to the previous release
|
||||
* [ ] Open the application again and confirm the updater can downgrade
|
||||
|
||||
## macOS via ???
|
||||
|
||||
@ -28,8 +27,7 @@ Release builds URL: ???
|
||||
* [ ] Confirm the application opens (dismiss the updater)
|
||||
* [ ] Create a project with a basic Text-to-CAD prompt
|
||||
* [ ] Confirm the result is viewable in an engine stream
|
||||
* [ ] Use 'Check for updates' to bring back the updater toast
|
||||
* [ ] Confirm the app can update to the previous release
|
||||
* [ ] Open the application again and confirm the updater can downgrade
|
||||
|
||||
## Linux via ???
|
||||
|
||||
@ -37,5 +35,4 @@ Release builds URL: ???
|
||||
* [ ] Confirm the application opens (dismiss the updater)
|
||||
* [ ] Create a project with a basic Text-to-CAD prompt
|
||||
* [ ] Confirm the result is viewable in an engine stream
|
||||
* [ ] Use 'Check for updates' to bring back the updater toast
|
||||
* [ ] Confirm the app can update to the previous release
|
||||
* [ ] Open the application again and confirm the updater can downgrade
|
||||
|
||||
4
.github/workflows/build-apps.yml
vendored
4
.github/workflows/build-apps.yml
vendored
@ -43,7 +43,7 @@ jobs:
|
||||
- name: Download Wasm Cache
|
||||
id: download-wasm
|
||||
if: ${{ github.event_name == 'pull_request' && steps.filter.outputs.rust == 'false' }}
|
||||
uses: dawidd6/action-download-artifact@v11
|
||||
uses: dawidd6/action-download-artifact@v7
|
||||
continue-on-error: true
|
||||
with:
|
||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||
@ -362,7 +362,7 @@ jobs:
|
||||
|
||||
- name: Authenticate to Google Cloud
|
||||
if: ${{ env.IS_STAGING == 'true' }}
|
||||
uses: 'google-github-actions/auth@v2.1.10'
|
||||
uses: 'google-github-actions/auth@v2.1.8'
|
||||
with:
|
||||
credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}'
|
||||
|
||||
|
||||
12
.github/workflows/cargo-test.yml
vendored
12
.github/workflows/cargo-test.yml
vendored
@ -25,8 +25,8 @@ jobs:
|
||||
- runner=8cpu-linux-x64
|
||||
- extras=s3-cache
|
||||
steps:
|
||||
- uses: runs-on/action@v2
|
||||
- uses: actions/create-github-app-token@v2
|
||||
- uses: runs-on/action@v1
|
||||
- uses: actions/create-github-app-token@v1
|
||||
id: app-token
|
||||
with:
|
||||
app-id: ${{ secrets.MODELING_APP_GH_APP_ID }}
|
||||
@ -149,8 +149,8 @@ jobs:
|
||||
partitionIndex: [1, 2, 3, 4, 5, 6]
|
||||
partitionTotal: [6]
|
||||
steps:
|
||||
- uses: runs-on/action@v2
|
||||
- uses: actions/create-github-app-token@v2
|
||||
- uses: runs-on/action@v1
|
||||
- uses: actions/create-github-app-token@v1
|
||||
id: app-token
|
||||
with:
|
||||
app-id: ${{ secrets.MODELING_APP_GH_APP_ID }}
|
||||
@ -207,8 +207,8 @@ jobs:
|
||||
- runner=32cpu-linux-x64
|
||||
- extras=s3-cache
|
||||
steps:
|
||||
- uses: runs-on/action@v2
|
||||
- uses: actions/create-github-app-token@v2
|
||||
- uses: runs-on/action@v1
|
||||
- uses: actions/create-github-app-token@v1
|
||||
id: app-token
|
||||
with:
|
||||
app-id: ${{ secrets.MODELING_APP_GH_APP_ID }}
|
||||
|
||||
6
.github/workflows/e2e-tests.yml
vendored
6
.github/workflows/e2e-tests.yml
vendored
@ -46,7 +46,7 @@ jobs:
|
||||
- name: Download Wasm cache
|
||||
id: download-wasm
|
||||
if: ${{ github.event_name != 'schedule' && steps.filter.outputs.rust == 'false' }}
|
||||
uses: dawidd6/action-download-artifact@v11
|
||||
uses: dawidd6/action-download-artifact@v7
|
||||
continue-on-error: true
|
||||
with:
|
||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||
@ -110,7 +110,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
|
||||
- uses: actions/create-github-app-token@v2
|
||||
- uses: actions/create-github-app-token@v1
|
||||
id: app-token
|
||||
with:
|
||||
app-id: ${{ secrets.MODELING_APP_GH_APP_ID }}
|
||||
@ -230,7 +230,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
|
||||
- uses: actions/create-github-app-token@v2
|
||||
- uses: actions/create-github-app-token@v1
|
||||
id: app-token
|
||||
with:
|
||||
app-id: ${{ secrets.MODELING_APP_GH_APP_ID }}
|
||||
|
||||
2
.github/workflows/generate-website-docs.yml
vendored
2
.github/workflows/generate-website-docs.yml
vendored
@ -20,7 +20,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/create-github-app-token@v2
|
||||
- uses: actions/create-github-app-token@v1
|
||||
id: app-token
|
||||
with:
|
||||
# required
|
||||
|
||||
2
.github/workflows/kcl-language-server.yml
vendored
2
.github/workflows/kcl-language-server.yml
vendored
@ -328,7 +328,7 @@ jobs:
|
||||
mkdir -p releases/language-server/${{ env.TAG }}
|
||||
cp -r build/* releases/language-server/${{ env.TAG }}
|
||||
- name: "Authenticate to Google Cloud"
|
||||
uses: "google-github-actions/auth@v2.1.10"
|
||||
uses: "google-github-actions/auth@v2.1.8"
|
||||
with:
|
||||
credentials_json: "${{ secrets.GOOGLE_CLOUD_DL_SA }}"
|
||||
- name: Set up Cloud SDK
|
||||
|
||||
6
.github/workflows/kcl-python-bindings.yml
vendored
6
.github/workflows/kcl-python-bindings.yml
vendored
@ -113,7 +113,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v6
|
||||
uses: astral-sh/setup-uv@v5
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
- uses: taiki-e/install-action@just
|
||||
- name: Run tests
|
||||
@ -130,7 +130,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install the latest version of uv
|
||||
uses: astral-sh/setup-uv@v6
|
||||
uses: astral-sh/setup-uv@v5
|
||||
- name: Install codespell
|
||||
run: |
|
||||
uv venv .venv
|
||||
@ -161,7 +161,7 @@ jobs:
|
||||
with:
|
||||
path: rust/kcl-python-bindings
|
||||
- name: Install the latest version of uv
|
||||
uses: astral-sh/setup-uv@v6
|
||||
uses: astral-sh/setup-uv@v5
|
||||
- name: do uv things
|
||||
run: |
|
||||
cd rust/kcl-python-bindings
|
||||
|
||||
2
.github/workflows/publish-apps-release.yml
vendored
2
.github/workflows/publish-apps-release.yml
vendored
@ -108,7 +108,7 @@ jobs:
|
||||
run: npm run files:set-notes
|
||||
|
||||
- name: Authenticate to Google Cloud
|
||||
uses: 'google-github-actions/auth@v2.1.10'
|
||||
uses: 'google-github-actions/auth@v2.1.8'
|
||||
with:
|
||||
credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}'
|
||||
|
||||
|
||||
30
.github/workflows/static-analysis.yml
vendored
30
.github/workflows/static-analysis.yml
vendored
@ -120,36 +120,6 @@ jobs:
|
||||
|
||||
- run: npm run circular-deps:diff
|
||||
|
||||
npm-url-checker:
|
||||
runs-on: ubuntu-latest
|
||||
needs: npm-build-wasm
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
- run: npm install
|
||||
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
|
||||
- name: Copy prepared wasm
|
||||
run: |
|
||||
ls -R prepared-wasm
|
||||
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
|
||||
mkdir rust/kcl-wasm-lib/pkg
|
||||
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
|
||||
|
||||
- name: Copy prepared ts-rs bindings
|
||||
run: |
|
||||
ls -R prepared-ts-rs-bindings
|
||||
mkdir rust/kcl-lib/bindings
|
||||
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
||||
|
||||
- run: npm run url-checker:diff
|
||||
|
||||
python-codespell:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -87,4 +87,4 @@ venv
|
||||
|
||||
.vscode-test
|
||||
.biome/
|
||||
.million
|
||||
.million
|
||||
|
||||
@ -235,47 +235,6 @@ To display logging (to the terminal or console) set `ZOO_LOG=1`. This will log s
|
||||
|
||||
To enable memory metrics, build with `--features dhat-heap`.
|
||||
|
||||
## Running scripts
|
||||
|
||||
There are multiple scripts under the folder path `./scripts` which can be used in various settings.
|
||||
|
||||
### Pattern for a static file, npm run commands, and CI-CD checks
|
||||
|
||||
If you want to implement a static checker follow this pattern. Two static checkers we have are circular dependency checks in our typescript code and url checker to see if any hard coded URL is the typescript application 404s. We have a set of known files in `./scripts/known/*.txt` which is the baseline.
|
||||
|
||||
If you improve the baseline, run the overwrite command and commit the new smaller baseline. Try not to make the baseline bigger, the CI CD will complain.
|
||||
These baselines are to hold us to higher standards and help implement automated testing against the repository
|
||||
|
||||
#### Output result to stdout
|
||||
- `npm run circular-deps`
|
||||
- `npm run url-checker`
|
||||
|
||||
- create a `<name>.sh` file that will run the static checker then output the result to `stdout`
|
||||
|
||||
#### Overwrite result to known .txt file on disk
|
||||
|
||||
If the application needs to overwrite the known file on disk use this pattern. This known .txt file will be source controlled as the baseline
|
||||
|
||||
- `npm run circular-deps:overwrite`
|
||||
- `npm run url-checker:overwrite`
|
||||
|
||||
#### Diff baseline and current
|
||||
|
||||
These commands will write a /tmp/ file on disk and compare it to the known file in the repository. This command will also be used in the CI CD pipeline for automated checks
|
||||
|
||||
- create a `diff-<name>.sh` file that is the script to diff your tmp file to the baseline
|
||||
e.g. `diff-url-checker.sh`
|
||||
```bash
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
npm run url-checker > /tmp/urls.txt
|
||||
diff --ignore-blank-lines -w /tmp/urls.txt ./scripts/known/urls.txt
|
||||
```
|
||||
|
||||
- `npm run circular-deps:diff`
|
||||
- `npm run url-checker:diff`
|
||||
|
||||
## Proposing changes
|
||||
|
||||
Before you submit a contribution PR to this repo, please ensure that:
|
||||
@ -321,9 +280,6 @@ Assign someone to each section of the manual checklist generated by the issue te
|
||||
Follow the instructions [here](./rust/README.md) to publish new crates.
|
||||
This ensures that the KCL accepted by the app is also accepted by the CLI.
|
||||
|
||||
If there are documentation changes, merge the corresponding Dependabot PRs [here](https://github.com/KittyCAD/website/pulls/app%2Fdependabot) for the website.
|
||||
You can trigger Dependabot to check for updates [here](https://github.com/KittyCAD/website/network/updates/17261214/jobs).
|
||||
|
||||
#### 5. Publish the release
|
||||
|
||||
Head over to https://github.com/KittyCAD/modeling-app/releases/new, pick the newly created tag and type it in the **Release title** field as well.
|
||||
|
||||
3
Makefile
3
Makefile
@ -62,10 +62,7 @@ else
|
||||
endif
|
||||
|
||||
public/kcl-samples/manifest.json: $(KCL_SOURCES)
|
||||
ifndef WINDOWS
|
||||
cd rust/kcl-lib && EXPECTORATE=overwrite cargo test generate_manifest
|
||||
@ touch $@
|
||||
endif
|
||||
|
||||
.vite/build/main.js: $(REACT_SOURCES) $(TYPESCRIPT_SOURCES) $(VITE_SOURCES)
|
||||
npm run tronb:vite:dev
|
||||
|
||||
@ -83,13 +83,6 @@ Allow orbiting in sketch mode.
|
||||
Whether to show the debug panel, which lets you see various states of the app to aid in development.
|
||||
|
||||
|
||||
**Default:** None
|
||||
|
||||
##### fixed_size_grid
|
||||
|
||||
If true, the grid cells will be fixed-size, where the width is your default length unit. If false, the grid will get larger as you zoom out, and smaller as you zoom in.
|
||||
|
||||
|
||||
**Default:** None
|
||||
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -8,14 +8,18 @@ layout: manual
|
||||
Apply a function to every element of a list.
|
||||
|
||||
```kcl
|
||||
map(
|
||||
@array: [any],
|
||||
f: fn(any): any,
|
||||
): [any]
|
||||
```
|
||||
r = 10 // radius
|
||||
fn drawCircle(@id) {
|
||||
return startSketchOn(XY)
|
||||
|> circle(center = [id * 2 * r, 0], radius = r)
|
||||
}
|
||||
|
||||
Given a list like `[a, b, c]`, and a function like `f`, returns
|
||||
`[f(a), f(b), f(c)]`
|
||||
// Call `drawCircle`, passing in each element of the array.
|
||||
// The outputs from each `drawCircle` form a new array,
|
||||
// which is the return value from `map`.
|
||||
circles = map([1..3], f = drawCircle)
|
||||
|
||||
```
|
||||
|
||||
### Arguments
|
||||
|
||||
@ -28,6 +32,19 @@ Given a list like `[a, b, c]`, and a function like `f`, returns
|
||||
|
||||
[`[any]`](/docs/kcl-std/types/std-types-any)
|
||||
|
||||
### Description
|
||||
|
||||
Given a list like `[a, b, c]`, and a function like `f`, returns
|
||||
`[f(a), f(b), f(c)]`
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
map(
|
||||
@array: [any],
|
||||
f: fn(any): any,
|
||||
): [any]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
@ -8,10 +8,28 @@ layout: manual
|
||||
Remove the last element from an array.
|
||||
|
||||
```kcl
|
||||
pop(@array: [any; 1+]): [any]
|
||||
```
|
||||
arr = [1, 2, 3, 4]
|
||||
new_arr = pop(arr)
|
||||
assert(
|
||||
new_arr[0],
|
||||
isEqualTo = 1,
|
||||
tolerance = 0.00001,
|
||||
error = "1 is the first element of the array",
|
||||
)
|
||||
assert(
|
||||
new_arr[1],
|
||||
isEqualTo = 2,
|
||||
tolerance = 0.00001,
|
||||
error = "2 is the second element of the array",
|
||||
)
|
||||
assert(
|
||||
new_arr[2],
|
||||
isEqualTo = 3,
|
||||
tolerance = 0.00001,
|
||||
error = "3 is the third element of the array",
|
||||
)
|
||||
|
||||
Returns a new array with the last element removed.
|
||||
```
|
||||
|
||||
### Arguments
|
||||
|
||||
@ -23,6 +41,15 @@ Returns a new array with the last element removed.
|
||||
|
||||
[`[any]`](/docs/kcl-std/types/std-types-any)
|
||||
|
||||
### Description
|
||||
|
||||
Returns a new array with the last element removed.
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
pop(@array: [any; 1+]): [any]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
@ -8,13 +8,16 @@ layout: manual
|
||||
Append an element to the end of an array.
|
||||
|
||||
```kcl
|
||||
push(
|
||||
@array: [any],
|
||||
item: any,
|
||||
): [any; 1+]
|
||||
```
|
||||
arr = [1, 2, 3]
|
||||
new_arr = push(arr, item = 4)
|
||||
assert(
|
||||
new_arr[3],
|
||||
isEqualTo = 4,
|
||||
tolerance = 0.1,
|
||||
error = "4 was added to the end of the array",
|
||||
)
|
||||
|
||||
Returns a new array with the element appended.
|
||||
```
|
||||
|
||||
### Arguments
|
||||
|
||||
@ -27,6 +30,18 @@ Returns a new array with the element appended.
|
||||
|
||||
[`[any; 1+]`](/docs/kcl-std/types/std-types-any)
|
||||
|
||||
### Description
|
||||
|
||||
Returns a new array with the element appended.
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
push(
|
||||
@array: [any],
|
||||
item: any,
|
||||
): [any; 1+]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
@ -8,15 +8,36 @@ layout: manual
|
||||
Take a starting value. Then, for each element of an array, calculate the next value, using the previous value and the element.
|
||||
|
||||
```kcl
|
||||
reduce(
|
||||
@array: [any],
|
||||
initial: any,
|
||||
f: fn(any, accum: any): any,
|
||||
): any
|
||||
// This function adds two numbers.
|
||||
fn add(@a, accum) {
|
||||
return a + accum
|
||||
}
|
||||
|
||||
// This function adds an array of numbers.
|
||||
// It uses the `reduce` function, to call the `add` function on every
|
||||
// element of the `arr` parameter. The starting value is 0.
|
||||
fn sum(@arr) {
|
||||
return reduce(arr, initial = 0, f = add)
|
||||
}
|
||||
|
||||
/* The above is basically like this pseudo-code:
|
||||
fn sum(arr):
|
||||
sumSoFar = 0
|
||||
for i in arr:
|
||||
sumSoFar = add(i, sumSoFar)
|
||||
return sumSoFar */
|
||||
|
||||
// We use `assert` to check that our `sum` function gives the
|
||||
// expected result. It's good to check your work!
|
||||
assert(
|
||||
sum([1, 2, 3]),
|
||||
isEqualTo = 6,
|
||||
tolerance = 0.1,
|
||||
error = "1 + 2 + 3 summed is 6",
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -30,6 +51,16 @@ reduce(
|
||||
[`any`](/docs/kcl-std/types/std-types-any) - The [`any`](/docs/kcl-std/types/std-types-any) type is the type of all possible values in KCL. I.e., if a function accepts an argument with type [`any`](/docs/kcl-std/types/std-types-any), then it can accept any value.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
reduce(
|
||||
@array: [any],
|
||||
initial: any,
|
||||
f: fn(any, accum: any): any,
|
||||
): any
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,20 +8,23 @@ layout: manual
|
||||
Check a value meets some expected conditions at runtime. Program terminates with an error if conditions aren't met. If you provide multiple conditions, they will all be checked and all must be met.
|
||||
|
||||
```kcl
|
||||
n = 10
|
||||
assert(n, isEqualTo = 10)
|
||||
assert(
|
||||
@actual: number,
|
||||
isGreaterThan?: number,
|
||||
isLessThan?: number,
|
||||
isGreaterThanOrEqual?: number,
|
||||
isLessThanOrEqual?: number,
|
||||
isEqualTo?: number,
|
||||
tolerance?: number,
|
||||
error?: string,
|
||||
n,
|
||||
isGreaterThanOrEqual = 0,
|
||||
isLessThan = 100,
|
||||
error = "number should be between 0 and 100",
|
||||
)
|
||||
assert(
|
||||
1.0000000000012,
|
||||
isEqualTo = 1,
|
||||
tolerance = 0.0001,
|
||||
error = "number should be almost exactly 1",
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -36,6 +39,21 @@ assert(
|
||||
| `error` | [`string`](/docs/kcl-std/types/std-types-string) | If the value was false, the program will terminate with this error message | No |
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
assert(
|
||||
@actual: number,
|
||||
isGreaterThan?: number,
|
||||
isLessThan?: number,
|
||||
isGreaterThanOrEqual?: number,
|
||||
isLessThanOrEqual?: number,
|
||||
isEqualTo?: number,
|
||||
tolerance?: number,
|
||||
error?: string,
|
||||
)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,14 +8,11 @@ layout: manual
|
||||
Asserts that a value is the boolean value true.
|
||||
|
||||
```kcl
|
||||
assertIs(
|
||||
@actual: bool,
|
||||
error?: string,
|
||||
)
|
||||
kclIsFun = true
|
||||
assertIs(kclIsFun)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +21,15 @@ assertIs(
|
||||
| `error` | [`string`](/docs/kcl-std/types/std-types-string) | If the value was false, the program will terminate with this error message | No |
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
assertIs(
|
||||
@actual: bool,
|
||||
error?: string,
|
||||
)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,18 +8,21 @@ layout: manual
|
||||
Clone a sketch or solid.
|
||||
|
||||
```kcl
|
||||
clone(@geometry: Sketch | Solid | ImportedGeometry): Sketch | Solid | ImportedGeometry
|
||||
// Clone a basic sketch and move it and extrude it.
|
||||
exampleSketch = startSketchOn(XY)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [10, 0])
|
||||
|> line(end = [0, 10])
|
||||
|> line(end = [-10, 0])
|
||||
|> close()
|
||||
|
||||
clonedSketch = clone(exampleSketch)
|
||||
|> scale(x = 1.0, y = 1.0, z = 2.5)
|
||||
|> translate(x = 15.0, y = 0, z = 0)
|
||||
|> extrude(length = 5)
|
||||
|
||||
```
|
||||
|
||||
This works essentially like a copy-paste operation. It creates a perfect replica
|
||||
at that point in time that you can manipulate individually afterwards.
|
||||
|
||||
This doesn't really have much utility unless you need the equivalent of a double
|
||||
instance pattern with zero transformations.
|
||||
|
||||
Really only use this function if YOU ARE SURE you need it. In most cases you
|
||||
do not need clone and using a pattern with `instance = 2` is more appropriate.
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -30,6 +33,22 @@ do not need clone and using a pattern with `instance = 2` is more appropriate.
|
||||
|
||||
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) or [`Solid`](/docs/kcl-std/types/std-types-Solid) or [`ImportedGeometry`](/docs/kcl-std/types/std-types-ImportedGeometry)
|
||||
|
||||
### Description
|
||||
|
||||
This works essentially like a copy-paste operation. It creates a perfect replica
|
||||
at that point in time that you can manipulate individually afterwards.
|
||||
|
||||
This doesn't really have much utility unless you need the equivalent of a double
|
||||
instance pattern with zero transformations.
|
||||
|
||||
Really only use this function if YOU ARE SURE you need it. In most cases you
|
||||
do not need clone and using a pattern with `instance = 2` is more appropriate.
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
clone(@geometry: Sketch | Solid | ImportedGeometry): Sketch | Solid | ImportedGeometry
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
@ -8,19 +8,23 @@ layout: manual
|
||||
Create a helix.
|
||||
|
||||
```kcl
|
||||
helix(
|
||||
revolutions: number(_),
|
||||
angleStart: number(Angle),
|
||||
ccw?: bool,
|
||||
radius?: number(Length),
|
||||
axis?: Axis3d | Edge,
|
||||
length?: number(Length),
|
||||
cylinder?: Solid,
|
||||
): Helix
|
||||
// Create a helix around the Z axis.
|
||||
helixPath = helix(
|
||||
angleStart = 0,
|
||||
ccw = true,
|
||||
revolutions = 5,
|
||||
length = 10,
|
||||
radius = 5,
|
||||
axis = Z,
|
||||
)
|
||||
|
||||
// Create a spring by sweeping around the helix path.
|
||||
springSketch = startSketchOn(XZ)
|
||||
|> circle(center = [5, 0], radius = 0.5)
|
||||
|> sweep(path = helixPath)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -38,6 +42,20 @@ helix(
|
||||
[`Helix`](/docs/kcl-std/types/std-types-Helix) - A helix; created by the `helix` function.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
helix(
|
||||
revolutions: number(_),
|
||||
angleStart: number(Angle),
|
||||
ccw?: bool,
|
||||
radius?: number(Length),
|
||||
axis?: Axis3d | Edge,
|
||||
length?: number(Length),
|
||||
cylinder?: Solid,
|
||||
): Helix
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,20 @@ layout: manual
|
||||
Compute the absolute value of a number.
|
||||
|
||||
```kcl
|
||||
abs(@input: number): number
|
||||
myAngle = -120deg
|
||||
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [8, 0])
|
||||
|> angledLine(angle = abs(myAngle), length = 5)
|
||||
|> line(end = [-5, 0])
|
||||
|> angledLine(angle = myAngle, length = 5)
|
||||
|> close()
|
||||
|
||||
baseExtrusion = extrude(sketch001, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +33,12 @@ abs(@input: number): number
|
||||
[`number`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
abs(@input: number): number
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,17 @@ layout: manual
|
||||
Compute the arccosine of a number.
|
||||
|
||||
```kcl
|
||||
acos(@num: number(_)): number(rad)
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> angledLine(angle = acos(0.5), length = 10)
|
||||
|> line(end = [5, 0])
|
||||
|> line(endAbsolute = [12, 0])
|
||||
|> close()
|
||||
|
||||
extrude001 = extrude(sketch001, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +30,12 @@ acos(@num: number(_)): number(rad)
|
||||
[`number(rad)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
acos(@num: number(_)): number(rad)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,16 @@ layout: manual
|
||||
Compute the arcsine of a number.
|
||||
|
||||
```kcl
|
||||
asin(@num: number(_)): number(rad)
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> angledLine(angle = asin(0.5), length = 20)
|
||||
|> yLine(endAbsolute = 0)
|
||||
|> close()
|
||||
|
||||
extrude001 = extrude(sketch001, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +29,12 @@ asin(@num: number(_)): number(rad)
|
||||
[`number(rad)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
asin(@num: number(_)): number(rad)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,10 +8,15 @@ layout: manual
|
||||
Compute the arctangent of a number.
|
||||
|
||||
```kcl
|
||||
atan(@num: number(_)): number(rad)
|
||||
```
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> angledLine(angle = atan(1.25), length = 20)
|
||||
|> yLine(endAbsolute = 0)
|
||||
|> close()
|
||||
|
||||
Consider using `atan2()` instead for the true inverse of tangent.
|
||||
extrude001 = extrude(sketch001, length = 5)
|
||||
|
||||
```
|
||||
|
||||
### Arguments
|
||||
|
||||
@ -23,6 +28,15 @@ Consider using `atan2()` instead for the true inverse of tangent.
|
||||
|
||||
[`number(rad)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
### Description
|
||||
|
||||
Consider using `atan2()` instead for the true inverse of tangent.
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
atan(@num: number(_)): number(rad)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
@ -8,14 +8,16 @@ layout: manual
|
||||
Compute the four quadrant arctangent of Y and X.
|
||||
|
||||
```kcl
|
||||
atan2(
|
||||
y: number(Length),
|
||||
x: number(Length),
|
||||
): number(rad)
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> angledLine(angle = atan2(y = 1.25, x = 2), length = 20)
|
||||
|> yLine(endAbsolute = 0)
|
||||
|> close()
|
||||
|
||||
extrude001 = extrude(sketch001, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -28,6 +30,15 @@ atan2(
|
||||
[`number(rad)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
atan2(
|
||||
y: number(Length),
|
||||
x: number(Length),
|
||||
): number(rad)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,17 @@ layout: manual
|
||||
Compute the smallest integer greater than or equal to a number.
|
||||
|
||||
```kcl
|
||||
ceil(@input: number): number
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(endAbsolute = [12, 10])
|
||||
|> line(end = [ceil(7.02986), 0])
|
||||
|> yLine(endAbsolute = 0)
|
||||
|> close()
|
||||
|
||||
extrude001 = extrude(sketch001, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +30,12 @@ ceil(@input: number): number
|
||||
[`number`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
ceil(@input: number): number
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,16 @@ layout: manual
|
||||
Compute the cosine of a number.
|
||||
|
||||
```kcl
|
||||
cos(@num: number(Angle)): number
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> angledLine(angle = 30deg, length = 3 / cos(30deg))
|
||||
|> yLine(endAbsolute = 0)
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +29,12 @@ cos(@num: number(Angle)): number
|
||||
[`number`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
cos(@num: number(Angle)): number
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,17 @@ layout: manual
|
||||
Compute the largest integer less than or equal to a number.
|
||||
|
||||
```kcl
|
||||
floor(@input: number): number
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(endAbsolute = [12, 10])
|
||||
|> line(end = [floor(7.02986), 0])
|
||||
|> yLine(endAbsolute = 0)
|
||||
|> close()
|
||||
|
||||
extrude001 = extrude(sketch001, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +30,12 @@ floor(@input: number): number
|
||||
[`number`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
floor(@input: number): number
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,14 +8,10 @@ layout: manual
|
||||
Compute the angle of the given leg for x.
|
||||
|
||||
```kcl
|
||||
legAngX(
|
||||
hypotenuse: number(Length),
|
||||
leg: number(Length),
|
||||
): number(deg)
|
||||
legAngX(hypotenuse = 5, leg = 3)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -28,6 +24,15 @@ legAngX(
|
||||
[`number(deg)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
legAngX(
|
||||
hypotenuse: number(Length),
|
||||
leg: number(Length),
|
||||
): number(deg)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,14 +8,10 @@ layout: manual
|
||||
Compute the angle of the given leg for y.
|
||||
|
||||
```kcl
|
||||
legAngY(
|
||||
hypotenuse: number(Length),
|
||||
leg: number(Length),
|
||||
): number(deg)
|
||||
legAngY(hypotenuse = 5, leg = 3)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -28,6 +24,15 @@ legAngY(
|
||||
[`number(deg)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
legAngY(
|
||||
hypotenuse: number(Length),
|
||||
leg: number(Length),
|
||||
): number(deg)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,14 +8,10 @@ layout: manual
|
||||
Compute the length of the given leg.
|
||||
|
||||
```kcl
|
||||
legLen(
|
||||
hypotenuse: number(Length),
|
||||
leg: number(Length),
|
||||
): number(Length)
|
||||
legLen(hypotenuse = 5, leg = 3)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -28,6 +24,15 @@ legLen(
|
||||
[`number(Length)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
legLen(
|
||||
hypotenuse: number(Length),
|
||||
leg: number(Length),
|
||||
): number(Length)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,17 @@ layout: manual
|
||||
Compute the natural logarithm of the number.
|
||||
|
||||
```kcl
|
||||
ln(@input: number): number
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [ln(100), 15])
|
||||
|> line(end = [5, -6])
|
||||
|> line(end = [-10, -10])
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +30,12 @@ ln(@input: number): number
|
||||
[`number`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
ln(@input: number): number
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,15 +8,16 @@ layout: manual
|
||||
Compute the logarithm of the number with respect to an arbitrary base.
|
||||
|
||||
```kcl
|
||||
log(
|
||||
@input: number,
|
||||
base: number(_),
|
||||
): number
|
||||
```
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [log(100, base = 5), 0])
|
||||
|> line(end = [5, 8])
|
||||
|> line(end = [-10, 0])
|
||||
|> close()
|
||||
|
||||
The result might not be correctly rounded owing to implementation
|
||||
details; `log2` can produce more accurate results for base 2,
|
||||
and `log10` can produce more accurate results for base 10.
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
### Arguments
|
||||
|
||||
@ -29,6 +30,20 @@ and `log10` can produce more accurate results for base 10.
|
||||
|
||||
[`number`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
### Description
|
||||
|
||||
The result might not be correctly rounded owing to implementation
|
||||
details; `log2` can produce more accurate results for base 2,
|
||||
and `log10` can produce more accurate results for base 10.
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
log(
|
||||
@input: number,
|
||||
base: number(_),
|
||||
): number
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
@ -8,11 +8,17 @@ layout: manual
|
||||
Compute the base 10 logarithm of the number.
|
||||
|
||||
```kcl
|
||||
log10(@input: number): number
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [log10(100), 0])
|
||||
|> line(end = [5, 8])
|
||||
|> line(end = [-10, 0])
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +30,12 @@ log10(@input: number): number
|
||||
[`number`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
log10(@input: number): number
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,17 @@ layout: manual
|
||||
Compute the base 2 logarithm of the number.
|
||||
|
||||
```kcl
|
||||
log2(@input: number): number
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [log2(100), 0])
|
||||
|> line(end = [5, 8])
|
||||
|> line(end = [-10, 0])
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +30,12 @@ log2(@input: number): number
|
||||
[`number`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
log2(@input: number): number
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,16 @@ layout: manual
|
||||
Compute the maximum of the given arguments.
|
||||
|
||||
```kcl
|
||||
max(@input: [number; 1+]): number
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> angledLine(angle = 70deg, length = max([15, 31, 4, 13, 22]))
|
||||
|> line(end = [20, 0])
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +29,12 @@ max(@input: [number; 1+]): number
|
||||
[`number`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
max(@input: [number; 1+]): number
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,16 @@ layout: manual
|
||||
Compute the minimum of the given arguments.
|
||||
|
||||
```kcl
|
||||
min(@input: [number; 1+]): number
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> angledLine(angle = 70deg, length = min([15, 31, 4, 13, 22]))
|
||||
|> line(end = [20, 0])
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +29,12 @@ min(@input: [number; 1+]): number
|
||||
[`number`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
min(@input: [number; 1+]): number
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,14 +8,18 @@ layout: manual
|
||||
Convert polar/sphere (azimuth, elevation, distance) coordinates to cartesian (x/y/z grid) coordinates.
|
||||
|
||||
```kcl
|
||||
polar(
|
||||
angle: number(rad),
|
||||
length: number(Length),
|
||||
): Point2d
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = polar(angle = 30deg, length = 5), tag = $thing)
|
||||
|> line(end = [0, 5])
|
||||
|> line(end = [segEndX(thing), 0])
|
||||
|> line(end = [-20, 10])
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -28,6 +32,15 @@ polar(
|
||||
[`Point2d`](/docs/kcl-std/types/std-types-Point2d) - A point in two dimensional space.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
polar(
|
||||
angle: number(rad),
|
||||
length: number(Length),
|
||||
): Point2d
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,14 +8,16 @@ layout: manual
|
||||
Compute the number to a power.
|
||||
|
||||
```kcl
|
||||
pow(
|
||||
@input: number,
|
||||
exp: number(_),
|
||||
): number
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> angledLine(angle = 50deg, length = pow(5, exp = 2))
|
||||
|> yLine(endAbsolute = 0)
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -28,6 +30,15 @@ pow(
|
||||
[`number`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
pow(
|
||||
@input: number,
|
||||
exp: number(_),
|
||||
): number
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,14 +8,17 @@ layout: manual
|
||||
Compute the remainder after dividing `num` by `div`. If `num` is negative, the result will be too.
|
||||
|
||||
```kcl
|
||||
rem(
|
||||
@num: number,
|
||||
divisor: number,
|
||||
): number
|
||||
import rem from "std::math"
|
||||
|
||||
assert(rem(7, divisor = 4), isEqualTo = 3, error = "remainder is 3")
|
||||
assert(rem(-7, divisor = 4), isEqualTo = -3, error = "remainder is -3")
|
||||
assert(rem(7, divisor = -4), isEqualTo = 3, error = "remainder is 3")
|
||||
assert(rem(6, divisor = 2.5), isEqualTo = 1, error = "remainder is 1")
|
||||
assert(rem(6.5, divisor = 2.5), isEqualTo = 1.5, error = "remainder is 1.5")
|
||||
assert(rem(6.5, divisor = 2), isEqualTo = 0.5, error = "remainder is 0.5")
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -28,6 +31,15 @@ rem(
|
||||
[`number`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
rem(
|
||||
@num: number,
|
||||
divisor: number,
|
||||
): number
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,17 @@ layout: manual
|
||||
Round a number to the nearest integer.
|
||||
|
||||
```kcl
|
||||
round(@input: number): number
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(endAbsolute = [12, 10])
|
||||
|> line(end = [round(7.02986), 0])
|
||||
|> yLine(endAbsolute = 0)
|
||||
|> close()
|
||||
|
||||
extrude001 = extrude(sketch001, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +30,12 @@ round(@input: number): number
|
||||
[`number`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
round(@input: number): number
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,16 @@ layout: manual
|
||||
Compute the sine of a number.
|
||||
|
||||
```kcl
|
||||
sin(@num: number(Angle)): number
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> angledLine(angle = 50deg, length = 15 / sin(135deg))
|
||||
|> yLine(endAbsolute = 0)
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +29,12 @@ sin(@num: number(Angle)): number
|
||||
[`number`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
sin(@num: number(Angle)): number
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,16 @@ layout: manual
|
||||
Compute the square root of a number.
|
||||
|
||||
```kcl
|
||||
sqrt(@input: number): number
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> angledLine(angle = 50deg, length = sqrt(2500))
|
||||
|> yLine(endAbsolute = 0)
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +29,12 @@ sqrt(@input: number): number
|
||||
[`number`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
sqrt(@input: number): number
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,16 @@ layout: manual
|
||||
Compute the tangent of a number.
|
||||
|
||||
```kcl
|
||||
tan(@num: number(Angle)): number
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> angledLine(angle = 50deg, length = 50 * tan((1 / 2): number(rad)))
|
||||
|> yLine(endAbsolute = 0)
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +29,12 @@ tan(@num: number(Angle)): number
|
||||
[`number`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
tan(@num: number(Angle)): number
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -8,20 +8,18 @@ layout: manual
|
||||
Draw a line segment relative to the current origin using the polar measure of some angle and distance.
|
||||
|
||||
```kcl
|
||||
angledLine(
|
||||
@sketch: Sketch,
|
||||
angle: number(Angle),
|
||||
length?: number(Length),
|
||||
lengthX?: number(Length),
|
||||
lengthY?: number(Length),
|
||||
endAbsoluteX?: number(Length),
|
||||
endAbsoluteY?: number(Length),
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> yLine(endAbsolute = 15)
|
||||
|> angledLine(angle = 30deg, length = 15)
|
||||
|> line(end = [8, -10])
|
||||
|> yLine(endAbsolute = 0)
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 10)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -40,6 +38,21 @@ angledLine(
|
||||
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
angledLine(
|
||||
@sketch: Sketch,
|
||||
angle: number(Angle),
|
||||
length?: number(Length),
|
||||
lengthX?: number(Length),
|
||||
lengthY?: number(Length),
|
||||
endAbsoluteX?: number(Length),
|
||||
endAbsoluteY?: number(Length),
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,17 +8,18 @@ layout: manual
|
||||
Draw an angled line from the current origin, constructing a line segment such that the newly created line intersects the desired target line segment.
|
||||
|
||||
```kcl
|
||||
angledLineThatIntersects(
|
||||
@sketch: Sketch,
|
||||
angle: number(Angle),
|
||||
intersectTag: TaggedEdge,
|
||||
offset?: number(Length),
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(endAbsolute = [5, 10])
|
||||
|> line(endAbsolute = [-10, 10], tag = $lineToIntersect)
|
||||
|> line(endAbsolute = [0, 20])
|
||||
|> angledLineThatIntersects(angle = 80deg, intersectTag = lineToIntersect, offset = 10)
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 10)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -34,6 +35,18 @@ angledLineThatIntersects(
|
||||
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
angledLineThatIntersects(
|
||||
@sketch: Sketch,
|
||||
angle: number(Angle),
|
||||
intersectTag: TaggedEdge,
|
||||
offset?: number(Length),
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,27 +8,15 @@ layout: manual
|
||||
Draw a curved line segment along an imaginary circle.
|
||||
|
||||
```kcl
|
||||
arc(
|
||||
@sketch: Sketch,
|
||||
angleStart?: number(Angle),
|
||||
angleEnd?: number(Angle),
|
||||
radius?: number(Length),
|
||||
diameter?: number(Length),
|
||||
interiorAbsolute?: Point2d,
|
||||
endAbsolute?: Point2d,
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [10, 0])
|
||||
|> arc(angleStart = 0, angleEnd = 280deg, radius = 16)
|
||||
|> close()
|
||||
example = extrude(exampleSketch, length = 10)
|
||||
|
||||
```
|
||||
|
||||
The arc is constructed such that the current position of the sketch is
|
||||
placed along an imaginary circle of the specified radius, at angleStart
|
||||
degrees. The resulting arc is the segment of the imaginary circle from
|
||||
that origin point to angleEnd, radius away from the center of the imaginary
|
||||
circle.
|
||||
|
||||
Unless this makes a lot of sense and feels like what you're looking
|
||||
for to construct your shape, you're likely looking for tangentialArc.
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -46,6 +34,31 @@ for to construct your shape, you're likely looking for tangentialArc.
|
||||
|
||||
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
|
||||
|
||||
### Description
|
||||
|
||||
The arc is constructed such that the current position of the sketch is
|
||||
placed along an imaginary circle of the specified radius, at angleStart
|
||||
degrees. The resulting arc is the segment of the imaginary circle from
|
||||
that origin point to angleEnd, radius away from the center of the imaginary
|
||||
circle.
|
||||
|
||||
Unless this makes a lot of sense and feels like what you're looking
|
||||
for to construct your shape, you're likely looking for tangentialArc.
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
arc(
|
||||
@sketch: Sketch,
|
||||
angleStart?: number(Angle),
|
||||
angleEnd?: number(Angle),
|
||||
radius?: number(Length),
|
||||
diameter?: number(Length),
|
||||
interiorAbsolute?: Point2d,
|
||||
endAbsolute?: Point2d,
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -8,17 +8,13 @@ layout: manual
|
||||
Construct a 2-dimensional circle, of the specified radius, centered at the provided (x, y) origin point.
|
||||
|
||||
```kcl
|
||||
circle(
|
||||
@sketchOrSurface: Sketch | Plane | Face,
|
||||
center: Point2d,
|
||||
radius?: number(Length),
|
||||
diameter?: number(Length),
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
exampleSketch = startSketchOn(-XZ)
|
||||
|> circle(center = [0, 0], radius = 10)
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -34,6 +30,18 @@ circle(
|
||||
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
circle(
|
||||
@sketchOrSurface: Sketch | Plane | Face,
|
||||
center: Point2d,
|
||||
radius?: number(Length),
|
||||
diameter?: number(Length),
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,17 +8,12 @@ layout: manual
|
||||
Construct a circle derived from 3 points.
|
||||
|
||||
```kcl
|
||||
circleThreePoint(
|
||||
@sketchOrSurface: Sketch | Plane | Face,
|
||||
p1: Point2d,
|
||||
p2: Point2d,
|
||||
p3: Point2d,
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
exampleSketch = startSketchOn(XY)
|
||||
|> circleThreePoint(p1 = [10, 10], p2 = [20, 8], p3 = [15, 5])
|
||||
|> extrude(length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -34,6 +29,18 @@ circleThreePoint(
|
||||
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
circleThreePoint(
|
||||
@sketchOrSurface: Sketch | Plane | Face,
|
||||
p1: Point2d,
|
||||
p2: Point2d,
|
||||
p3: Point2d,
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,16 +8,14 @@ layout: manual
|
||||
Construct a line segment from the current origin back to the profile's origin, ensuring the resulting 2-dimensional sketch is not open-ended.
|
||||
|
||||
```kcl
|
||||
close(
|
||||
@sketch: Sketch,
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
```
|
||||
startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [10, 10])
|
||||
|> line(end = [10, 0])
|
||||
|> close()
|
||||
|> extrude(length = 10)
|
||||
|
||||
If you want to perform some 3-dimensional operation on a sketch, like
|
||||
extrude or sweep, you must `close` it first. `close` must be called even
|
||||
if the end point of the last segment is coincident with the sketch
|
||||
starting point.
|
||||
```
|
||||
|
||||
### Arguments
|
||||
|
||||
@ -30,6 +28,21 @@ starting point.
|
||||
|
||||
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
|
||||
|
||||
### Description
|
||||
|
||||
If you want to perform some 3-dimensional operation on a sketch, like
|
||||
extrude or sweep, you must `close` it first. `close` must be called even
|
||||
if the end point of the last segment is coincident with the sketch
|
||||
starting point.
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
close(
|
||||
@sketch: Sketch,
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
@ -8,21 +8,18 @@ layout: manual
|
||||
Extend a 2-dimensional sketch through a third dimension in order to create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid.
|
||||
|
||||
```kcl
|
||||
extrude(
|
||||
@sketches: [Sketch; 1+],
|
||||
length: number(Length),
|
||||
symmetric?: bool,
|
||||
bidirectionalLength?: number(Length),
|
||||
tagStart?: TagDecl,
|
||||
tagEnd?: TagDecl,
|
||||
twistAngle?: number(Angle),
|
||||
twistAngleStep?: number(Angle),
|
||||
twistCenter?: Point2d,
|
||||
): [Solid; 1+]
|
||||
```
|
||||
example = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [10, 0])
|
||||
|> arc(angleStart = 120deg, angleEnd = 0, radius = 5)
|
||||
|> line(end = [5, 0])
|
||||
|> line(end = [0, 10])
|
||||
|> bezierCurve(control1 = [-10, 0], control2 = [2, 10], end = [-5, 10])
|
||||
|> line(end = [-5, -2])
|
||||
|> close()
|
||||
|> extrude(length = 10)
|
||||
|
||||
You can provide more than one sketch to extrude, and they will all be
|
||||
extruded in the same direction.
|
||||
```
|
||||
|
||||
### Arguments
|
||||
|
||||
@ -42,6 +39,26 @@ extruded in the same direction.
|
||||
|
||||
[`[Solid; 1+]`](/docs/kcl-std/types/std-types-Solid)
|
||||
|
||||
### Description
|
||||
|
||||
You can provide more than one sketch to extrude, and they will all be
|
||||
extruded in the same direction.
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
extrude(
|
||||
@sketches: [Sketch; 1+],
|
||||
length: number(Length),
|
||||
symmetric?: bool,
|
||||
bidirectionalLength?: number(Length),
|
||||
tagStart?: TagDecl,
|
||||
tagEnd?: TagDecl,
|
||||
twistAngle?: number(Angle),
|
||||
twistAngleStep?: number(Angle),
|
||||
twistCenter?: Point2d,
|
||||
): [Solid; 1+]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
@ -8,11 +8,29 @@ layout: manual
|
||||
Get the shared edge between two faces.
|
||||
|
||||
```kcl
|
||||
getCommonEdge(faces: [TaggedFace; 2]): Edge
|
||||
// Get an edge shared between two faces, created after a chamfer.
|
||||
|
||||
|
||||
scale = 20
|
||||
part001 = startSketchOn(XY)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [0, scale])
|
||||
|> line(end = [scale, 0])
|
||||
|> line(end = [0, -scale])
|
||||
|> close(tag = $line0)
|
||||
|> extrude(length = 20, tagEnd = $end0)
|
||||
// We tag the chamfer to reference it later.
|
||||
|> chamfer(length = 10, tags = [getOppositeEdge(line0)], tag = $chamfer0)
|
||||
|
||||
// Get the shared edge between the chamfer and the extrusion.
|
||||
commonEdge = getCommonEdge(faces = [chamfer0, end0])
|
||||
|
||||
// Chamfer the shared edge.
|
||||
// TODO: uncomment this when ssi for fillets lands
|
||||
// chamfer(part001, length = 5, tags = [commonEdge])
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +42,12 @@ getCommonEdge(faces: [TaggedFace; 2]): Edge
|
||||
[`Edge`](/docs/kcl-std/types/std-types-Edge) - An edge of a solid.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
getCommonEdge(faces: [TaggedFace; 2]): Edge
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,20 @@ layout: manual
|
||||
Get the next adjacent edge to the edge given.
|
||||
|
||||
```kcl
|
||||
getNextAdjacentEdge(@edge: TaggedEdge): Edge
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [10, 0])
|
||||
|> angledLine(angle = 60deg, length = 10)
|
||||
|> angledLine(angle = 120deg, length = 10)
|
||||
|> line(end = [-10, 0])
|
||||
|> angledLine(angle = 240deg, length = 10, tag = $referenceEdge)
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|> fillet(radius = 3, tags = [getNextAdjacentEdge(referenceEdge)])
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +33,12 @@ getNextAdjacentEdge(@edge: TaggedEdge): Edge
|
||||
[`Edge`](/docs/kcl-std/types/std-types-Edge) - An edge of a solid.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
getNextAdjacentEdge(@edge: TaggedEdge): Edge
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,20 @@ layout: manual
|
||||
Get the opposite edge to the edge given.
|
||||
|
||||
```kcl
|
||||
getOppositeEdge(@edge: TaggedEdge): Edge
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [10, 0])
|
||||
|> angledLine(angle = 60deg, length = 10)
|
||||
|> angledLine(angle = 120deg, length = 10)
|
||||
|> line(end = [-10, 0])
|
||||
|> angledLine(angle = 240deg, length = 10, tag = $referenceEdge)
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|> fillet(radius = 3, tags = [getOppositeEdge(referenceEdge)])
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +33,12 @@ getOppositeEdge(@edge: TaggedEdge): Edge
|
||||
[`Edge`](/docs/kcl-std/types/std-types-Edge) - An edge of a solid.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
getOppositeEdge(@edge: TaggedEdge): Edge
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,20 @@ layout: manual
|
||||
Get the previous adjacent edge to the edge given.
|
||||
|
||||
```kcl
|
||||
getPreviousAdjacentEdge(@edge: TaggedEdge): Edge
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [10, 0])
|
||||
|> angledLine(angle = 60deg, length = 10)
|
||||
|> angledLine(angle = 120deg, length = 10)
|
||||
|> line(end = [-10, 0])
|
||||
|> angledLine(angle = 240deg, length = 10, tag = $referenceEdge)
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|> fillet(radius = 3, tags = [getPreviousAdjacentEdge(referenceEdge)])
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +33,12 @@ getPreviousAdjacentEdge(@edge: TaggedEdge): Edge
|
||||
[`Edge`](/docs/kcl-std/types/std-types-Edge) - An edge of a solid.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
getPreviousAdjacentEdge(@edge: TaggedEdge): Edge
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,30 +8,28 @@ layout: manual
|
||||
Extend the current sketch with a new involute circular curve.
|
||||
|
||||
```kcl
|
||||
involuteCircular(
|
||||
@sketch: Sketch,
|
||||
angle: number(Angle),
|
||||
startRadius?: number(Length),
|
||||
endRadius?: number(Length),
|
||||
startDiameter?: number(Length),
|
||||
endDiameter?: number(Length),
|
||||
reverse?: bool,
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
a = 10
|
||||
b = 14
|
||||
startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> involuteCircular(startRadius = a, endRadius = b, angle = 60deg)
|
||||
|> involuteCircular(
|
||||
startRadius = a,
|
||||
endRadius = b,
|
||||
angle = 60deg,
|
||||
reverse = true,
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `sketch` | [`Sketch`](/docs/kcl-std/types/std-types-Sketch) | Which sketch should this path be added to? | Yes |
|
||||
| `startRadius` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The involute is described between two circles, start_radius is the radius of the inner circle. | Yes |
|
||||
| `endRadius` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The involute is described between two circles, end_radius is the radius of the outer circle. | Yes |
|
||||
| `angle` | [`number(Angle)`](/docs/kcl-std/types/std-types-number) | The angle to rotate the involute by. A value of zero will produce a curve with a tangent along the x-axis at the start point of the curve. | Yes |
|
||||
| `startRadius` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The involute is described between two circles, startRadius is the radius of the inner circle. Either `startRadius` or `startDiameter` must be given (but not both). | No |
|
||||
| `endRadius` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The involute is described between two circles, endRadius is the radius of the outer circle. Either `endRadius` or `endDiameter` must be given (but not both). | No |
|
||||
| `startDiameter` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The involute is described between two circles, startDiameter describes the inner circle. Either `startRadius` or `startDiameter` must be given (but not both). | No |
|
||||
| `endDiameter` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The involute is described between two circles, endDiameter describes the outer circle. Either `endRadius` or `endDiameter` must be given (but not both). | No |
|
||||
| `reverse` | [`bool`](/docs/kcl-std/types/std-types-bool) | If reverse is true, the segment will start from the end of the involute, otherwise it will start from that start. | No |
|
||||
| `tag` | [`TagDecl`](/docs/kcl-std/types/std-types-TagDecl) | Create a new tag which refers to this line. | No |
|
||||
|
||||
@ -40,6 +38,19 @@ involuteCircular(
|
||||
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
involuteCircular(
|
||||
@sketch: Sketch,
|
||||
startRadius: number(Length),
|
||||
endRadius: number(Length),
|
||||
angle: number(Angle),
|
||||
reverse?: bool,
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,18 @@ layout: manual
|
||||
Extract the 'x' axis value of the last line segment in the provided 2-d sketch.
|
||||
|
||||
```kcl
|
||||
lastSegX(@sketch: Sketch): number(Length)
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [5, 0])
|
||||
|> line(end = [20, 5])
|
||||
|> line(end = [lastSegX(%), 0])
|
||||
|> line(end = [-15, 0])
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +31,12 @@ lastSegX(@sketch: Sketch): number(Length)
|
||||
[`number(Length)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
lastSegX(@sketch: Sketch): number(Length)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,18 @@ layout: manual
|
||||
Extract the 'y' axis value of the last line segment in the provided 2-d sketch.
|
||||
|
||||
```kcl
|
||||
lastSegY(@sketch: Sketch): number(Length)
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [5, 0])
|
||||
|> line(end = [20, 5])
|
||||
|> line(end = [0, lastSegY(%)])
|
||||
|> line(end = [-15, 0])
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +31,12 @@ lastSegY(@sketch: Sketch): number(Length)
|
||||
[`number(Length)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
lastSegY(@sketch: Sketch): number(Length)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,16 +8,29 @@ layout: manual
|
||||
Extend the current sketch with a new straight line.
|
||||
|
||||
```kcl
|
||||
line(
|
||||
@sketch: Sketch,
|
||||
endAbsolute?: Point2d,
|
||||
end?: Point2d,
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
triangle = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
// The END argument means it ends at exactly [10, 0].
|
||||
// This is an absolute measurement, it is NOT relative to
|
||||
// the start of the sketch.
|
||||
|> line(endAbsolute = [10, 0])
|
||||
|> line(endAbsolute = [0, 10])
|
||||
|> line(endAbsolute = [-10, 0], tag = $thirdLineOfTriangle)
|
||||
|> close()
|
||||
|> extrude(length = 5)
|
||||
|
||||
box = startSketchOn(XZ)
|
||||
|> startProfile(at = [10, 10])
|
||||
// The 'to' argument means move the pen this much.
|
||||
// So, [10, 0] is a relative distance away from the current point.
|
||||
|> line(end = [10, 0])
|
||||
|> line(end = [0, 10])
|
||||
|> line(end = [-10, 0], tag = $thirdLineOfBox)
|
||||
|> close()
|
||||
|> extrude(length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -32,6 +45,17 @@ line(
|
||||
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
line(
|
||||
@sketch: Sketch,
|
||||
endAbsolute?: Point2d,
|
||||
end?: Point2d,
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -8,18 +8,23 @@ layout: manual
|
||||
Repeat a 2-dimensional sketch some number of times along a partial or complete circle some specified number of times. Each object may additionally be rotated along the circle, ensuring orientation of the solid with respect to the center of the circle is maintained.
|
||||
|
||||
```kcl
|
||||
patternCircular2d(
|
||||
@sketches: [Sketch; 1+],
|
||||
instances: number(_),
|
||||
center: Point2d,
|
||||
arcDegrees?: number(Angle),
|
||||
rotateDuplicates?: bool,
|
||||
useOriginal?: bool,
|
||||
): [Sketch; 1+]
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [.5, 25])
|
||||
|> line(end = [0, 5])
|
||||
|> line(end = [-1, 0])
|
||||
|> line(end = [0, -5])
|
||||
|> close()
|
||||
|> patternCircular2d(
|
||||
center = [0, 0],
|
||||
instances = 13,
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
example = extrude(exampleSketch, length = 1)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -36,6 +41,19 @@ patternCircular2d(
|
||||
[`[Sketch; 1+]`](/docs/kcl-std/types/std-types-Sketch)
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
patternCircular2d(
|
||||
@sketches: [Sketch; 1+],
|
||||
instances: number(_),
|
||||
center: Point2d,
|
||||
arcDegrees?: number(Angle),
|
||||
rotateDuplicates?: bool,
|
||||
useOriginal?: bool,
|
||||
): [Sketch; 1+]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,17 +8,17 @@ layout: manual
|
||||
Repeat a 2-dimensional sketch along some dimension, with a dynamic amount of distance between each repetition, some specified number of times.
|
||||
|
||||
```kcl
|
||||
patternLinear2d(
|
||||
@sketches: [Sketch; 1+],
|
||||
instances: number(_),
|
||||
distance: number(Length),
|
||||
axis: Axis2d | Point2d,
|
||||
useOriginal?: bool,
|
||||
): [Sketch; 1+]
|
||||
// / Pattern using a named axis.
|
||||
|
||||
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> circle(center = [0, 0], radius = 1)
|
||||
|> patternLinear2d(axis = X, instances = 7, distance = 4)
|
||||
|
||||
example = extrude(exampleSketch, length = 1)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -34,6 +34,18 @@ patternLinear2d(
|
||||
[`[Sketch; 1+]`](/docs/kcl-std/types/std-types-Sketch)
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
patternLinear2d(
|
||||
@sketches: [Sketch; 1+],
|
||||
instances: number(_),
|
||||
distance: number(Length),
|
||||
axis: Axis2d | Point2d,
|
||||
useOriginal?: bool,
|
||||
): [Sketch; 1+]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,16 +8,18 @@ layout: manual
|
||||
Just like `patternTransform`, but works on 2D sketches not 3D solids.
|
||||
|
||||
```kcl
|
||||
patternTransform2d(
|
||||
@sketches: [Sketch; 1+],
|
||||
instances: number(_),
|
||||
transform: fn(number(_)): { },
|
||||
useOriginal?: boolean,
|
||||
): [Sketch; 1+]
|
||||
// Each instance will be shifted along the X axis.
|
||||
fn transform(@id) {
|
||||
return { translate = [4 * id, 0] }
|
||||
}
|
||||
|
||||
// Sketch 4 circles.
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> circle(center = [0, 0], radius = 2)
|
||||
|> patternTransform2d(instances = 4, transform = transform)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -32,6 +34,17 @@ patternTransform2d(
|
||||
[`[Sketch; 1+]`](/docs/kcl-std/types/std-types-Sketch)
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
patternTransform2d(
|
||||
@sketches: [Sketch; 1+],
|
||||
instances: number(_),
|
||||
transform: fn(number(_)): { },
|
||||
useOriginal?: boolean,
|
||||
): [Sketch; 1+]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -8,17 +8,19 @@ layout: manual
|
||||
Create a regular polygon with the specified number of sides that is either inscribed or circumscribed around a circle of the specified radius.
|
||||
|
||||
```kcl
|
||||
polygon(
|
||||
@sketchOrSurface: Sketch | Plane | Face,
|
||||
radius: number(Length),
|
||||
numSides: number(_),
|
||||
center: Point2d,
|
||||
inscribed?: bool,
|
||||
): Sketch
|
||||
// Create a regular hexagon inscribed in a circle of radius 10
|
||||
hex = startSketchOn(XY)
|
||||
|> polygon(
|
||||
radius = 10,
|
||||
numSides = 6,
|
||||
center = [0, 0],
|
||||
inscribed = true,
|
||||
)
|
||||
|
||||
example = extrude(hex, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -34,6 +36,18 @@ polygon(
|
||||
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
polygon(
|
||||
@sketchOrSurface: Sketch | Plane | Face,
|
||||
radius: number(Length),
|
||||
numSides: number(_),
|
||||
center: Point2d,
|
||||
inscribed?: bool,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,16 @@ layout: manual
|
||||
Extract the provided 2-dimensional sketch's profile's origin value.
|
||||
|
||||
```kcl
|
||||
profileStart(@profile: Sketch): Point2d
|
||||
sketch001 = startSketchOn(XY)
|
||||
|> startProfile(at = [5, 2])
|
||||
|> angledLine(angle = 120, length = 50, tag = $seg01)
|
||||
|> angledLine(angle = segAng(seg01) + 120deg, length = 50)
|
||||
|> line(end = profileStart(%))
|
||||
|> close()
|
||||
|> extrude(length = 20)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +29,12 @@ profileStart(@profile: Sketch): Point2d
|
||||
[`Point2d`](/docs/kcl-std/types/std-types-Point2d) - A point in two dimensional space.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
profileStart(@profile: Sketch): Point2d
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,14 @@ layout: manual
|
||||
Extract the provided 2-dimensional sketch's profile's origin's 'x' value.
|
||||
|
||||
```kcl
|
||||
profileStartX(@profile: Sketch): number(Length)
|
||||
sketch001 = startSketchOn(XY)
|
||||
|> startProfile(at = [5, 2])
|
||||
|> angledLine(angle = -26.6, length = 50)
|
||||
|> angledLine(angle = 90deg, length = 50)
|
||||
|> angledLine(angle = 30deg, endAbsoluteX = profileStartX(%))
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +27,12 @@ profileStartX(@profile: Sketch): number(Length)
|
||||
[`number(Length)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
profileStartX(@profile: Sketch): number(Length)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,13 @@ layout: manual
|
||||
Extract the provided 2-dimensional sketch's profile's origin's 'y' value.
|
||||
|
||||
```kcl
|
||||
profileStartY(@profile: Sketch): number(Length)
|
||||
sketch001 = startSketchOn(XY)
|
||||
|> startProfile(at = [5, 2])
|
||||
|> angledLine(angle = -60deg, length = 14)
|
||||
|> angledLine(angle = 30deg, endAbsoluteY = profileStartY(%))
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +26,12 @@ profileStartY(@profile: Sketch): number(Length)
|
||||
[`number(Length)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
profileStartY(@profile: Sketch): number(Length)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -7,6 +7,53 @@ layout: manual
|
||||
|
||||
Rotate a sketch around some provided axis, creating a solid from its extent.
|
||||
|
||||
```kcl
|
||||
part001 = startSketchOn(XY)
|
||||
|> startProfile(at = [4, 12])
|
||||
|> line(end = [2, 0])
|
||||
|> line(end = [0, -6])
|
||||
|> line(end = [4, -6])
|
||||
|> line(end = [0, -6])
|
||||
|> line(end = [-3.75, -4.5])
|
||||
|> line(end = [0, -5.5])
|
||||
|> line(end = [-2, 0])
|
||||
|> close()
|
||||
|> revolve(axis = Y) // default angle is 360deg
|
||||
|
||||
```
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `sketches` | [`[Sketch; 1+]`](/docs/kcl-std/types/std-types-Sketch) | The sketch or set of sketches that should be revolved | Yes |
|
||||
| `axis` | [`Axis2d`](/docs/kcl-std/types/std-types-Axis2d) or [`Edge`](/docs/kcl-std/types/std-types-Edge) | Axis of revolution. | Yes |
|
||||
| `angle` | [`number(Angle)`](/docs/kcl-std/types/std-types-number) | Angle to revolve (in degrees). Default is 360. | No |
|
||||
| `tolerance` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | Tolerance for the revolve operation. | No |
|
||||
| `symmetric` | [`bool`](/docs/kcl-std/types/std-types-bool) | If true, the extrusion will happen symmetrically around the sketch. Otherwise, the extrusion will happen on only one side of the sketch. | No |
|
||||
| `bidirectionalAngle` | [`number(Angle)`](/docs/kcl-std/types/std-types-number) | If specified, will also revolve in the opposite direction to 'angle' to the specified angle. If 'symmetric' is true, this value is ignored. | No |
|
||||
| `tagStart` | [`TagDecl`](/docs/kcl-std/types/std-types-TagDecl) | A named tag for the face at the start of the revolve, i.e. the original sketch. | No |
|
||||
| `tagEnd` | [`TagDecl`](/docs/kcl-std/types/std-types-TagDecl) | A named tag for the face at the end of the revolve. | No |
|
||||
|
||||
### Returns
|
||||
|
||||
[`[Solid; 1+]`](/docs/kcl-std/types/std-types-Solid)
|
||||
|
||||
### Description
|
||||
|
||||
This, like extrude, is able to create a 3-dimensional solid from a
|
||||
2-dimensional sketch. However, unlike extrude, this creates a solid
|
||||
by using the extent of the sketch as its revolved around an axis rather
|
||||
than using the extent of the sketch linearly translated through a third
|
||||
dimension.
|
||||
|
||||
Revolve occurs around a local sketch axis rather than a global axis.
|
||||
|
||||
You can provide more than one sketch to revolve, and they will all be
|
||||
revolved around the same axis.
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
revolve(
|
||||
@sketches: [Sketch; 1+],
|
||||
@ -20,35 +67,6 @@ revolve(
|
||||
): [Solid; 1+]
|
||||
```
|
||||
|
||||
This, like extrude, is able to create a 3-dimensional solid from a
|
||||
2-dimensional sketch. However, unlike extrude, this creates a solid
|
||||
by using the extent of the sketch as its revolved around an axis rather
|
||||
than using the extent of the sketch linearly translated through a third
|
||||
dimension.
|
||||
|
||||
Revolve occurs around a local sketch axis rather than a global axis.
|
||||
|
||||
You can provide more than one sketch to revolve, and they will all be
|
||||
revolved around the same axis.
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `sketches` | [`[Sketch; 1+]`](/docs/kcl-std/types/std-types-Sketch) | The sketch or set of sketches that should be revolved | Yes |
|
||||
| `axis` | [`Axis2d`](/docs/kcl-std/types/std-types-Axis2d) or [`Edge`](/docs/kcl-std/types/std-types-Edge) | Axis of revolution. | Yes |
|
||||
| `angle` | [`number(Angle)`](/docs/kcl-std/types/std-types-number) | Angle to revolve (in degrees). Default is 360. | No |
|
||||
| `tolerance` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | Defines the smallest distance below which two entities are considered coincident, intersecting, coplanar, or similar. For most use cases, it should not be changed from its default value of 10^-7 millimeters. | No |
|
||||
| `symmetric` | [`bool`](/docs/kcl-std/types/std-types-bool) | If true, the extrusion will happen symmetrically around the sketch. Otherwise, the extrusion will happen on only one side of the sketch. | No |
|
||||
| `bidirectionalAngle` | [`number(Angle)`](/docs/kcl-std/types/std-types-number) | If specified, will also revolve in the opposite direction to 'angle' to the specified angle. If 'symmetric' is true, this value is ignored. | No |
|
||||
| `tagStart` | [`TagDecl`](/docs/kcl-std/types/std-types-TagDecl) | A named tag for the face at the start of the revolve, i.e. the original sketch. | No |
|
||||
| `tagEnd` | [`TagDecl`](/docs/kcl-std/types/std-types-TagDecl) | A named tag for the face at the end of the revolve. | No |
|
||||
|
||||
### Returns
|
||||
|
||||
[`[Solid; 1+]`](/docs/kcl-std/types/std-types-Solid)
|
||||
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,20 @@ layout: manual
|
||||
Compute the angle (in degrees) of the provided line segment.
|
||||
|
||||
```kcl
|
||||
segAng(@tag: TaggedEdge): number(Angle)
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [10, 0])
|
||||
|> line(end = [5, 10], tag = $seg01)
|
||||
|> line(end = [-10, 0])
|
||||
|> angledLine(angle = segAng(seg01), length = 10)
|
||||
|> line(end = [-10, 0])
|
||||
|> angledLine(angle = segAng(seg01), length = -15)
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 4)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +33,12 @@ segAng(@tag: TaggedEdge): number(Angle)
|
||||
[`number(Angle)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
segAng(@tag: TaggedEdge): number(Angle)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,30 @@ layout: manual
|
||||
Compute the ending point of the provided line segment.
|
||||
|
||||
```kcl
|
||||
segEnd(@tag: TaggedEdge): Point2d
|
||||
w = 15
|
||||
cube = startSketchOn(XY)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [w, 0], tag = $line1)
|
||||
|> line(end = [0, w], tag = $line2)
|
||||
|> line(end = [-w, 0], tag = $line3)
|
||||
|> line(end = [0, -w], tag = $line4)
|
||||
|> close()
|
||||
|> extrude(length = 5)
|
||||
|
||||
fn cylinder(radius, tag) {
|
||||
return startSketchOn(XY)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> circle(radius = radius, center = segEnd(tag))
|
||||
|> extrude(length = radius)
|
||||
}
|
||||
|
||||
cylinder(radius = 1, tag = line1)
|
||||
cylinder(radius = 2, tag = line2)
|
||||
cylinder(radius = 3, tag = line3)
|
||||
cylinder(radius = 4, tag = line4)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +43,12 @@ segEnd(@tag: TaggedEdge): Point2d
|
||||
[`Point2d`](/docs/kcl-std/types/std-types-Point2d) - A point in two dimensional space.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
segEnd(@tag: TaggedEdge): Point2d
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,18 @@ layout: manual
|
||||
Compute the ending point of the provided line segment along the 'x' axis.
|
||||
|
||||
```kcl
|
||||
segEndX(@tag: TaggedEdge): number(Length)
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [20, 0], tag = $thing)
|
||||
|> line(end = [0, 5])
|
||||
|> line(end = [segEndX(thing), 0])
|
||||
|> line(end = [-20, 10])
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +31,12 @@ segEndX(@tag: TaggedEdge): number(Length)
|
||||
[`number(Length)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
segEndX(@tag: TaggedEdge): number(Length)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,19 @@ layout: manual
|
||||
Compute the ending point of the provided line segment along the 'y' axis.
|
||||
|
||||
```kcl
|
||||
segEndY(@tag: TaggedEdge): number(Length)
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 3], tag = $thing)
|
||||
|> line(end = [-10, 0])
|
||||
|> line(end = [0, segEndY(thing)])
|
||||
|> line(end = [-10, 0])
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +32,12 @@ segEndY(@tag: TaggedEdge): number(Length)
|
||||
[`number(Length)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
segEndY(@tag: TaggedEdge): number(Length)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,17 @@ layout: manual
|
||||
Compute the length of the provided line segment.
|
||||
|
||||
```kcl
|
||||
segLen(@tag: TaggedEdge): number(Length)
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> angledLine(angle = 60, length = 10, tag = $thing)
|
||||
|> tangentialArc(angle = -120deg, radius = 5)
|
||||
|> angledLine(angle = -60deg, length = segLen(thing))
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +30,12 @@ segLen(@tag: TaggedEdge): number(Length)
|
||||
[`number(Length)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
segLen(@tag: TaggedEdge): number(Length)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,30 @@ layout: manual
|
||||
Compute the starting point of the provided line segment.
|
||||
|
||||
```kcl
|
||||
segStart(@tag: TaggedEdge): Point2d
|
||||
w = 15
|
||||
cube = startSketchOn(XY)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [w, 0], tag = $line1)
|
||||
|> line(end = [0, w], tag = $line2)
|
||||
|> line(end = [-w, 0], tag = $line3)
|
||||
|> line(end = [0, -w], tag = $line4)
|
||||
|> close()
|
||||
|> extrude(length = 5)
|
||||
|
||||
fn cylinder(radius, tag) {
|
||||
return startSketchOn(XY)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> circle(radius = radius, center = segStart(tag))
|
||||
|> extrude(length = radius)
|
||||
}
|
||||
|
||||
cylinder(radius = 1, tag = line1)
|
||||
cylinder(radius = 2, tag = line2)
|
||||
cylinder(radius = 3, tag = line3)
|
||||
cylinder(radius = 4, tag = line4)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +43,12 @@ segStart(@tag: TaggedEdge): Point2d
|
||||
[`Point2d`](/docs/kcl-std/types/std-types-Point2d) - A point in two dimensional space.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
segStart(@tag: TaggedEdge): Point2d
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,18 @@ layout: manual
|
||||
Compute the starting point of the provided line segment along the 'x' axis.
|
||||
|
||||
```kcl
|
||||
segStartX(@tag: TaggedEdge): number(Length)
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [20, 0], tag = $thing)
|
||||
|> line(end = [0, 5])
|
||||
|> line(end = [20 - segStartX(thing), 0])
|
||||
|> line(end = [-20, 10])
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +31,12 @@ segStartX(@tag: TaggedEdge): number(Length)
|
||||
[`number(Length)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
segStartX(@tag: TaggedEdge): number(Length)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,11 +8,19 @@ layout: manual
|
||||
Compute the starting point of the provided line segment along the 'y' axis.
|
||||
|
||||
```kcl
|
||||
segStartY(@tag: TaggedEdge): number(Length)
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [20, 0])
|
||||
|> line(end = [0, 3], tag = $thing)
|
||||
|> line(end = [-10, 0])
|
||||
|> line(end = [0, 20 - segStartY(thing)])
|
||||
|> line(end = [-10, 0])
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +32,12 @@ segStartY(@tag: TaggedEdge): number(Length)
|
||||
[`number(Length)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
segStartY(@tag: TaggedEdge): number(Length)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,15 +8,17 @@ layout: manual
|
||||
Start a new profile at a given point.
|
||||
|
||||
```kcl
|
||||
startProfile(
|
||||
@startProfileOn: Plane | Face,
|
||||
at: Point2d,
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [10, 0])
|
||||
|> line(end = [0, 10])
|
||||
|> line(end = [-10, 0])
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -30,6 +32,16 @@ startProfile(
|
||||
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
startProfile(
|
||||
@startProfileOn: Plane | Face,
|
||||
at: Point2d,
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,12 +8,48 @@ layout: manual
|
||||
Start a new 2-dimensional sketch on a specific plane or face.
|
||||
|
||||
```kcl
|
||||
startSketchOn(
|
||||
@planeOrSolid: Solid | Plane,
|
||||
face?: TaggedFace,
|
||||
): Plane | Face
|
||||
exampleSketch = startSketchOn(XY)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [10, 0])
|
||||
|> line(end = [0, 10])
|
||||
|> line(end = [-10, 0])
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
|
||||
exampleSketch002 = startSketchOn(example, face = END)
|
||||
|> startProfile(at = [1, 1])
|
||||
|> line(end = [8, 0])
|
||||
|> line(end = [0, 8])
|
||||
|> line(end = [-8, 0])
|
||||
|> close()
|
||||
|
||||
example002 = extrude(exampleSketch002, length = 5)
|
||||
|
||||
exampleSketch003 = startSketchOn(example002, face = END)
|
||||
|> startProfile(at = [2, 2])
|
||||
|> line(end = [6, 0])
|
||||
|> line(end = [0, 6])
|
||||
|> line(end = [-6, 0])
|
||||
|> close()
|
||||
|
||||
example003 = extrude(exampleSketch003, length = 5)
|
||||
|
||||
```
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `planeOrSolid` | [`Solid`](/docs/kcl-std/types/std-types-Solid) or [`Plane`](/docs/kcl-std/types/std-types-Plane) | Profile whose start is being used. | Yes |
|
||||
| `face` | [`TaggedFace`](/docs/kcl-std/types/std-types-TaggedFace) | Identify a face of a solid if a solid is specified as the input argument (`planeOrSolid`). | No |
|
||||
|
||||
### Returns
|
||||
|
||||
[`Plane`](/docs/kcl-std/types/std-types-Plane) or [`Face`](/docs/kcl-std/types/std-types-Face)
|
||||
|
||||
### Description
|
||||
|
||||
### Sketch on Face Behavior
|
||||
|
||||
There are some important behaviors to understand when sketching on a face:
|
||||
@ -31,17 +67,14 @@ The point is if you want to export the result of a sketch on a face, you
|
||||
only need to export the final Solid that was created from the sketch on the
|
||||
face, since it will include all the parent faces and Solids.
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `planeOrSolid` | [`Solid`](/docs/kcl-std/types/std-types-Solid) or [`Plane`](/docs/kcl-std/types/std-types-Plane) | Profile whose start is being used. | Yes |
|
||||
| `face` | [`TaggedFace`](/docs/kcl-std/types/std-types-TaggedFace) | Identify a face of a solid if a solid is specified as the input argument (`planeOrSolid`). | No |
|
||||
|
||||
### Returns
|
||||
|
||||
[`Plane`](/docs/kcl-std/types/std-types-Plane) or [`Face`](/docs/kcl-std/types/std-types-Face)
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
startSketchOn(
|
||||
@planeOrSolid: Solid | Plane,
|
||||
face?: TaggedFace,
|
||||
): Plane | Face
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
@ -8,14 +8,19 @@ layout: manual
|
||||
Use a 2-dimensional sketch to cut a hole in another 2-dimensional sketch.
|
||||
|
||||
```kcl
|
||||
subtract2d(
|
||||
@sketch: Sketch,
|
||||
tool: [Sketch; 1+],
|
||||
): Sketch
|
||||
exampleSketch = startSketchOn(XY)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [0, 5])
|
||||
|> line(end = [5, 0])
|
||||
|> line(end = [0, -5])
|
||||
|> close()
|
||||
|> subtract2d(tool = circle(center = [1, 1], radius = .25))
|
||||
|> subtract2d(tool = circle(center = [1, 4], radius = .25))
|
||||
|
||||
example = extrude(exampleSketch, length = 1)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -28,6 +33,15 @@ subtract2d(
|
||||
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
subtract2d(
|
||||
@sketch: Sketch,
|
||||
tool: [Sketch; 1+],
|
||||
): Sketch
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -8,11 +8,19 @@ layout: manual
|
||||
Returns the angle coming out of the end of the segment in degrees.
|
||||
|
||||
```kcl
|
||||
tangentToEnd(@tag: TaggedEdge): number(Angle)
|
||||
// Horizontal pill.
|
||||
pillSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(end = [20, 0])
|
||||
|> tangentialArc(end = [0, 10], tag = $arc1)
|
||||
|> angledLine(angle = tangentToEnd(arc1), length = 20)
|
||||
|> tangentialArc(end = [0, -10])
|
||||
|> close()
|
||||
|
||||
pillExtrude = extrude(pillSketch, length = 10)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -24,6 +32,12 @@ tangentToEnd(@tag: TaggedEdge): number(Angle)
|
||||
[`number(Angle)`](/docs/kcl-std/types/std-types-number) - A number.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
tangentToEnd(@tag: TaggedEdge): number(Angle)
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,22 +8,16 @@ layout: manual
|
||||
Starting at the current sketch's origin, draw a curved line segment along some part of an imaginary circle until it reaches the desired (x, y) coordinates.
|
||||
|
||||
```kcl
|
||||
tangentialArc(
|
||||
@sketch: Sketch,
|
||||
endAbsolute?: Point2d,
|
||||
end?: Point2d,
|
||||
radius?: number(Length),
|
||||
diameter?: number(Length),
|
||||
angle?: number(Angle),
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
```
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> angledLine(angle = 45deg, length = 10)
|
||||
|> tangentialArc(end = [0, -10])
|
||||
|> line(end = [-10, 0])
|
||||
|> close()
|
||||
|
||||
When using radius and angle, draw a curved line segment along part of an
|
||||
imaginary circle. The arc is constructed such that the last line segment is
|
||||
placed tangent to the imaginary circle of the specified radius. The
|
||||
resulting arc is the segment of the imaginary circle from that tangent point
|
||||
for 'angle' degrees along the imaginary circle.
|
||||
example = extrude(exampleSketch, length = 10)
|
||||
|
||||
```
|
||||
|
||||
### Arguments
|
||||
|
||||
@ -41,6 +35,27 @@ for 'angle' degrees along the imaginary circle.
|
||||
|
||||
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
|
||||
|
||||
### Description
|
||||
|
||||
When using radius and angle, draw a curved line segment along part of an
|
||||
imaginary circle. The arc is constructed such that the last line segment is
|
||||
placed tangent to the imaginary circle of the specified radius. The
|
||||
resulting arc is the segment of the imaginary circle from that tangent point
|
||||
for 'angle' degrees along the imaginary circle.
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
tangentialArc(
|
||||
@sketch: Sketch,
|
||||
endAbsolute?: Point2d,
|
||||
end?: Point2d,
|
||||
radius?: number(Length),
|
||||
diameter?: number(Length),
|
||||
angle?: number(Angle),
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
@ -8,16 +8,20 @@ layout: manual
|
||||
Draw a line relative to the current origin to a specified distance away from the current position along the 'x' axis.
|
||||
|
||||
```kcl
|
||||
xLine(
|
||||
@sketch: Sketch,
|
||||
length?: number(Length),
|
||||
endAbsolute?: number(Length),
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> xLine(length = 15)
|
||||
|> angledLine(angle = 80deg, length = 15)
|
||||
|> line(end = [8, -10])
|
||||
|> xLine(length = 10)
|
||||
|> angledLine(angle = 120deg, length = 30)
|
||||
|> xLine(length = -15)
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 10)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -32,6 +36,17 @@ xLine(
|
||||
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
xLine(
|
||||
@sketch: Sketch,
|
||||
length?: number(Length),
|
||||
endAbsolute?: number(Length),
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,16 +8,18 @@ layout: manual
|
||||
Draw a line relative to the current origin to a specified distance away from the current position along the 'y' axis.
|
||||
|
||||
```kcl
|
||||
yLine(
|
||||
@sketch: Sketch,
|
||||
length?: number(Length),
|
||||
endAbsolute?: number(Length),
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> yLine(length = 15)
|
||||
|> angledLine(angle = 30deg, length = 15)
|
||||
|> line(end = [8, -10])
|
||||
|> yLine(length = -5)
|
||||
|> close()
|
||||
|
||||
example = extrude(exampleSketch, length = 10)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -32,6 +34,17 @@ yLine(
|
||||
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
yLine(
|
||||
@sketch: Sketch,
|
||||
length?: number(Length),
|
||||
endAbsolute?: number(Length),
|
||||
tag?: TagDecl,
|
||||
): Sketch
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
@ -8,15 +8,19 @@ layout: manual
|
||||
Set the appearance of a solid. This only works on solids, not sketches or individual paths.
|
||||
|
||||
```kcl
|
||||
appearance(
|
||||
@solids: [Solid; 1+] | ImportedGeometry,
|
||||
color: string,
|
||||
metalness?: number(_),
|
||||
roughness?: number(_),
|
||||
): [Solid; 1+] | ImportedGeometry
|
||||
```
|
||||
// Add color to an extruded solid.
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> startProfile(at = [0, 0])
|
||||
|> line(endAbsolute = [10, 0])
|
||||
|> line(endAbsolute = [0, 10])
|
||||
|> line(endAbsolute = [-10, 0])
|
||||
|> close()
|
||||
|
||||
This will work on any solid, including extruded solids, revolved solids, and shelled solids.
|
||||
example = extrude(exampleSketch, length = 5)
|
||||
// There are other options besides 'color', but they're optional.
|
||||
|> appearance(color = '#ff0000')
|
||||
|
||||
```
|
||||
|
||||
### Arguments
|
||||
|
||||
@ -31,6 +35,20 @@ This will work on any solid, including extruded solids, revolved solids, and she
|
||||
|
||||
[`[Solid; 1+]`](/docs/kcl-std/types/std-types-Solid) or [`ImportedGeometry`](/docs/kcl-std/types/std-types-ImportedGeometry)
|
||||
|
||||
### Description
|
||||
|
||||
This will work on any solid, including extruded solids, revolved solids, and shelled solids.
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
appearance(
|
||||
@solids: [Solid; 1+] | ImportedGeometry,
|
||||
color: string,
|
||||
metalness?: number(_),
|
||||
roughness?: number(_),
|
||||
): [Solid; 1+] | ImportedGeometry
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -8,18 +8,30 @@ layout: manual
|
||||
Blend a transitional edge along a tagged path, smoothing the sharp edge.
|
||||
|
||||
```kcl
|
||||
fillet(
|
||||
@solid: Solid,
|
||||
radius: number(Length),
|
||||
tags: [Edge; 1+],
|
||||
tolerance?: number(Length),
|
||||
tag?: TagDecl,
|
||||
): Solid
|
||||
```
|
||||
width = 20
|
||||
length = 10
|
||||
thickness = 1
|
||||
filletRadius = 2
|
||||
|
||||
Fillet is similar in function and use to a chamfer, except
|
||||
a chamfer will cut a sharp transition along an edge while fillet
|
||||
will smoothly blend the transition.
|
||||
mountingPlateSketch = startSketchOn(XY)
|
||||
|> startProfile(at = [-width / 2, -length / 2])
|
||||
|> line(endAbsolute = [width / 2, -length / 2], tag = $edge1)
|
||||
|> line(endAbsolute = [width / 2, length / 2], tag = $edge2)
|
||||
|> line(endAbsolute = [-width / 2, length / 2], tag = $edge3)
|
||||
|> close(tag = $edge4)
|
||||
|
||||
mountingPlate = extrude(mountingPlateSketch, length = thickness)
|
||||
|> fillet(
|
||||
radius = filletRadius,
|
||||
tags = [
|
||||
getNextAdjacentEdge(edge1),
|
||||
getNextAdjacentEdge(edge2),
|
||||
getNextAdjacentEdge(edge3),
|
||||
getNextAdjacentEdge(edge4)
|
||||
],
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
### Arguments
|
||||
|
||||
@ -28,13 +40,30 @@ will smoothly blend the transition.
|
||||
| `solid` | [`Solid`](/docs/kcl-std/types/std-types-Solid) | The solid whose edges should be filletted | Yes |
|
||||
| `radius` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The radius of the fillet | Yes |
|
||||
| `tags` | [`[Edge; 1+]`](/docs/kcl-std/types/std-types-Edge) | The paths you want to fillet | Yes |
|
||||
| `tolerance` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | Defines the smallest distance below which two entities are considered coincident, intersecting, coplanar, or similar. For most use cases, it should not be changed from its default value of 10^-7 millimeters. | No |
|
||||
| `tolerance` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The tolerance for this fillet | No |
|
||||
| `tag` | [`TagDecl`](/docs/kcl-std/types/std-types-TagDecl) | Create a new tag which refers to this fillet | No |
|
||||
|
||||
### Returns
|
||||
|
||||
[`Solid`](/docs/kcl-std/types/std-types-Solid) - A solid is a collection of extruded surfaces.
|
||||
|
||||
### Description
|
||||
|
||||
Fillet is similar in function and use to a chamfer, except
|
||||
a chamfer will cut a sharp transition along an edge while fillet
|
||||
will smoothly blend the transition.
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
fillet(
|
||||
@solid: Solid,
|
||||
radius: number(Length),
|
||||
tags: [Edge; 1+],
|
||||
tolerance?: number(Length),
|
||||
tag?: TagDecl,
|
||||
): Solid
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -8,28 +8,53 @@ layout: manual
|
||||
Intersect returns the shared volume between multiple solids, preserving only overlapping regions.
|
||||
|
||||
```kcl
|
||||
intersect(
|
||||
@solids: [Solid; 2+],
|
||||
tolerance?: number(Length),
|
||||
): [Solid; 1+]
|
||||
```
|
||||
// Intersect two cubes using the stdlib functions.
|
||||
|
||||
Intersect computes the geometric intersection of multiple solid bodies,
|
||||
returning a new solid representing the volume that is common to all input
|
||||
solids. This operation is useful for determining shared material regions,
|
||||
verifying fit, and analyzing overlapping geometries in assemblies.
|
||||
|
||||
fn cube(center, size) {
|
||||
return startSketchOn(XY)
|
||||
|> startProfile(at = [center[0] - size, center[1] - size])
|
||||
|> line(endAbsolute = [center[0] + size, center[1] - size])
|
||||
|> line(endAbsolute = [center[0] + size, center[1] + size])
|
||||
|> line(endAbsolute = [center[0] - size, center[1] + size])
|
||||
|> close()
|
||||
|> extrude(length = 10)
|
||||
}
|
||||
|
||||
part001 = cube(center = [0, 0], size = 10)
|
||||
part002 = cube(center = [7, 3], size = 5)
|
||||
|> translate(z = 1)
|
||||
|
||||
intersectedPart = intersect([part001, part002])
|
||||
|
||||
```
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `solids` | `[Solid; 2+]` | The solids to intersect. | Yes |
|
||||
| `tolerance` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | Defines the smallest distance below which two entities are considered coincident, intersecting, coplanar, or similar. For most use cases, it should not be changed from its default value of 10^-7 millimeters. | No |
|
||||
| `tolerance` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The tolerance to use for the intersection operation. | No |
|
||||
|
||||
### Returns
|
||||
|
||||
[`[Solid; 1+]`](/docs/kcl-std/types/std-types-Solid)
|
||||
|
||||
### Description
|
||||
|
||||
Intersect computes the geometric intersection of multiple solid bodies,
|
||||
returning a new solid representing the volume that is common to all input
|
||||
solids. This operation is useful for determining shared material regions,
|
||||
verifying fit, and analyzing overlapping geometries in assemblies.
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
intersect(
|
||||
@solids: [Solid; 2+],
|
||||
tolerance?: number(Length),
|
||||
): [Solid; 1+]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
@ -8,19 +8,23 @@ layout: manual
|
||||
Repeat a 3-dimensional solid some number of times along a partial or complete circle some specified number of times. Each object may additionally be rotated along the circle, ensuring orientation of the solid with respect to the center of the circle is maintained.
|
||||
|
||||
```kcl
|
||||
patternCircular3d(
|
||||
@solids: [Solid; 1+],
|
||||
instances: number(_),
|
||||
axis: Axis3d | Point3d,
|
||||
center: Point3d,
|
||||
arcDegrees?: number(deg),
|
||||
rotateDuplicates?: bool,
|
||||
useOriginal?: bool,
|
||||
): [Solid; 1+]
|
||||
// / Pattern using a named axis.
|
||||
|
||||
|
||||
exampleSketch = startSketchOn(XZ)
|
||||
|> circle(center = [0, 0], radius = 1)
|
||||
|
||||
example = extrude(exampleSketch, length = -5)
|
||||
|> patternCircular3d(
|
||||
axis = X,
|
||||
center = [10, -20, 0],
|
||||
instances = 11,
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -38,6 +42,20 @@ patternCircular3d(
|
||||
[`[Solid; 1+]`](/docs/kcl-std/types/std-types-Solid)
|
||||
|
||||
|
||||
### Function signature
|
||||
|
||||
```kcl
|
||||
patternCircular3d(
|
||||
@solids: [Solid; 1+],
|
||||
instances: number(_),
|
||||
axis: Axis3d | Point3d,
|
||||
center: Point3d,
|
||||
arcDegrees?: number(deg),
|
||||
rotateDuplicates?: bool,
|
||||
useOriginal?: bool,
|
||||
): [Solid; 1+]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```kcl
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user