From 4be9f70965c35ca3eb3c9d1c415a601476936a7b Mon Sep 17 00:00:00 2001 From: Jess Frazelle Date: Wed, 13 Mar 2024 14:22:22 -0700 Subject: [PATCH] change up docs format (#1711) * change up docs format Signed-off-by: Jess Frazelle * change up docs format Signed-off-by: Jess Frazelle * change up docs format Signed-off-by: Jess Frazelle * fix Signed-off-by: Jess Frazelle * workflow to push docs Signed-off-by: Jess Frazelle * fix[ Signed-off-by: Jess Frazelle * initial commit Signed-off-by: Jess Frazelle * fix Signed-off-by: Jess Frazelle * initial commit Signed-off-by: Jess Frazelle * initial commit Signed-off-by: Jess Frazelle * fixes Signed-off-by: Jess Frazelle * updates Signed-off-by: Jess Frazelle --------- Signed-off-by: Jess Frazelle --- .github/workflows/generate-website-docs.yml | 62 + docs/kcl/KNOWN-ISSUES.md | 6 +- docs/kcl/abs.md | 30 + docs/kcl/acos.md | 30 + docs/kcl/angleToMatchLengthX.md | 202 + docs/kcl/angleToMatchLengthY.md | 202 + docs/kcl/angledLine.md | 374 + docs/kcl/angledLineOfXLength.md | 374 + docs/kcl/angledLineOfYLength.md | 375 + docs/kcl/angledLineThatIntersects.md | 381 + docs/kcl/angledLineToX.md | 375 + docs/kcl/angledLineToY.md | 374 + docs/kcl/arc.md | 387 + docs/kcl/asin.md | 30 + docs/kcl/atan.md | 30 + docs/kcl/bezierCurve.md | 378 + docs/kcl/ceil.md | 30 + docs/kcl/circle.md | 250 + docs/kcl/close.md | 369 + docs/kcl/cos.md | 30 + docs/kcl/e.md | 29 + docs/kcl/extrude.md | 330 + docs/kcl/fillet.md | 307 + docs/kcl/floor.md | 30 + docs/kcl/getExtrudeWallTransform.md | 175 + docs/kcl/getNextAdjacentEdge.md | 171 + docs/kcl/getOppositeEdge.md | 171 + docs/kcl/getPreviousAdjacentEdge.md | 171 + docs/kcl/hole.md | 532 + docs/kcl/import.md | 136 + docs/kcl/index.md | 80 + docs/kcl/lastSegX.md | 199 + docs/kcl/lastSegY.md | 199 + docs/kcl/legAngX.md | 31 + docs/kcl/legAngY.md | 31 + docs/kcl/legLen.md | 31 + docs/kcl/line.md | 371 + docs/kcl/lineTo.md | 386 + docs/kcl/ln.md | 30 + docs/kcl/log.md | 31 + docs/kcl/log10.md | 30 + docs/kcl/log2.md | 30 + docs/kcl/max.md | 30 + docs/kcl/min.md | 30 + docs/kcl/patternCircular2d.md | 213 + docs/kcl/patternCircular3d.md | 188 + docs/kcl/patternLinear2d.md | 210 + docs/kcl/patternLinear3d.md | 182 + docs/kcl/pi.md | 29 + docs/kcl/pow.md | 31 + docs/kcl/segAng.md | 202 + docs/kcl/segEndX.md | 200 + docs/kcl/segEndY.md | 200 + docs/kcl/segLen.md | 200 + docs/kcl/sin.md | 30 + docs/kcl/sqrt.md | 30 + docs/kcl/startProfileAt.md | 265 + docs/kcl/startSketchAt.md | 203 + docs/kcl/startSketchOn.md | 286 + docs/kcl/std.md | 12327 ------------------ docs/kcl/tan.md | 30 + docs/kcl/tangentialArc.md | 377 + docs/kcl/tangentialArcTo.md | 362 + docs/kcl/tau.md | 29 + docs/kcl/toDegrees.md | 30 + docs/kcl/toRadians.md | 30 + docs/kcl/types.md | 6 +- docs/kcl/xLine.md | 371 + docs/kcl/xLineTo.md | 371 + docs/kcl/yLine.md | 371 + docs/kcl/yLineTo.md | 372 + public/expectations.md | 2 +- src/components/CodeMenu.tsx | 2 +- src/routes/Onboarding/CodeEditor.tsx | 2 +- src/wasm-lib/Cargo.lock | 19 +- src/wasm-lib/kcl/Cargo.toml | 4 +- src/wasm-lib/kcl/src/std/mod.rs | 54 +- 77 files changed, 12727 insertions(+), 12351 deletions(-) create mode 100644 .github/workflows/generate-website-docs.yml create mode 100644 docs/kcl/abs.md create mode 100644 docs/kcl/acos.md create mode 100644 docs/kcl/angleToMatchLengthX.md create mode 100644 docs/kcl/angleToMatchLengthY.md create mode 100644 docs/kcl/angledLine.md create mode 100644 docs/kcl/angledLineOfXLength.md create mode 100644 docs/kcl/angledLineOfYLength.md create mode 100644 docs/kcl/angledLineThatIntersects.md create mode 100644 docs/kcl/angledLineToX.md create mode 100644 docs/kcl/angledLineToY.md create mode 100644 docs/kcl/arc.md create mode 100644 docs/kcl/asin.md create mode 100644 docs/kcl/atan.md create mode 100644 docs/kcl/bezierCurve.md create mode 100644 docs/kcl/ceil.md create mode 100644 docs/kcl/circle.md create mode 100644 docs/kcl/close.md create mode 100644 docs/kcl/cos.md create mode 100644 docs/kcl/e.md create mode 100644 docs/kcl/extrude.md create mode 100644 docs/kcl/fillet.md create mode 100644 docs/kcl/floor.md create mode 100644 docs/kcl/getExtrudeWallTransform.md create mode 100644 docs/kcl/getNextAdjacentEdge.md create mode 100644 docs/kcl/getOppositeEdge.md create mode 100644 docs/kcl/getPreviousAdjacentEdge.md create mode 100644 docs/kcl/hole.md create mode 100644 docs/kcl/import.md create mode 100644 docs/kcl/index.md create mode 100644 docs/kcl/lastSegX.md create mode 100644 docs/kcl/lastSegY.md create mode 100644 docs/kcl/legAngX.md create mode 100644 docs/kcl/legAngY.md create mode 100644 docs/kcl/legLen.md create mode 100644 docs/kcl/line.md create mode 100644 docs/kcl/lineTo.md create mode 100644 docs/kcl/ln.md create mode 100644 docs/kcl/log.md create mode 100644 docs/kcl/log10.md create mode 100644 docs/kcl/log2.md create mode 100644 docs/kcl/max.md create mode 100644 docs/kcl/min.md create mode 100644 docs/kcl/patternCircular2d.md create mode 100644 docs/kcl/patternCircular3d.md create mode 100644 docs/kcl/patternLinear2d.md create mode 100644 docs/kcl/patternLinear3d.md create mode 100644 docs/kcl/pi.md create mode 100644 docs/kcl/pow.md create mode 100644 docs/kcl/segAng.md create mode 100644 docs/kcl/segEndX.md create mode 100644 docs/kcl/segEndY.md create mode 100644 docs/kcl/segLen.md create mode 100644 docs/kcl/sin.md create mode 100644 docs/kcl/sqrt.md create mode 100644 docs/kcl/startProfileAt.md create mode 100644 docs/kcl/startSketchAt.md create mode 100644 docs/kcl/startSketchOn.md delete mode 100644 docs/kcl/std.md create mode 100644 docs/kcl/tan.md create mode 100644 docs/kcl/tangentialArc.md create mode 100644 docs/kcl/tangentialArcTo.md create mode 100644 docs/kcl/tau.md create mode 100644 docs/kcl/toDegrees.md create mode 100644 docs/kcl/toRadians.md create mode 100644 docs/kcl/xLine.md create mode 100644 docs/kcl/xLineTo.md create mode 100644 docs/kcl/yLine.md create mode 100644 docs/kcl/yLineTo.md diff --git a/.github/workflows/generate-website-docs.yml b/.github/workflows/generate-website-docs.yml new file mode 100644 index 0000000000..e1cf61282f --- /dev/null +++ b/.github/workflows/generate-website-docs.yml @@ -0,0 +1,62 @@ +on: + push: + branches: + - main + paths: + - .github/workflows/generate-website-docs.yml + - 'docs/**' + pull_request: + paths: + - .github/workflows/generate-website-docs.yml + workflow_dispatch: +name: generate-website-docs +concurrency: + group: docs-${{ github.ref }} + cancel-in-progress: true +jobs: + generate-website-docs: + name: generate-website-docs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/create-github-app-token@v1 + id: app-token + with: + # required + app-id: ${{ secrets.GH_ORG_APP_ID }} + private-key: ${{ secrets.GH_ORG_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + # Checkout the docs repo since we will want to update the files there. + - uses: actions/checkout@v4 + with: + repository: 'kittycad/documentation' + path: 'documentation' + token: ${{ steps.app-token.outputs.token }} + - name: move docs to docs + shell: bash + run: | + mkdir -p documentation/content/pages/docs/kcl/ + # cleanup old + rm -rf documentation/content/pages/docs/kcl/*.md + # move new + mv -f docs/kcl/*.md documentation/content/pages/docs/kcl/ + - name: commit the changes in the docs repo + shell: bash + run: | + cd documentation + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git add . + git commit -am "YOYO NEW KCL DOCS!!" || exit 0 + git fetch origin + git rebase origin/main || exit 0 + export NEW_BRANCH="update-kcl-docs" + git checkout -b "$NEW_BRANCH" + git push -f origin "$NEW_BRANCH" + gh pr create --title "Update KCL docs" \ + --body "Updating the generated kcl docs cc @jessfraz @franknoirot merge this" \ + --head "$NEW_BRANCH" \ + --base main || true + env: + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} + diff --git a/docs/kcl/KNOWN-ISSUES.md b/docs/kcl/KNOWN-ISSUES.md index 420bcee93f..5dd7d9dec5 100644 --- a/docs/kcl/KNOWN-ISSUES.md +++ b/docs/kcl/KNOWN-ISSUES.md @@ -1,4 +1,8 @@ -# Known Issues +--- +title: "KCL Known Issues" +excerpt: "Known issues with the KCL standard library for the Zoo Modeling App." +layout: manual +--- The following are bugs that are not in modeling-app or kcl itself. These bugs once fixed in engine will just start working here with no language changes. diff --git a/docs/kcl/abs.md b/docs/kcl/abs.md new file mode 100644 index 0000000000..28f79970ec --- /dev/null +++ b/docs/kcl/abs.md @@ -0,0 +1,30 @@ +--- +title: "abs" +excerpt: "Computes the absolute value of a number." +layout: manual +--- + +Computes the absolute value of a number. + + + +``` +abs(num: number) -> number +``` + +### Examples + +```kcl +const myVar = abs(-4) +``` + +### Arguments + +* `num`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/acos.md b/docs/kcl/acos.md new file mode 100644 index 0000000000..5569c6cfd7 --- /dev/null +++ b/docs/kcl/acos.md @@ -0,0 +1,30 @@ +--- +title: "acos" +excerpt: "Computes the arccosine of a number (in radians)." +layout: manual +--- + +Computes the arccosine of a number (in radians). + + + +``` +acos(num: number) -> number +``` + +### Examples + +```kcl +const myVar = acos(0.5) +``` + +### Arguments + +* `num`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/angleToMatchLengthX.md b/docs/kcl/angleToMatchLengthX.md new file mode 100644 index 0000000000..00c0b45c15 --- /dev/null +++ b/docs/kcl/angleToMatchLengthX.md @@ -0,0 +1,202 @@ +--- +title: "angleToMatchLengthX" +excerpt: "Returns the angle to match the given length for x." +layout: manual +--- + +Returns the angle to match the given length for x. + + + +``` +angleToMatchLengthX(segment_name: string, to: number, sketch_group: SketchGroup) -> number +``` + +### Examples + +```kcl +const part001 = startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> line({ to: [1, 3.82], tag: 'seg01' }, %) + |> angledLineToX([ + -angleToMatchLengthX('seg01', 10, %), + 5 + ], %) + |> close(%) +``` + +### Arguments + +* `segment_name`: `string` (REQUIRED) +* `to`: `number` (REQUIRED) +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`number` + + + diff --git a/docs/kcl/angleToMatchLengthY.md b/docs/kcl/angleToMatchLengthY.md new file mode 100644 index 0000000000..6f386832e4 --- /dev/null +++ b/docs/kcl/angleToMatchLengthY.md @@ -0,0 +1,202 @@ +--- +title: "angleToMatchLengthY" +excerpt: "Returns the angle to match the given length for y." +layout: manual +--- + +Returns the angle to match the given length for y. + + + +``` +angleToMatchLengthY(segment_name: string, to: number, sketch_group: SketchGroup) -> number +``` + +### Examples + +```kcl +const part001 = startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> line({ to: [1, 3.82], tag: 'seg01' }, %) + |> angledLineToX([ + -angleToMatchLengthY('seg01', 10, %), + 5 + ], %) + |> close(%) +``` + +### Arguments + +* `segment_name`: `string` (REQUIRED) +* `to`: `number` (REQUIRED) +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`number` + + + diff --git a/docs/kcl/angledLine.md b/docs/kcl/angledLine.md new file mode 100644 index 0000000000..a5987a9a10 --- /dev/null +++ b/docs/kcl/angledLine.md @@ -0,0 +1,374 @@ +--- +title: "angledLine" +excerpt: "Draw an angled line." +layout: manual +--- + +Draw an angled line. + + + +``` +angledLine(data: AngledLineData, sketch_group: SketchGroup) -> SketchGroup +``` + +### Examples + +```kcl +startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> angledLine({ angle: 45, length: 10, tag: "edge1" }, %) + |> line([10, 10], %) + |> line([0, 10], %) + |> close(%, "edge2") + |> extrude(10, %) +``` + +### Arguments + +* `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED) +``` +{ + // The angle of the line. + angle: number, + // The length of the line. + length: number, + // The tag. + tag: string, +} | +[number, number] +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/angledLineOfXLength.md b/docs/kcl/angledLineOfXLength.md new file mode 100644 index 0000000000..f770e863f1 --- /dev/null +++ b/docs/kcl/angledLineOfXLength.md @@ -0,0 +1,374 @@ +--- +title: "angledLineOfXLength" +excerpt: "Draw an angled line of a given x length." +layout: manual +--- + +Draw an angled line of a given x length. + + + +``` +angledLineOfXLength(data: AngledLineData, sketch_group: SketchGroup) -> SketchGroup +``` + +### Examples + +```kcl +startSketchOn('XZ') + |> startProfileAt([0, 0], %) + |> angledLineOfXLength({ angle: 45, length: 10, tag: "edge1" }, %) + |> line([10, 10], %) + |> line([0, 10], %) + |> close(%, "edge2") + |> extrude(10, %) +``` + +### Arguments + +* `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED) +``` +{ + // The angle of the line. + angle: number, + // The length of the line. + length: number, + // The tag. + tag: string, +} | +[number, number] +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/angledLineOfYLength.md b/docs/kcl/angledLineOfYLength.md new file mode 100644 index 0000000000..9ce6e30915 --- /dev/null +++ b/docs/kcl/angledLineOfYLength.md @@ -0,0 +1,375 @@ +--- +title: "angledLineOfYLength" +excerpt: "Draw an angled line of a given y length." +layout: manual +--- + +Draw an angled line of a given y length. + + + +``` +angledLineOfYLength(data: AngledLineData, sketch_group: SketchGroup) -> SketchGroup +``` + +### Examples + +```kcl +startSketchOn('YZ') + |> startProfileAt([0, 0], %) + |> angledLineOfYLength({ angle: 45, length: 10, tag: "edge1" }, %) + |> line([10, 10], %) + |> line([0, 10], %) + |> close(%, "edge2") + |> extrude(10, %) + |> fillet({ radius: 2, tags: ["edge1"] }, %) +``` + +### Arguments + +* `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED) +``` +{ + // The angle of the line. + angle: number, + // The length of the line. + length: number, + // The tag. + tag: string, +} | +[number, number] +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/angledLineThatIntersects.md b/docs/kcl/angledLineThatIntersects.md new file mode 100644 index 0000000000..8bef3edc80 --- /dev/null +++ b/docs/kcl/angledLineThatIntersects.md @@ -0,0 +1,381 @@ +--- +title: "angledLineThatIntersects" +excerpt: "Draw an angled line that intersects with a given line." +layout: manual +--- + +Draw an angled line that intersects with a given line. + + + +``` +angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch_group: SketchGroup) -> SketchGroup +``` + +### Examples + +```kcl +const part001 = startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> lineTo({ to: [2, 2], tag: "yo" }, %) + |> lineTo([3, 1], %) + |> angledLineThatIntersects({ + angle: 180, + intersectTag: 'yo', + offset: 12, + tag: "yo2" + }, %) + |> line([4, 0], %) + |> close(%, "yo3") + |> extrude(10, %) +``` + +### Arguments + +* `data`: `AngledLineThatIntersectsData` - Data for drawing an angled line that intersects with a given line. (REQUIRED) +``` +{ + // The angle of the line. + angle: number, + // The tag of the line to intersect with. + intersectTag: string, + // The offset from the intersecting line. + offset: number, + // The tag. + tag: string, +} +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/angledLineToX.md b/docs/kcl/angledLineToX.md new file mode 100644 index 0000000000..427c7cd9e4 --- /dev/null +++ b/docs/kcl/angledLineToX.md @@ -0,0 +1,375 @@ +--- +title: "angledLineToX" +excerpt: "Draw an angled line to a given x coordinate." +layout: manual +--- + +Draw an angled line to a given x coordinate. + + + +``` +angledLineToX(data: AngledLineToData, sketch_group: SketchGroup) -> SketchGroup +``` + +### Examples + +```kcl +startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> angledLineToX({ angle: 45, to: 10, tag: "edge1" }, %) + |> line([10, 10], %) + |> line([0, 10], %) + |> close(%, "edge2") + |> extrude(10, %) + |> fillet({ radius: 2, tags: ["edge1"] }, %) +``` + +### Arguments + +* `data`: `AngledLineToData` - Data to draw an angled line to a point. (REQUIRED) +``` +{ + // The angle of the line. + angle: number, + // The tag. + tag: string, + // The point to draw to. + to: number, +} | +[number, number] +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/angledLineToY.md b/docs/kcl/angledLineToY.md new file mode 100644 index 0000000000..00d6f19221 --- /dev/null +++ b/docs/kcl/angledLineToY.md @@ -0,0 +1,374 @@ +--- +title: "angledLineToY" +excerpt: "Draw an angled line to a given y coordinate." +layout: manual +--- + +Draw an angled line to a given y coordinate. + + + +``` +angledLineToY(data: AngledLineToData, sketch_group: SketchGroup) -> SketchGroup +``` + +### Examples + +```kcl +startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> angledLineToY({ angle: 45, to: 10, tag: "edge1" }, %) + |> line([10, 10], %) + |> line([0, 10], %) + |> close(%, "edge2") + |> extrude(10, %) +``` + +### Arguments + +* `data`: `AngledLineToData` - Data to draw an angled line to a point. (REQUIRED) +``` +{ + // The angle of the line. + angle: number, + // The tag. + tag: string, + // The point to draw to. + to: number, +} | +[number, number] +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/arc.md b/docs/kcl/arc.md new file mode 100644 index 0000000000..89746a80fd --- /dev/null +++ b/docs/kcl/arc.md @@ -0,0 +1,387 @@ +--- +title: "arc" +excerpt: "Draw an arc." +layout: manual +--- + +Draw an arc. + + + +``` +arc(data: ArcData, sketch_group: SketchGroup) -> SketchGroup +``` + +### Examples + +```kcl +startSketchOn('-YZ') + |> startProfileAt([0, 0], %) + |> arc({ + angle_start: 0, + angle_end: 360, + radius: 10, + tag: "edge1" + }, %) + |> extrude(10, %) +``` + +### Arguments + +* `data`: `ArcData` - Data to draw an arc. (REQUIRED) +``` +{ + // The end angle. + angle_end: number, + // The start angle. + angle_start: number, + // The radius. + radius: number, + // The tag. + tag: string, +} | +{ + // The center. + center: [number, number], + // The radius. + radius: number, + // The tag. + tag: string, + // The to point. + to: [number, number], +} +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/asin.md b/docs/kcl/asin.md new file mode 100644 index 0000000000..96c2116f95 --- /dev/null +++ b/docs/kcl/asin.md @@ -0,0 +1,30 @@ +--- +title: "asin" +excerpt: "Computes the arcsine of a number (in radians)." +layout: manual +--- + +Computes the arcsine of a number (in radians). + + + +``` +asin(num: number) -> number +``` + +### Examples + +```kcl +const myVar = asin(0.5) +``` + +### Arguments + +* `num`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/atan.md b/docs/kcl/atan.md new file mode 100644 index 0000000000..df0174faaa --- /dev/null +++ b/docs/kcl/atan.md @@ -0,0 +1,30 @@ +--- +title: "atan" +excerpt: "Computes the arctangent of a number (in radians)." +layout: manual +--- + +Computes the arctangent of a number (in radians). + + + +``` +atan(num: number) -> number +``` + +### Examples + +```kcl +const myVar = atan(1.0) +``` + +### Arguments + +* `num`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/bezierCurve.md b/docs/kcl/bezierCurve.md new file mode 100644 index 0000000000..2631b207aa --- /dev/null +++ b/docs/kcl/bezierCurve.md @@ -0,0 +1,378 @@ +--- +title: "bezierCurve" +excerpt: "Draw a bezier curve." +layout: manual +--- + +Draw a bezier curve. + + + +``` +bezierCurve(data: BezierData, sketch_group: SketchGroup) -> SketchGroup +``` + +### Examples + +```kcl +startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> bezierCurve({ + to: [10, 10], + control1: [5, 0], + control2: [5, 10], + tag: "edge1" + }, %) + |> close(%) + |> extrude(10, %) +``` + +### Arguments + +* `data`: `BezierData` - Data to draw a bezier curve. (REQUIRED) +``` +{ + // The first control point. + control1: [number, number], + // The second control point. + control2: [number, number], + // The tag. + tag: string, + // The to point. + to: [number, number], +} +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/ceil.md b/docs/kcl/ceil.md new file mode 100644 index 0000000000..7d7132b452 --- /dev/null +++ b/docs/kcl/ceil.md @@ -0,0 +1,30 @@ +--- +title: "ceil" +excerpt: "Computes the smallest integer greater than or equal to a number." +layout: manual +--- + +Computes the smallest integer greater than or equal to a number. + + + +``` +ceil(num: number) -> number +``` + +### Examples + +```kcl +const myVar = ceil(4.5) +``` + +### Arguments + +* `num`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/circle.md b/docs/kcl/circle.md new file mode 100644 index 0000000000..d170d9098e --- /dev/null +++ b/docs/kcl/circle.md @@ -0,0 +1,250 @@ +--- +title: "circle" +excerpt: "Sketch a circle on the given plane" +layout: manual +--- + +Sketch a circle on the given plane + + + +``` +circle(center: [number, number], radius: number, surface: SketchSurface, tag?: String) -> SketchGroup +``` + +### Arguments + +* `center`: `[number, number]` (REQUIRED) +* `radius`: `number` (REQUIRED) +* `surface`: `SketchSurface` - A sketch group type. (REQUIRED) +``` +{ + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` +* `tag`: `String` (OPTIONAL) + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/close.md b/docs/kcl/close.md new file mode 100644 index 0000000000..b2d23afd68 --- /dev/null +++ b/docs/kcl/close.md @@ -0,0 +1,369 @@ +--- +title: "close" +excerpt: "Close the current sketch." +layout: manual +--- + +Close the current sketch. + + + +``` +close(sketch_group: SketchGroup, tag?: String) -> SketchGroup +``` + +### Examples + +```kcl +startSketchOn('XZ') + |> startProfileAt([0, 0], %) + |> line([10, 10], %) + |> line([10, 0], %) + |> close(%) +``` + +```kcl +startSketchOn('YZ') + |> startProfileAt([0, 0], %) + |> line([10, 10], %) + |> line([10, 0], %) + |> close(%, "edge1") +``` + +### Arguments + +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` +* `tag`: `String` (OPTIONAL) + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/cos.md b/docs/kcl/cos.md new file mode 100644 index 0000000000..1074f7e880 --- /dev/null +++ b/docs/kcl/cos.md @@ -0,0 +1,30 @@ +--- +title: "cos" +excerpt: "Computes the sine of a number (in radians)." +layout: manual +--- + +Computes the sine of a number (in radians). + + + +``` +cos(num: number) -> number +``` + +### Examples + +```kcl +const anotherVar = cos(2 * pi()) +``` + +### Arguments + +* `num`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/e.md b/docs/kcl/e.md new file mode 100644 index 0000000000..b1869d724d --- /dev/null +++ b/docs/kcl/e.md @@ -0,0 +1,29 @@ +--- +title: "e" +excerpt: "Return the value of Euler’s number `e`." +layout: manual +--- + +Return the value of Euler’s number `e`. + + + +``` +e() -> number +``` + +### Examples + +```kcl +const myVar = e() +``` + +### Arguments + + +### Returns + +`number` + + + diff --git a/docs/kcl/extrude.md b/docs/kcl/extrude.md new file mode 100644 index 0000000000..ac94ad8264 --- /dev/null +++ b/docs/kcl/extrude.md @@ -0,0 +1,330 @@ +--- +title: "extrude" +excerpt: "Extrudes by a given amount." +layout: manual +--- + +Extrudes by a given amount. + + + +``` +extrude(length: number, sketch_group: SketchGroup) -> ExtrudeGroup +``` + +### Examples + +```kcl +startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> line([0, 10], %) + |> line([10, 0], %) + |> line([0, -10], %) + |> close(%) + |> extrude(5, %) +``` + +### Arguments + +* `length`: `number` (REQUIRED) +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`ExtrudeGroup` - An extrude group is a collection of extrude surfaces. +``` +{ + // The id of the extrusion end cap + endCapId: uuid, + // The height of the extrude group. + height: number, + // The id of the extrude group. + id: uuid, + // The position of the extrude group. + position: [number, number, number], + // The rotation of the extrude group. + rotation: [number, number, number, number], + // The sketch group paths. + sketchGroupValues: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The id of the extrusion start cap + startCapId: uuid, + // The extrude surfaces. + value: [{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudePlane", +} | +{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudeArc", +}], + // The x-axis of the extrude group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the extrude group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the extrude group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/fillet.md b/docs/kcl/fillet.md new file mode 100644 index 0000000000..5d6646e41b --- /dev/null +++ b/docs/kcl/fillet.md @@ -0,0 +1,307 @@ +--- +title: "fillet" +excerpt: "Create fillets on tagged paths." +layout: manual +--- + +Create fillets on tagged paths. + + + +``` +fillet(data: FilletData, extrude_group: ExtrudeGroup) -> ExtrudeGroup +``` + +### Examples + +```kcl +const part001 = startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> line({ to: [0, 10], tag: "thing" }, %) + |> line([10, 0], %) + |> line({ to: [0, -10], tag: "thing2" }, %) + |> close(%) + |> extrude(10, %) + |> fillet({ radius: 2, tags: ["thing", "thing2"] }, %) +``` + +### Arguments + +* `data`: `FilletData` - Data for fillets. (REQUIRED) +``` +{ + // The radius of the fillet. + radius: number, + // The tags of the paths you want to fillet. + tags: [uuid | +string], +} +``` +* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) +``` +{ + // The id of the extrusion end cap + endCapId: uuid, + // The height of the extrude group. + height: number, + // The id of the extrude group. + id: uuid, + // The position of the extrude group. + position: [number, number, number], + // The rotation of the extrude group. + rotation: [number, number, number, number], + // The sketch group paths. + sketchGroupValues: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The id of the extrusion start cap + startCapId: uuid, + // The extrude surfaces. + value: [{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudePlane", +} | +{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudeArc", +}], + // The x-axis of the extrude group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the extrude group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the extrude group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`ExtrudeGroup` - An extrude group is a collection of extrude surfaces. +``` +{ + // The id of the extrusion end cap + endCapId: uuid, + // The height of the extrude group. + height: number, + // The id of the extrude group. + id: uuid, + // The position of the extrude group. + position: [number, number, number], + // The rotation of the extrude group. + rotation: [number, number, number, number], + // The sketch group paths. + sketchGroupValues: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The id of the extrusion start cap + startCapId: uuid, + // The extrude surfaces. + value: [{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudePlane", +} | +{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudeArc", +}], + // The x-axis of the extrude group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the extrude group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the extrude group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/floor.md b/docs/kcl/floor.md new file mode 100644 index 0000000000..a61ebc6c2b --- /dev/null +++ b/docs/kcl/floor.md @@ -0,0 +1,30 @@ +--- +title: "floor" +excerpt: "Computes the largest integer less than or equal to a number." +layout: manual +--- + +Computes the largest integer less than or equal to a number. + + + +``` +floor(num: number) -> number +``` + +### Examples + +```kcl +const myVar = floor(4.5) +``` + +### Arguments + +* `num`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/getExtrudeWallTransform.md b/docs/kcl/getExtrudeWallTransform.md new file mode 100644 index 0000000000..2934da0254 --- /dev/null +++ b/docs/kcl/getExtrudeWallTransform.md @@ -0,0 +1,175 @@ +--- +title: "getExtrudeWallTransform" +excerpt: "Returns the extrude wall transform." +layout: manual +--- + +Returns the extrude wall transform. + + + +``` +getExtrudeWallTransform(surface_name: string, extrude_group: ExtrudeGroup) -> ExtrudeTransform +``` + +### Examples + +```kcl +const box = startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> line([0, 10], %) + |> line([10, 0], %) + |> line({ to: [0, -10], tag: "surface" }, %) + |> close(%) + |> extrude(5, %) + +const transform = getExtrudeWallTransform('surface', box) +``` + +### Arguments + +* `surface_name`: `string` (REQUIRED) +* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) +``` +{ + // The id of the extrusion end cap + endCapId: uuid, + // The height of the extrude group. + height: number, + // The id of the extrude group. + id: uuid, + // The position of the extrude group. + position: [number, number, number], + // The rotation of the extrude group. + rotation: [number, number, number, number], + // The sketch group paths. + sketchGroupValues: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The id of the extrusion start cap + startCapId: uuid, + // The extrude surfaces. + value: [{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudePlane", +} | +{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudeArc", +}], + // The x-axis of the extrude group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the extrude group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the extrude group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`ExtrudeTransform` +``` +{ + position: [number, number, number], + rotation: [number, number, number, number], +} +``` + + + diff --git a/docs/kcl/getNextAdjacentEdge.md b/docs/kcl/getNextAdjacentEdge.md new file mode 100644 index 0000000000..5fa8371067 --- /dev/null +++ b/docs/kcl/getNextAdjacentEdge.md @@ -0,0 +1,171 @@ +--- +title: "getNextAdjacentEdge" +excerpt: "Get the next adjacent edge to the edge given." +layout: manual +--- + +Get the next adjacent edge to the edge given. + + + +``` +getNextAdjacentEdge(tag: String, extrude_group: ExtrudeGroup) -> Uuid +``` + +### Examples + +```kcl +const part001 = startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> line({ to: [0, 10], tag: "thing" }, %) + |> line({ to: [10, 0], tag: "thing1" }, %) + |> line({ to: [0, -10], tag: "thing2" }, %) + |> close(%) + |> extrude(10, %) + |> fillet({ + radius: 2, + tags: [getNextAdjacentEdge("thing", %)] + }, %) +``` + +### Arguments + +* `tag`: `String` (REQUIRED) +* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) +``` +{ + // The id of the extrusion end cap + endCapId: uuid, + // The height of the extrude group. + height: number, + // The id of the extrude group. + id: uuid, + // The position of the extrude group. + position: [number, number, number], + // The rotation of the extrude group. + rotation: [number, number, number, number], + // The sketch group paths. + sketchGroupValues: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The id of the extrusion start cap + startCapId: uuid, + // The extrude surfaces. + value: [{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudePlane", +} | +{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudeArc", +}], + // The x-axis of the extrude group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the extrude group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the extrude group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`Uuid` + + + diff --git a/docs/kcl/getOppositeEdge.md b/docs/kcl/getOppositeEdge.md new file mode 100644 index 0000000000..c82616cb97 --- /dev/null +++ b/docs/kcl/getOppositeEdge.md @@ -0,0 +1,171 @@ +--- +title: "getOppositeEdge" +excerpt: "Get the opposite edge to the edge given." +layout: manual +--- + +Get the opposite edge to the edge given. + + + +``` +getOppositeEdge(tag: String, extrude_group: ExtrudeGroup) -> Uuid +``` + +### Examples + +```kcl +const part001 = startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> line({ to: [0, 10], tag: "thing" }, %) + |> line([10, 0], %) + |> line({ to: [0, -10], tag: "thing2" }, %) + |> close(%) + |> extrude(10, %) + |> fillet({ + radius: 2, + tags: ["thing", getOppositeEdge("thing", %)] + }, %) +``` + +### Arguments + +* `tag`: `String` (REQUIRED) +* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) +``` +{ + // The id of the extrusion end cap + endCapId: uuid, + // The height of the extrude group. + height: number, + // The id of the extrude group. + id: uuid, + // The position of the extrude group. + position: [number, number, number], + // The rotation of the extrude group. + rotation: [number, number, number, number], + // The sketch group paths. + sketchGroupValues: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The id of the extrusion start cap + startCapId: uuid, + // The extrude surfaces. + value: [{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudePlane", +} | +{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudeArc", +}], + // The x-axis of the extrude group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the extrude group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the extrude group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`Uuid` + + + diff --git a/docs/kcl/getPreviousAdjacentEdge.md b/docs/kcl/getPreviousAdjacentEdge.md new file mode 100644 index 0000000000..1ef244f047 --- /dev/null +++ b/docs/kcl/getPreviousAdjacentEdge.md @@ -0,0 +1,171 @@ +--- +title: "getPreviousAdjacentEdge" +excerpt: "Get the previous adjacent edge to the edge given." +layout: manual +--- + +Get the previous adjacent edge to the edge given. + + + +``` +getPreviousAdjacentEdge(tag: String, extrude_group: ExtrudeGroup) -> Uuid +``` + +### Examples + +```kcl +const part001 = startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> line({ to: [0, 10], tag: "thing" }, %) + |> line({ to: [10, 0], tag: "thing1" }, %) + |> line({ to: [0, -10], tag: "thing2" }, %) + |> close(%) + |> extrude(10, %) + |> fillet({ + radius: 2, + tags: [getPreviousAdjacentEdge("thing2", %)] + }, %) +``` + +### Arguments + +* `tag`: `String` (REQUIRED) +* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) +``` +{ + // The id of the extrusion end cap + endCapId: uuid, + // The height of the extrude group. + height: number, + // The id of the extrude group. + id: uuid, + // The position of the extrude group. + position: [number, number, number], + // The rotation of the extrude group. + rotation: [number, number, number, number], + // The sketch group paths. + sketchGroupValues: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The id of the extrusion start cap + startCapId: uuid, + // The extrude surfaces. + value: [{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudePlane", +} | +{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudeArc", +}], + // The x-axis of the extrude group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the extrude group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the extrude group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`Uuid` + + + diff --git a/docs/kcl/hole.md b/docs/kcl/hole.md new file mode 100644 index 0000000000..4d03f85880 --- /dev/null +++ b/docs/kcl/hole.md @@ -0,0 +1,532 @@ +--- +title: "hole" +excerpt: "Use a sketch to cut a hole in another sketch." +layout: manual +--- + +Use a sketch to cut a hole in another sketch. + + + +``` +hole(hole_sketch_group: SketchGroupSet, sketch_group: SketchGroup) -> SketchGroup +``` + +### Examples + +```kcl +const square = startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> line([0, 10], %) + |> line([10, 0], %) + |> line([0, -10], %) + |> close(%) + |> hole(circle([2, 2], .5, startSketchOn('XY')), %) + |> hole(circle([2, 8], .5, startSketchOn('XY')), %) + |> extrude(2, %) +``` + +### Arguments + +* `hole_sketch_group`: `SketchGroupSet` - A sketch group or a group of sketch groups. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + type: "sketchGroup", + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + type: "sketchGroups", +} +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/import.md b/docs/kcl/import.md new file mode 100644 index 0000000000..bb3caac94e --- /dev/null +++ b/docs/kcl/import.md @@ -0,0 +1,136 @@ +--- +title: "import" +excerpt: "Import a CAD file." +layout: manual +--- + +Import a CAD file. + +For formats lacking unit data (STL, OBJ, PLY), the default import unit is millimeters. Otherwise you can specify the unit by passing in the options parameter. If you import a gltf file, we will try to find the bin file and import it as well. +Import paths are relative to the current project directory. This only works in the desktop app not in browser. + +``` +import(file_path: String, options?: ImportFormat) -> ImportedGeometry +``` + +### Examples + +```kcl +const model = import("thing.obj") +``` + +```kcl +const model = import("cube.obj", { type: "obj", units: "m" }) +``` + +```kcl +const model = import("my_model.gltf") +``` + +```kcl +const model = import("my_model.sldprt") +``` + +```kcl +const model = import("my_model.step") +``` + +### Arguments + +* `file_path`: `String` (REQUIRED) +* `options`: `ImportFormat` - Import format specifier (OPTIONAL) +``` +{ + type: "fbx", +} | +{ + type: "gltf", +} | +{ + // Co-ordinate system of input data. Defaults to the [KittyCAD co-ordinate system. + coords: { + // Axis the front face of a model looks along. + forward: { + // Axis specifier. + axis: "y" | "z", + // Specifies which direction the axis is pointing. + direction: "positive" | "negative", +}, + // Axis pointing up and away from a model. + up: { + // Axis specifier. + axis: "y" | "z", + // Specifies which direction the axis is pointing. + direction: "positive" | "negative", +}, +}, + type: "obj", + // The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. Defaults to millimeters. + units: "cm" | "ft" | "in" | "m" | "mm" | "yd", +} | +{ + // Co-ordinate system of input data. Defaults to the [KittyCAD co-ordinate system. + coords: { + // Axis the front face of a model looks along. + forward: { + // Axis specifier. + axis: "y" | "z", + // Specifies which direction the axis is pointing. + direction: "positive" | "negative", +}, + // Axis pointing up and away from a model. + up: { + // Axis specifier. + axis: "y" | "z", + // Specifies which direction the axis is pointing. + direction: "positive" | "negative", +}, +}, + type: "ply", + // The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. Defaults to millimeters. + units: "cm" | "ft" | "in" | "m" | "mm" | "yd", +} | +{ + type: "sldprt", +} | +{ + type: "step", +} | +{ + // Co-ordinate system of input data. Defaults to the [KittyCAD co-ordinate system. + coords: { + // Axis the front face of a model looks along. + forward: { + // Axis specifier. + axis: "y" | "z", + // Specifies which direction the axis is pointing. + direction: "positive" | "negative", +}, + // Axis pointing up and away from a model. + up: { + // Axis specifier. + axis: "y" | "z", + // Specifies which direction the axis is pointing. + direction: "positive" | "negative", +}, +}, + type: "stl", + // The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. Defaults to millimeters. + units: "cm" | "ft" | "in" | "m" | "mm" | "yd", +} +``` + +### Returns + +`ImportedGeometry` - Data for an imported geometry. +``` +{ + // The ID of the imported geometry. + id: uuid, + // The original file paths. + value: [string], +} +``` + + + diff --git a/docs/kcl/index.md b/docs/kcl/index.md new file mode 100644 index 0000000000..ae8f21706d --- /dev/null +++ b/docs/kcl/index.md @@ -0,0 +1,80 @@ +--- +title: "KCL Standard Library" +excerpt: "Documentation for the KCL standard library for the Zoo Modeling App." +layout: manual +--- + +# KCL Standard Library + +## Types + +## Table of Contents + +* [Types](types.md) +* [Known Issues](KNOWN-ISSUES.md) +* [`abs`](abs.md) +* [`acos`](acos.md) +* [`angleToMatchLengthX`](angleToMatchLengthX.md) +* [`angleToMatchLengthY`](angleToMatchLengthY.md) +* [`angledLine`](angledLine.md) +* [`angledLineOfXLength`](angledLineOfXLength.md) +* [`angledLineOfYLength`](angledLineOfYLength.md) +* [`angledLineThatIntersects`](angledLineThatIntersects.md) +* [`angledLineToX`](angledLineToX.md) +* [`angledLineToY`](angledLineToY.md) +* [`arc`](arc.md) +* [`asin`](asin.md) +* [`atan`](atan.md) +* [`bezierCurve`](bezierCurve.md) +* [`ceil`](ceil.md) +* [`circle`](circle.md) +* [`close`](close.md) +* [`cos`](cos.md) +* [`e`](e.md) +* [`extrude`](extrude.md) +* [`fillet`](fillet.md) +* [`floor`](floor.md) +* [`getExtrudeWallTransform`](getExtrudeWallTransform.md) +* [`getNextAdjacentEdge`](getNextAdjacentEdge.md) +* [`getOppositeEdge`](getOppositeEdge.md) +* [`getPreviousAdjacentEdge`](getPreviousAdjacentEdge.md) +* [`hole`](hole.md) +* [`import`](import.md) +* [`lastSegX`](lastSegX.md) +* [`lastSegY`](lastSegY.md) +* [`legAngX`](legAngX.md) +* [`legAngY`](legAngY.md) +* [`legLen`](legLen.md) +* [`line`](line.md) +* [`lineTo`](lineTo.md) +* [`ln`](ln.md) +* [`log`](log.md) +* [`log10`](log10.md) +* [`log2`](log2.md) +* [`max`](max.md) +* [`min`](min.md) +* [`patternCircular2d`](patternCircular2d.md) +* [`patternCircular3d`](patternCircular3d.md) +* [`patternLinear2d`](patternLinear2d.md) +* [`patternLinear3d`](patternLinear3d.md) +* [`pi`](pi.md) +* [`pow`](pow.md) +* [`segAng`](segAng.md) +* [`segEndX`](segEndX.md) +* [`segEndY`](segEndY.md) +* [`segLen`](segLen.md) +* [`sin`](sin.md) +* [`sqrt`](sqrt.md) +* [`startProfileAt`](startProfileAt.md) +* [`startSketchAt`](startSketchAt.md) +* [`startSketchOn`](startSketchOn.md) +* [`tan`](tan.md) +* [`tangentialArc`](tangentialArc.md) +* [`tangentialArcTo`](tangentialArcTo.md) +* [`tau`](tau.md) +* [`toDegrees`](toDegrees.md) +* [`toRadians`](toRadians.md) +* [`xLine`](xLine.md) +* [`xLineTo`](xLineTo.md) +* [`yLine`](yLine.md) +* [`yLineTo`](yLineTo.md) diff --git a/docs/kcl/lastSegX.md b/docs/kcl/lastSegX.md new file mode 100644 index 0000000000..e41153ef5b --- /dev/null +++ b/docs/kcl/lastSegX.md @@ -0,0 +1,199 @@ +--- +title: "lastSegX" +excerpt: "Returns the last segment of x." +layout: manual +--- + +Returns the last segment of x. + + + +``` +lastSegX(sketch_group: SketchGroup) -> number +``` + +### Examples + +```kcl +startSketchOn("YZ") + |> startProfileAt([0, 0], %) + |> line({ to: [5, 0], tag: "thing" }, %) + |> line([5, 5], %) + |> line([0, lastSegX(%)], %) + |> close(%) + |> extrude(5, %) +``` + +### Arguments + +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`number` + + + diff --git a/docs/kcl/lastSegY.md b/docs/kcl/lastSegY.md new file mode 100644 index 0000000000..c6bbe46bd0 --- /dev/null +++ b/docs/kcl/lastSegY.md @@ -0,0 +1,199 @@ +--- +title: "lastSegY" +excerpt: "Returns the last segment of y." +layout: manual +--- + +Returns the last segment of y. + + + +``` +lastSegY(sketch_group: SketchGroup) -> number +``` + +### Examples + +```kcl +startSketchOn("YZ") + |> startProfileAt([0, 0], %) + |> line({ to: [5, 0], tag: "thing" }, %) + |> line([5, 5], %) + |> line([0, lastSegY(%)], %) + |> close(%) + |> extrude(5, %) +``` + +### Arguments + +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`number` + + + diff --git a/docs/kcl/legAngX.md b/docs/kcl/legAngX.md new file mode 100644 index 0000000000..b8a9af05a0 --- /dev/null +++ b/docs/kcl/legAngX.md @@ -0,0 +1,31 @@ +--- +title: "legAngX" +excerpt: "Returns the angle of the given leg for x." +layout: manual +--- + +Returns the angle of the given leg for x. + + + +``` +legAngX(hypotenuse: number, leg: number) -> number +``` + +### Examples + +```kcl +legAngX(5, 3) +``` + +### Arguments + +* `hypotenuse`: `number` (REQUIRED) +* `leg`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/legAngY.md b/docs/kcl/legAngY.md new file mode 100644 index 0000000000..34914e1173 --- /dev/null +++ b/docs/kcl/legAngY.md @@ -0,0 +1,31 @@ +--- +title: "legAngY" +excerpt: "Returns the angle of the given leg for y." +layout: manual +--- + +Returns the angle of the given leg for y. + + + +``` +legAngY(hypotenuse: number, leg: number) -> number +``` + +### Examples + +```kcl +legAngY(5, 3) +``` + +### Arguments + +* `hypotenuse`: `number` (REQUIRED) +* `leg`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/legLen.md b/docs/kcl/legLen.md new file mode 100644 index 0000000000..7c05647032 --- /dev/null +++ b/docs/kcl/legLen.md @@ -0,0 +1,31 @@ +--- +title: "legLen" +excerpt: "Returns the length of the given leg." +layout: manual +--- + +Returns the length of the given leg. + + + +``` +legLen(hypotenuse: number, leg: number) -> number +``` + +### Examples + +```kcl +legLen(5, 3) +``` + +### Arguments + +* `hypotenuse`: `number` (REQUIRED) +* `leg`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/line.md b/docs/kcl/line.md new file mode 100644 index 0000000000..a8e59de438 --- /dev/null +++ b/docs/kcl/line.md @@ -0,0 +1,371 @@ +--- +title: "line" +excerpt: "Draw a line." +layout: manual +--- + +Draw a line. + + + +``` +line(data: LineData, sketch_group: SketchGroup) -> SketchGroup +``` + +### Examples + +```kcl +startSketchOn('-XY') + |> startProfileAt([0, 0], %) + |> line([10, 10], %) + |> line({ to: [20, 10], tag: "edge1" }, %) + |> close(%, "edge2") + |> extrude(10, %) +``` + +### Arguments + +* `data`: `LineData` - Data to draw a line. (REQUIRED) +``` +{ + // The tag. + tag: string, + // The to point. + to: [number, number], +} | +[number, number] +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/lineTo.md b/docs/kcl/lineTo.md new file mode 100644 index 0000000000..3ff41a5055 --- /dev/null +++ b/docs/kcl/lineTo.md @@ -0,0 +1,386 @@ +--- +title: "lineTo" +excerpt: "Draw a line to a point." +layout: manual +--- + +Draw a line to a point. + + + +``` +lineTo(data: LineToData, sketch_group: SketchGroup) -> SketchGroup +``` + +### Examples + +```kcl +fn rectShape = (pos, w, l) => { + const rr = startSketchOn('YZ') + |> startProfileAt([pos[0] - (w / 2), pos[1] - (l / 2)], %) + |> lineTo({ + to: [pos[0] + w / 2, pos[1] - (l / 2)], + tag: "edge1" + }, %) + |> lineTo({ + to: [pos[0] + w / 2, pos[1] + l / 2], + tag: "edge2" + }, %) + |> lineTo({ + to: [pos[0] - (w / 2), pos[1] + l / 2], + tag: "edge3" + }, %) + |> close(%, "edge4") + return rr +} + +// Create the mounting plate extrusion, holes, and fillets +const part = rectShape([0, 0], 20, 20) +``` + +### Arguments + +* `data`: `LineToData` - Data to draw a line to a point. (REQUIRED) +``` +{ + // The tag. + tag: string, + // The to point. + to: [number, number], +} | +[number, number] +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/ln.md b/docs/kcl/ln.md new file mode 100644 index 0000000000..e6ae94f8bb --- /dev/null +++ b/docs/kcl/ln.md @@ -0,0 +1,30 @@ +--- +title: "ln" +excerpt: "Computes the natural logarithm of the number." +layout: manual +--- + +Computes the natural logarithm of the number. + + + +``` +ln(num: number) -> number +``` + +### Examples + +```kcl +const myVar = ln(4) +``` + +### Arguments + +* `num`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/log.md b/docs/kcl/log.md new file mode 100644 index 0000000000..444d8dc885 --- /dev/null +++ b/docs/kcl/log.md @@ -0,0 +1,31 @@ +--- +title: "log" +excerpt: "Computes the logarithm of the number with respect to an arbitrary base." +layout: manual +--- + +Computes the logarithm of the number with respect to an arbitrary base. + +The result might not be correctly rounded owing to implementation details; `log2()` can produce more accurate results for base 2, and `log10()` can produce more accurate results for base 10. + +``` +log(num: number, base: number) -> number +``` + +### Examples + +```kcl +const myVar = log(4, 2) +``` + +### Arguments + +* `num`: `number` (REQUIRED) +* `base`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/log10.md b/docs/kcl/log10.md new file mode 100644 index 0000000000..40d2aa8fd0 --- /dev/null +++ b/docs/kcl/log10.md @@ -0,0 +1,30 @@ +--- +title: "log10" +excerpt: "Computes the base 10 logarithm of the number." +layout: manual +--- + +Computes the base 10 logarithm of the number. + + + +``` +log10(num: number) -> number +``` + +### Examples + +```kcl +const myVar = log10(4) +``` + +### Arguments + +* `num`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/log2.md b/docs/kcl/log2.md new file mode 100644 index 0000000000..72dec3aa50 --- /dev/null +++ b/docs/kcl/log2.md @@ -0,0 +1,30 @@ +--- +title: "log2" +excerpt: "Computes the base 2 logarithm of the number." +layout: manual +--- + +Computes the base 2 logarithm of the number. + + + +``` +log2(num: number) -> number +``` + +### Examples + +```kcl +const myVar = log2(4) +``` + +### Arguments + +* `num`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/max.md b/docs/kcl/max.md new file mode 100644 index 0000000000..895d7007db --- /dev/null +++ b/docs/kcl/max.md @@ -0,0 +1,30 @@ +--- +title: "max" +excerpt: "Computes the maximum of the given arguments." +layout: manual +--- + +Computes the maximum of the given arguments. + + + +``` +max(args: [number]) -> number +``` + +### Examples + +```kcl +const myVar = max(4, 5, 6) +``` + +### Arguments + +* `args`: `[number]` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/min.md b/docs/kcl/min.md new file mode 100644 index 0000000000..3b1b13bed8 --- /dev/null +++ b/docs/kcl/min.md @@ -0,0 +1,30 @@ +--- +title: "min" +excerpt: "Computes the minimum of the given arguments." +layout: manual +--- + +Computes the minimum of the given arguments. + + + +``` +min(args: [number]) -> number +``` + +### Examples + +```kcl +const myVar = min(4, 5, 6) +``` + +### Arguments + +* `args`: `[number]` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/patternCircular2d.md b/docs/kcl/patternCircular2d.md new file mode 100644 index 0000000000..ae2a321ba1 --- /dev/null +++ b/docs/kcl/patternCircular2d.md @@ -0,0 +1,213 @@ +--- +title: "patternCircular2d" +excerpt: "A circular pattern on a 2D sketch." +layout: manual +--- + +A circular pattern on a 2D sketch. + + + +``` +patternCircular2d(data: CircularPattern2dData, sketch_group: SketchGroup) -> [SketchGroup] +``` + +### Examples + +```kcl +const part = startSketchOn('XY') + |> circle([0, 0], 2, %) + |> patternCircular2d({ + center: [20, 20], + repetitions: 12, + arcDegrees: 210, + rotateDuplicates: true + }, %) +``` + +### Arguments + +* `data`: `CircularPattern2dData` - Data for a circular pattern on a 2D sketch. (REQUIRED) +``` +{ + // The arc angle (in degrees) to place the repetitions. Must be greater than 0. + arcDegrees: number, + // The center about which to make th pattern. This is a 2D vector. + center: [number, number], + // The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once. + repetitions: number, + // Whether or not to rotate the duplicates as they are copied. + rotateDuplicates: string, +} +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`[SketchGroup]` + + + diff --git a/docs/kcl/patternCircular3d.md b/docs/kcl/patternCircular3d.md new file mode 100644 index 0000000000..2d43961093 --- /dev/null +++ b/docs/kcl/patternCircular3d.md @@ -0,0 +1,188 @@ +--- +title: "patternCircular3d" +excerpt: "A circular pattern on a 3D model." +layout: manual +--- + +A circular pattern on a 3D model. + + + +``` +patternCircular3d(data: CircularPattern3dData, extrude_group: ExtrudeGroup) -> [ExtrudeGroup] +``` + +### Examples + +```kcl +const part = startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> line([0, 1], %) + |> line([1, 0], %) + |> line([0, -1], %) + |> close(%) + |> extrude(1, %) + |> patternCircular3d({ + axis: [1, 1, 0], + center: [10, 0, 10], + repetitions: 10, + arcDegrees: 360, + rotateDuplicates: true + }, %) +``` + +### Arguments + +* `data`: `CircularPattern3dData` - Data for a circular pattern on a 3D model. (REQUIRED) +``` +{ + // The arc angle (in degrees) to place the repetitions. Must be greater than 0. + arcDegrees: number, + // The axis around which to make the pattern. This is a 3D vector. + axis: [number, number, number], + // The center about which to make th pattern. This is a 3D vector. + center: [number, number, number], + // The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once. + repetitions: number, + // Whether or not to rotate the duplicates as they are copied. + rotateDuplicates: string, +} +``` +* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) +``` +{ + // The id of the extrusion end cap + endCapId: uuid, + // The height of the extrude group. + height: number, + // The id of the extrude group. + id: uuid, + // The position of the extrude group. + position: [number, number, number], + // The rotation of the extrude group. + rotation: [number, number, number, number], + // The sketch group paths. + sketchGroupValues: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The id of the extrusion start cap + startCapId: uuid, + // The extrude surfaces. + value: [{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudePlane", +} | +{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudeArc", +}], + // The x-axis of the extrude group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the extrude group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the extrude group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`[ExtrudeGroup]` + + + diff --git a/docs/kcl/patternLinear2d.md b/docs/kcl/patternLinear2d.md new file mode 100644 index 0000000000..deb18decbb --- /dev/null +++ b/docs/kcl/patternLinear2d.md @@ -0,0 +1,210 @@ +--- +title: "patternLinear2d" +excerpt: "A linear pattern on a 2D sketch." +layout: manual +--- + +A linear pattern on a 2D sketch. + + + +``` +patternLinear2d(data: LinearPattern2dData, sketch_group: SketchGroup) -> [SketchGroup] +``` + +### Examples + +```kcl +const part = startSketchOn('XY') + |> circle([0, 0], 2, %) + |> patternLinear2d({ + axis: [0, 1], + repetitions: 12, + distance: 2 + }, %) +``` + +### Arguments + +* `data`: `LinearPattern2dData` - Data for a linear pattern on a 2D sketch. (REQUIRED) +``` +{ + // The axis of the pattern. This is a 2D vector. + axis: [number, number], + // The distance between each repetition. This can also be referred to as spacing. + distance: number, + // The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once. + repetitions: number, +} +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`[SketchGroup]` + + + diff --git a/docs/kcl/patternLinear3d.md b/docs/kcl/patternLinear3d.md new file mode 100644 index 0000000000..43978cb703 --- /dev/null +++ b/docs/kcl/patternLinear3d.md @@ -0,0 +1,182 @@ +--- +title: "patternLinear3d" +excerpt: "A linear pattern on a 3D model." +layout: manual +--- + +A linear pattern on a 3D model. + + + +``` +patternLinear3d(data: LinearPattern3dData, extrude_group: ExtrudeGroup) -> [ExtrudeGroup] +``` + +### Examples + +```kcl +const part = startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> line([0, 1], %) + |> line([1, 0], %) + |> line([0, -1], %) + |> close(%) + |> extrude(1, %) + |> patternLinear3d({ + axis: [1, 0, 1], + repetitions: 3, + distance: 6 + }, %) +``` + +### Arguments + +* `data`: `LinearPattern3dData` - Data for a linear pattern on a 3D model. (REQUIRED) +``` +{ + // The axis of the pattern. + axis: [number, number, number], + // The distance between each repetition. This can also be referred to as spacing. + distance: number, + // The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once. + repetitions: number, +} +``` +* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) +``` +{ + // The id of the extrusion end cap + endCapId: uuid, + // The height of the extrude group. + height: number, + // The id of the extrude group. + id: uuid, + // The position of the extrude group. + position: [number, number, number], + // The rotation of the extrude group. + rotation: [number, number, number, number], + // The sketch group paths. + sketchGroupValues: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The id of the extrusion start cap + startCapId: uuid, + // The extrude surfaces. + value: [{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudePlane", +} | +{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudeArc", +}], + // The x-axis of the extrude group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the extrude group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the extrude group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`[ExtrudeGroup]` + + + diff --git a/docs/kcl/pi.md b/docs/kcl/pi.md new file mode 100644 index 0000000000..fe86078180 --- /dev/null +++ b/docs/kcl/pi.md @@ -0,0 +1,29 @@ +--- +title: "pi" +excerpt: "Return the value of `pi`. Archimedes’ constant (π)." +layout: manual +--- + +Return the value of `pi`. Archimedes’ constant (π). + + + +``` +pi() -> number +``` + +### Examples + +```kcl +const myVar = pi() * 3.0 +``` + +### Arguments + + +### Returns + +`number` + + + diff --git a/docs/kcl/pow.md b/docs/kcl/pow.md new file mode 100644 index 0000000000..1288868343 --- /dev/null +++ b/docs/kcl/pow.md @@ -0,0 +1,31 @@ +--- +title: "pow" +excerpt: "Computes the number to a power." +layout: manual +--- + +Computes the number to a power. + + + +``` +pow(num: number, pow: number) -> number +``` + +### Examples + +```kcl +const myVar = pow(4, 2) +``` + +### Arguments + +* `num`: `number` (REQUIRED) +* `pow`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/segAng.md b/docs/kcl/segAng.md new file mode 100644 index 0000000000..61d6ca786d --- /dev/null +++ b/docs/kcl/segAng.md @@ -0,0 +1,202 @@ +--- +title: "segAng" +excerpt: "Returns the angle of the segment." +layout: manual +--- + +Returns the angle of the segment. + + + +``` +segAng(segment_name: string, sketch_group: SketchGroup) -> number +``` + +### Examples + +```kcl +const part001 = startSketchOn('XY') + |> startProfileAt([4.83, 12.56], %) + |> line([15.1, 2.48], %) + |> line({ to: [3.15, -9.85], tag: 'seg01' }, %) + |> line([-15.17, -4.1], %) + |> angledLine([segAng('seg01', %), 12.35], %) + |> line([-13.02, 10.03], %) + |> close(%) + |> extrude(4, %) +``` + +### Arguments + +* `segment_name`: `string` (REQUIRED) +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`number` + + + diff --git a/docs/kcl/segEndX.md b/docs/kcl/segEndX.md new file mode 100644 index 0000000000..b149dc5179 --- /dev/null +++ b/docs/kcl/segEndX.md @@ -0,0 +1,200 @@ +--- +title: "segEndX" +excerpt: "Returns the segment end of x." +layout: manual +--- + +Returns the segment end of x. + + + +``` +segEndX(segment_name: string, sketch_group: SketchGroup) -> number +``` + +### Examples + +```kcl +startSketchOn("YZ") + |> startProfileAt([0, 0], %) + |> line({ to: [5, 0], tag: "thing" }, %) + |> line([5, 5], %) + |> line([segEndX("thing", %), 5], %) + |> close(%) + |> extrude(5, %) +``` + +### Arguments + +* `segment_name`: `string` (REQUIRED) +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`number` + + + diff --git a/docs/kcl/segEndY.md b/docs/kcl/segEndY.md new file mode 100644 index 0000000000..e28024200a --- /dev/null +++ b/docs/kcl/segEndY.md @@ -0,0 +1,200 @@ +--- +title: "segEndY" +excerpt: "Returns the segment end of y." +layout: manual +--- + +Returns the segment end of y. + + + +``` +segEndY(segment_name: string, sketch_group: SketchGroup) -> number +``` + +### Examples + +```kcl +startSketchOn("YZ") + |> startProfileAt([0, 0], %) + |> line({ to: [5, 0], tag: "thing" }, %) + |> line([5, 5], %) + |> line([segEndY("thing", %), 5], %) + |> close(%) + |> extrude(5, %) +``` + +### Arguments + +* `segment_name`: `string` (REQUIRED) +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`number` + + + diff --git a/docs/kcl/segLen.md b/docs/kcl/segLen.md new file mode 100644 index 0000000000..d9f4c7366d --- /dev/null +++ b/docs/kcl/segLen.md @@ -0,0 +1,200 @@ +--- +title: "segLen" +excerpt: "Returns the length of the segment." +layout: manual +--- + +Returns the length of the segment. + + + +``` +segLen(segment_name: string, sketch_group: SketchGroup) -> number +``` + +### Examples + +```kcl +startSketchOn("YZ") + |> startProfileAt([0, 0], %) + |> line({ to: [5, 0], tag: "thing" }, %) + |> line([5, 5], %) + |> line([0, segLen("thing", %)], %) + |> close(%) + |> extrude(5, %) +``` + +### Arguments + +* `segment_name`: `string` (REQUIRED) +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`number` + + + diff --git a/docs/kcl/sin.md b/docs/kcl/sin.md new file mode 100644 index 0000000000..74ad10e81b --- /dev/null +++ b/docs/kcl/sin.md @@ -0,0 +1,30 @@ +--- +title: "sin" +excerpt: "Computes the sine of a number (in radians)." +layout: manual +--- + +Computes the sine of a number (in radians). + + + +``` +sin(num: number) -> number +``` + +### Examples + +```kcl +const myVar = sin(2 * pi()) +``` + +### Arguments + +* `num`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/sqrt.md b/docs/kcl/sqrt.md new file mode 100644 index 0000000000..2752d0cb0a --- /dev/null +++ b/docs/kcl/sqrt.md @@ -0,0 +1,30 @@ +--- +title: "sqrt" +excerpt: "Computes the square root of a number." +layout: manual +--- + +Computes the square root of a number. + + + +``` +sqrt(num: number) -> number +``` + +### Examples + +```kcl +const myVar = sqrt(4) +``` + +### Arguments + +* `num`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/startProfileAt.md b/docs/kcl/startProfileAt.md new file mode 100644 index 0000000000..c6e07a1fcd --- /dev/null +++ b/docs/kcl/startProfileAt.md @@ -0,0 +1,265 @@ +--- +title: "startProfileAt" +excerpt: "Start a profile at a given point." +layout: manual +--- + +Start a profile at a given point. + + + +``` +startProfileAt(data: LineData, sketch_surface: SketchSurface) -> SketchGroup +``` + +### Examples + +```kcl +startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> line([10, 10], %) +``` + +### Arguments + +* `data`: `LineData` - Data to draw a line. (REQUIRED) +``` +{ + // The tag. + tag: string, + // The to point. + to: [number, number], +} | +[number, number] +``` +* `sketch_surface`: `SketchSurface` - A sketch group type. (REQUIRED) +``` +{ + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/startSketchAt.md b/docs/kcl/startSketchAt.md new file mode 100644 index 0000000000..6847fa5eef --- /dev/null +++ b/docs/kcl/startSketchAt.md @@ -0,0 +1,203 @@ +--- +title: "startSketchAt" +excerpt: "Start a sketch at a given point on the 'XY' plane." +layout: manual +--- + +Start a sketch at a given point on the 'XY' plane. + + + +``` +startSketchAt(data: LineData) -> SketchGroup +``` + +### Examples + +```kcl +startSketchAt([0, 0]) + |> line([10, 10], %) +``` + +### Arguments + +* `data`: `LineData` - Data to draw a line. (REQUIRED) +``` +{ + // The tag. + tag: string, + // The to point. + to: [number, number], +} | +[number, number] +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/startSketchOn.md b/docs/kcl/startSketchOn.md new file mode 100644 index 0000000000..b334b0fc76 --- /dev/null +++ b/docs/kcl/startSketchOn.md @@ -0,0 +1,286 @@ +--- +title: "startSketchOn" +excerpt: "Start a sketch on a specific plane or face." +layout: manual +--- + +Start a sketch on a specific plane or face. + + + +``` +startSketchOn(data: SketchData, tag?: SketchOnFaceTag) -> SketchSurface +``` + +### Examples + +```kcl +startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> line([10, 10], %) + |> line({ to: [20, 10], tag: "edge1" }, %) + |> close(%, "edge2") +``` + +```kcl +fn cube = (pos, scale) => { + const sg = startSketchOn('XY') + |> startProfileAt(pos, %) + |> line([0, scale], %) + |> line([scale, 0], %) + |> line([0, -scale], %) + |> close(%) + |> extrude(scale, %) + + return sg +} + +const box = cube([0, 0], 20) + +const part001 = startSketchOn(box, "start") + |> startProfileAt([0, 0], %) + |> line([10, 10], %) + |> line({ to: [20, 10], tag: "edge1" }, %) + |> close(%) + |> extrude(20, %) +``` + +### Arguments + +* `data`: `SketchData` - Data for start sketch on. You can start a sketch on a plane or an extrude group. (REQUIRED) +``` +"XY" | +"-XY" | +"XZ" | +"-XZ" | +"YZ" | +"-YZ" | +{ + plane: { + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + // What should the plane’s X axis be? + x_axis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + y_axis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + z_axis: { + x: number, + y: number, + z: number, +}, +}, +} | +{ + // The id of the extrusion end cap + endCapId: uuid, + // The height of the extrude group. + height: number, + // The id of the extrude group. + id: uuid, + // The position of the extrude group. + position: [number, number, number], + // The rotation of the extrude group. + rotation: [number, number, number, number], + // The sketch group paths. + sketchGroupValues: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The id of the extrusion start cap + startCapId: uuid, + // The extrude surfaces. + value: [{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudePlane", +} | +{ + // The face id for the extrude plane. + faceId: uuid, + // The id of the geometry. + id: uuid, + // The name. + name: string, + // The position. + position: [number, number, number], + // The rotation. + rotation: [number, number, number, number], + // The source range. + sourceRange: [number, number], + type: "extrudeArc", +}], + // The x-axis of the extrude group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the extrude group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the extrude group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` +* `tag`: `SketchOnFaceTag` - A tag for sketch on face. (OPTIONAL) +``` +"start" | "end" | +string +``` + +### Returns + +`SketchSurface` - A sketch group type. +``` +{ + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/std.md b/docs/kcl/std.md deleted file mode 100644 index 2498b934c4..0000000000 --- a/docs/kcl/std.md +++ /dev/null @@ -1,12327 +0,0 @@ - - -# KCL Standard Library - -## Table of Contents - -* [Functions](#functions) - * [`abs`](#abs) - * [`acos`](#acos) - * [`angleToMatchLengthX`](#angleToMatchLengthX) - * [`angleToMatchLengthY`](#angleToMatchLengthY) - * [`angledLine`](#angledLine) - * [`angledLineOfXLength`](#angledLineOfXLength) - * [`angledLineOfYLength`](#angledLineOfYLength) - * [`angledLineThatIntersects`](#angledLineThatIntersects) - * [`angledLineToX`](#angledLineToX) - * [`angledLineToY`](#angledLineToY) - * [`arc`](#arc) - * [`asin`](#asin) - * [`atan`](#atan) - * [`bezierCurve`](#bezierCurve) - * [`ceil`](#ceil) - * [`circle`](#circle) - * [`close`](#close) - * [`cos`](#cos) - * [`e`](#e) - * [`extrude`](#extrude) - * [`fillet`](#fillet) - * [`floor`](#floor) - * [`getExtrudeWallTransform`](#getExtrudeWallTransform) - * [`getNextAdjacentEdge`](#getNextAdjacentEdge) - * [`getOppositeEdge`](#getOppositeEdge) - * [`getPreviousAdjacentEdge`](#getPreviousAdjacentEdge) - * [`hole`](#hole) - * [`import`](#import) - * [`lastSegX`](#lastSegX) - * [`lastSegY`](#lastSegY) - * [`legAngX`](#legAngX) - * [`legAngY`](#legAngY) - * [`legLen`](#legLen) - * [`line`](#line) - * [`lineTo`](#lineTo) - * [`ln`](#ln) - * [`log`](#log) - * [`log10`](#log10) - * [`log2`](#log2) - * [`max`](#max) - * [`min`](#min) - * [`patternCircular2d`](#patternCircular2d) - * [`patternCircular3d`](#patternCircular3d) - * [`patternLinear2d`](#patternLinear2d) - * [`patternLinear3d`](#patternLinear3d) - * [`pi`](#pi) - * [`pow`](#pow) - * [`segAng`](#segAng) - * [`segEndX`](#segEndX) - * [`segEndY`](#segEndY) - * [`segLen`](#segLen) - * [`sin`](#sin) - * [`sqrt`](#sqrt) - * [`startProfileAt`](#startProfileAt) - * [`startSketchAt`](#startSketchAt) - * [`startSketchOn`](#startSketchOn) - * [`tan`](#tan) - * [`tangentialArc`](#tangentialArc) - * [`tangentialArcTo`](#tangentialArcTo) - * [`tau`](#tau) - * [`toDegrees`](#toDegrees) - * [`toRadians`](#toRadians) - * [`xLine`](#xLine) - * [`xLineTo`](#xLineTo) - * [`yLine`](#yLine) - * [`yLineTo`](#yLineTo) - - -## Functions - -### abs - -Computes the absolute value of a number. - - - -``` -abs(num: number) -> number -``` - -#### Examples - -```kcl -const myVar = abs(-4) -``` - -#### Arguments - -* `num`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### acos - -Computes the arccosine of a number (in radians). - - - -``` -acos(num: number) -> number -``` - -#### Examples - -```kcl -const myVar = acos(0.5) -``` - -#### Arguments - -* `num`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### angleToMatchLengthX - -Returns the angle to match the given length for x. - - - -``` -angleToMatchLengthX(segment_name: string, to: number, sketch_group: SketchGroup) -> number -``` - -#### Examples - -```kcl -const part001 = startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> line({ to: [1, 3.82], tag: 'seg01' }, %) - |> angledLineToX([ - -angleToMatchLengthX('seg01', 10, %), - 5 - ], %) - |> close(%) -``` - -#### Arguments - -* `segment_name`: `string` (REQUIRED) -* `to`: `number` (REQUIRED) -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `number` - - - -### angleToMatchLengthY - -Returns the angle to match the given length for y. - - - -``` -angleToMatchLengthY(segment_name: string, to: number, sketch_group: SketchGroup) -> number -``` - -#### Examples - -```kcl -const part001 = startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> line({ to: [1, 3.82], tag: 'seg01' }, %) - |> angledLineToX([ - -angleToMatchLengthY('seg01', 10, %), - 5 - ], %) - |> close(%) -``` - -#### Arguments - -* `segment_name`: `string` (REQUIRED) -* `to`: `number` (REQUIRED) -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `number` - - - -### angledLine - -Draw an angled line. - - - -``` -angledLine(data: AngledLineData, sketch_group: SketchGroup) -> SketchGroup -``` - -#### Examples - -```kcl -startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> angledLine({ angle: 45, length: 10, tag: "edge1" }, %) - |> line([10, 10], %) - |> line([0, 10], %) - |> close(%, "edge2") - |> extrude(10, %) -``` - -#### Arguments - -* `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED) -``` -{ - // The angle of the line. - angle: number, - // The length of the line. - length: number, - // The tag. - tag: string, -} | -[number, number] -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### angledLineOfXLength - -Draw an angled line of a given x length. - - - -``` -angledLineOfXLength(data: AngledLineData, sketch_group: SketchGroup) -> SketchGroup -``` - -#### Examples - -```kcl -startSketchOn('XZ') - |> startProfileAt([0, 0], %) - |> angledLineOfXLength({ angle: 45, length: 10, tag: "edge1" }, %) - |> line([10, 10], %) - |> line([0, 10], %) - |> close(%, "edge2") - |> extrude(10, %) -``` - -#### Arguments - -* `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED) -``` -{ - // The angle of the line. - angle: number, - // The length of the line. - length: number, - // The tag. - tag: string, -} | -[number, number] -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### angledLineOfYLength - -Draw an angled line of a given y length. - - - -``` -angledLineOfYLength(data: AngledLineData, sketch_group: SketchGroup) -> SketchGroup -``` - -#### Examples - -```kcl -startSketchOn('YZ') - |> startProfileAt([0, 0], %) - |> angledLineOfYLength({ angle: 45, length: 10, tag: "edge1" }, %) - |> line([10, 10], %) - |> line([0, 10], %) - |> close(%, "edge2") - |> extrude(10, %) - |> fillet({ radius: 2, tags: ["edge1"] }, %) -``` - -#### Arguments - -* `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED) -``` -{ - // The angle of the line. - angle: number, - // The length of the line. - length: number, - // The tag. - tag: string, -} | -[number, number] -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### angledLineThatIntersects - -Draw an angled line that intersects with a given line. - - - -``` -angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch_group: SketchGroup) -> SketchGroup -``` - -#### Examples - -```kcl -const part001 = startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> lineTo({ to: [2, 2], tag: "yo" }, %) - |> lineTo([3, 1], %) - |> angledLineThatIntersects({ - angle: 180, - intersectTag: 'yo', - offset: 12, - tag: "yo2" - }, %) - |> line([4, 0], %) - |> close(%, "yo3") - |> extrude(10, %) -``` - -#### Arguments - -* `data`: `AngledLineThatIntersectsData` - Data for drawing an angled line that intersects with a given line. (REQUIRED) -``` -{ - // The angle of the line. - angle: number, - // The tag of the line to intersect with. - intersectTag: string, - // The offset from the intersecting line. - offset: number, - // The tag. - tag: string, -} -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### angledLineToX - -Draw an angled line to a given x coordinate. - - - -``` -angledLineToX(data: AngledLineToData, sketch_group: SketchGroup) -> SketchGroup -``` - -#### Examples - -```kcl -startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> angledLineToX({ angle: 45, to: 10, tag: "edge1" }, %) - |> line([10, 10], %) - |> line([0, 10], %) - |> close(%, "edge2") - |> extrude(10, %) - |> fillet({ radius: 2, tags: ["edge1"] }, %) -``` - -#### Arguments - -* `data`: `AngledLineToData` - Data to draw an angled line to a point. (REQUIRED) -``` -{ - // The angle of the line. - angle: number, - // The tag. - tag: string, - // The point to draw to. - to: number, -} | -[number, number] -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### angledLineToY - -Draw an angled line to a given y coordinate. - - - -``` -angledLineToY(data: AngledLineToData, sketch_group: SketchGroup) -> SketchGroup -``` - -#### Examples - -```kcl -startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> angledLineToY({ angle: 45, to: 10, tag: "edge1" }, %) - |> line([10, 10], %) - |> line([0, 10], %) - |> close(%, "edge2") - |> extrude(10, %) -``` - -#### Arguments - -* `data`: `AngledLineToData` - Data to draw an angled line to a point. (REQUIRED) -``` -{ - // The angle of the line. - angle: number, - // The tag. - tag: string, - // The point to draw to. - to: number, -} | -[number, number] -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### arc - -Draw an arc. - - - -``` -arc(data: ArcData, sketch_group: SketchGroup) -> SketchGroup -``` - -#### Examples - -```kcl -startSketchOn('-YZ') - |> startProfileAt([0, 0], %) - |> arc({ - angle_start: 0, - angle_end: 360, - radius: 10, - tag: "edge1" - }, %) - |> extrude(10, %) -``` - -#### Arguments - -* `data`: `ArcData` - Data to draw an arc. (REQUIRED) -``` -{ - // The end angle. - angle_end: number, - // The start angle. - angle_start: number, - // The radius. - radius: number, - // The tag. - tag: string, -} | -{ - // The center. - center: [number, number], - // The radius. - radius: number, - // The tag. - tag: string, - // The to point. - to: [number, number], -} -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### asin - -Computes the arcsine of a number (in radians). - - - -``` -asin(num: number) -> number -``` - -#### Examples - -```kcl -const myVar = asin(0.5) -``` - -#### Arguments - -* `num`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### atan - -Computes the arctangent of a number (in radians). - - - -``` -atan(num: number) -> number -``` - -#### Examples - -```kcl -const myVar = atan(1.0) -``` - -#### Arguments - -* `num`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### bezierCurve - -Draw a bezier curve. - - - -``` -bezierCurve(data: BezierData, sketch_group: SketchGroup) -> SketchGroup -``` - -#### Examples - -```kcl -startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> bezierCurve({ - to: [10, 10], - control1: [5, 0], - control2: [5, 10], - tag: "edge1" - }, %) - |> close(%) - |> extrude(10, %) -``` - -#### Arguments - -* `data`: `BezierData` - Data to draw a bezier curve. (REQUIRED) -``` -{ - // The first control point. - control1: [number, number], - // The second control point. - control2: [number, number], - // The tag. - tag: string, - // The to point. - to: [number, number], -} -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### ceil - -Computes the smallest integer greater than or equal to a number. - - - -``` -ceil(num: number) -> number -``` - -#### Examples - -```kcl -const myVar = ceil(4.5) -``` - -#### Arguments - -* `num`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### circle - -Sketch a circle on the given plane - - - -``` -circle(center: [number, number], radius: number, surface: SketchSurface, tag?: String) -> SketchGroup -``` - -#### Arguments - -* `center`: `[number, number]` (REQUIRED) -* `radius`: `number` (REQUIRED) -* `surface`: `SketchSurface` - A sketch group type. (REQUIRED) -``` -{ - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` -* `tag`: `String` (OPTIONAL) - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### close - -Close the current sketch. - - - -``` -close(sketch_group: SketchGroup, tag?: String) -> SketchGroup -``` - -#### Examples - -```kcl -startSketchOn('XZ') - |> startProfileAt([0, 0], %) - |> line([10, 10], %) - |> line([10, 0], %) - |> close(%) -``` - -```kcl -startSketchOn('YZ') - |> startProfileAt([0, 0], %) - |> line([10, 10], %) - |> line([10, 0], %) - |> close(%, "edge1") -``` - -#### Arguments - -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` -* `tag`: `String` (OPTIONAL) - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### cos - -Computes the sine of a number (in radians). - - - -``` -cos(num: number) -> number -``` - -#### Examples - -```kcl -const anotherVar = cos(2 * pi()) -``` - -#### Arguments - -* `num`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### e - -Return the value of Euler’s number `e`. - - - -``` -e() -> number -``` - -#### Examples - -```kcl -const myVar = e() -``` - -#### Arguments - - -#### Returns - -* `number` - - - -### extrude - -Extrudes by a given amount. - - - -``` -extrude(length: number, sketch_group: SketchGroup) -> ExtrudeGroup -``` - -#### Examples - -```kcl -startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> line([0, 10], %) - |> line([10, 0], %) - |> line([0, -10], %) - |> close(%) - |> extrude(5, %) -``` - -#### Arguments - -* `length`: `number` (REQUIRED) -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. -``` -{ - // The id of the extrusion end cap - endCapId: uuid, - // The height of the extrude group. - height: number, - // The id of the extrude group. - id: uuid, - // The position of the extrude group. - position: [number, number, number], - // The rotation of the extrude group. - rotation: [number, number, number, number], - // The sketch group paths. - sketchGroupValues: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The id of the extrusion start cap - startCapId: uuid, - // The extrude surfaces. - value: [{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudePlane", -} | -{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudeArc", -}], - // The x-axis of the extrude group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the extrude group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the extrude group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### fillet - -Create fillets on tagged paths. - - - -``` -fillet(data: FilletData, extrude_group: ExtrudeGroup) -> ExtrudeGroup -``` - -#### Examples - -```kcl -const part001 = startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> line({ to: [0, 10], tag: "thing" }, %) - |> line([10, 0], %) - |> line({ to: [0, -10], tag: "thing2" }, %) - |> close(%) - |> extrude(10, %) - |> fillet({ radius: 2, tags: ["thing", "thing2"] }, %) -``` - -#### Arguments - -* `data`: `FilletData` - Data for fillets. (REQUIRED) -``` -{ - // The radius of the fillet. - radius: number, - // The tags of the paths you want to fillet. - tags: [uuid | -string], -} -``` -* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) -``` -{ - // The id of the extrusion end cap - endCapId: uuid, - // The height of the extrude group. - height: number, - // The id of the extrude group. - id: uuid, - // The position of the extrude group. - position: [number, number, number], - // The rotation of the extrude group. - rotation: [number, number, number, number], - // The sketch group paths. - sketchGroupValues: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The id of the extrusion start cap - startCapId: uuid, - // The extrude surfaces. - value: [{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudePlane", -} | -{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudeArc", -}], - // The x-axis of the extrude group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the extrude group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the extrude group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. -``` -{ - // The id of the extrusion end cap - endCapId: uuid, - // The height of the extrude group. - height: number, - // The id of the extrude group. - id: uuid, - // The position of the extrude group. - position: [number, number, number], - // The rotation of the extrude group. - rotation: [number, number, number, number], - // The sketch group paths. - sketchGroupValues: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The id of the extrusion start cap - startCapId: uuid, - // The extrude surfaces. - value: [{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudePlane", -} | -{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudeArc", -}], - // The x-axis of the extrude group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the extrude group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the extrude group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### floor - -Computes the largest integer less than or equal to a number. - - - -``` -floor(num: number) -> number -``` - -#### Examples - -```kcl -const myVar = floor(4.5) -``` - -#### Arguments - -* `num`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### getExtrudeWallTransform - -Returns the extrude wall transform. - - - -``` -getExtrudeWallTransform(surface_name: string, extrude_group: ExtrudeGroup) -> ExtrudeTransform -``` - -#### Examples - -```kcl -const box = startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> line([0, 10], %) - |> line([10, 0], %) - |> line({ to: [0, -10], tag: "surface" }, %) - |> close(%) - |> extrude(5, %) - -const transform = getExtrudeWallTransform('surface', box) -``` - -#### Arguments - -* `surface_name`: `string` (REQUIRED) -* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) -``` -{ - // The id of the extrusion end cap - endCapId: uuid, - // The height of the extrude group. - height: number, - // The id of the extrude group. - id: uuid, - // The position of the extrude group. - position: [number, number, number], - // The rotation of the extrude group. - rotation: [number, number, number, number], - // The sketch group paths. - sketchGroupValues: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The id of the extrusion start cap - startCapId: uuid, - // The extrude surfaces. - value: [{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudePlane", -} | -{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudeArc", -}], - // The x-axis of the extrude group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the extrude group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the extrude group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `ExtrudeTransform` -``` -{ - position: [number, number, number], - rotation: [number, number, number, number], -} -``` - - - -### getNextAdjacentEdge - -Get the next adjacent edge to the edge given. - - - -``` -getNextAdjacentEdge(tag: String, extrude_group: ExtrudeGroup) -> Uuid -``` - -#### Examples - -```kcl -const part001 = startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> line({ to: [0, 10], tag: "thing" }, %) - |> line({ to: [10, 0], tag: "thing1" }, %) - |> line({ to: [0, -10], tag: "thing2" }, %) - |> close(%) - |> extrude(10, %) - |> fillet({ - radius: 2, - tags: [getNextAdjacentEdge("thing", %)] - }, %) -``` - -#### Arguments - -* `tag`: `String` (REQUIRED) -* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) -``` -{ - // The id of the extrusion end cap - endCapId: uuid, - // The height of the extrude group. - height: number, - // The id of the extrude group. - id: uuid, - // The position of the extrude group. - position: [number, number, number], - // The rotation of the extrude group. - rotation: [number, number, number, number], - // The sketch group paths. - sketchGroupValues: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The id of the extrusion start cap - startCapId: uuid, - // The extrude surfaces. - value: [{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudePlane", -} | -{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudeArc", -}], - // The x-axis of the extrude group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the extrude group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the extrude group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `Uuid` - - - -### getOppositeEdge - -Get the opposite edge to the edge given. - - - -``` -getOppositeEdge(tag: String, extrude_group: ExtrudeGroup) -> Uuid -``` - -#### Examples - -```kcl -const part001 = startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> line({ to: [0, 10], tag: "thing" }, %) - |> line([10, 0], %) - |> line({ to: [0, -10], tag: "thing2" }, %) - |> close(%) - |> extrude(10, %) - |> fillet({ - radius: 2, - tags: ["thing", getOppositeEdge("thing", %)] - }, %) -``` - -#### Arguments - -* `tag`: `String` (REQUIRED) -* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) -``` -{ - // The id of the extrusion end cap - endCapId: uuid, - // The height of the extrude group. - height: number, - // The id of the extrude group. - id: uuid, - // The position of the extrude group. - position: [number, number, number], - // The rotation of the extrude group. - rotation: [number, number, number, number], - // The sketch group paths. - sketchGroupValues: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The id of the extrusion start cap - startCapId: uuid, - // The extrude surfaces. - value: [{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudePlane", -} | -{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudeArc", -}], - // The x-axis of the extrude group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the extrude group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the extrude group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `Uuid` - - - -### getPreviousAdjacentEdge - -Get the previous adjacent edge to the edge given. - - - -``` -getPreviousAdjacentEdge(tag: String, extrude_group: ExtrudeGroup) -> Uuid -``` - -#### Examples - -```kcl -const part001 = startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> line({ to: [0, 10], tag: "thing" }, %) - |> line({ to: [10, 0], tag: "thing1" }, %) - |> line({ to: [0, -10], tag: "thing2" }, %) - |> close(%) - |> extrude(10, %) - |> fillet({ - radius: 2, - tags: [getPreviousAdjacentEdge("thing2", %)] - }, %) -``` - -#### Arguments - -* `tag`: `String` (REQUIRED) -* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) -``` -{ - // The id of the extrusion end cap - endCapId: uuid, - // The height of the extrude group. - height: number, - // The id of the extrude group. - id: uuid, - // The position of the extrude group. - position: [number, number, number], - // The rotation of the extrude group. - rotation: [number, number, number, number], - // The sketch group paths. - sketchGroupValues: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The id of the extrusion start cap - startCapId: uuid, - // The extrude surfaces. - value: [{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudePlane", -} | -{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudeArc", -}], - // The x-axis of the extrude group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the extrude group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the extrude group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `Uuid` - - - -### hole - -Use a sketch to cut a hole in another sketch. - - - -``` -hole(hole_sketch_group: SketchGroupSet, sketch_group: SketchGroup) -> SketchGroup -``` - -#### Examples - -```kcl -const square = startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> line([0, 10], %) - |> line([10, 0], %) - |> line([0, -10], %) - |> close(%) - |> hole(circle([2, 2], .5, startSketchOn('XY')), %) - |> hole(circle([2, 8], .5, startSketchOn('XY')), %) - |> extrude(2, %) -``` - -#### Arguments - -* `hole_sketch_group`: `SketchGroupSet` - A sketch group or a group of sketch groups. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - type: "sketchGroup", - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - type: "sketchGroups", -} -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### import - -Import a CAD file. - -For formats lacking unit data (STL, OBJ, PLY), the default import unit is millimeters. Otherwise you can specify the unit by passing in the options parameter. If you import a gltf file, we will try to find the bin file and import it as well. -Import paths are relative to the current project directory. This only works in the desktop app not in browser. - -``` -import(file_path: String, options?: ImportFormat) -> ImportedGeometry -``` - -#### Examples - -```kcl -const model = import("thing.obj") -``` - -```kcl -const model = import("cube.obj", { type: "obj", units: "m" }) -``` - -```kcl -const model = import("my_model.gltf") -``` - -```kcl -const model = import("my_model.sldprt") -``` - -```kcl -const model = import("my_model.step") -``` - -#### Arguments - -* `file_path`: `String` (REQUIRED) -* `options`: `ImportFormat` - Import format specifier (OPTIONAL) -``` -{ - type: "fbx", -} | -{ - type: "gltf", -} | -{ - // Co-ordinate system of input data. Defaults to the [KittyCAD co-ordinate system. - coords: { - // Axis the front face of a model looks along. - forward: { - // Axis specifier. - axis: "y" | "z", - // Specifies which direction the axis is pointing. - direction: "positive" | "negative", -}, - // Axis pointing up and away from a model. - up: { - // Axis specifier. - axis: "y" | "z", - // Specifies which direction the axis is pointing. - direction: "positive" | "negative", -}, -}, - type: "obj", - // The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. Defaults to millimeters. - units: "cm" | "ft" | "in" | "m" | "mm" | "yd", -} | -{ - // Co-ordinate system of input data. Defaults to the [KittyCAD co-ordinate system. - coords: { - // Axis the front face of a model looks along. - forward: { - // Axis specifier. - axis: "y" | "z", - // Specifies which direction the axis is pointing. - direction: "positive" | "negative", -}, - // Axis pointing up and away from a model. - up: { - // Axis specifier. - axis: "y" | "z", - // Specifies which direction the axis is pointing. - direction: "positive" | "negative", -}, -}, - type: "ply", - // The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. Defaults to millimeters. - units: "cm" | "ft" | "in" | "m" | "mm" | "yd", -} | -{ - type: "sldprt", -} | -{ - type: "step", -} | -{ - // Co-ordinate system of input data. Defaults to the [KittyCAD co-ordinate system. - coords: { - // Axis the front face of a model looks along. - forward: { - // Axis specifier. - axis: "y" | "z", - // Specifies which direction the axis is pointing. - direction: "positive" | "negative", -}, - // Axis pointing up and away from a model. - up: { - // Axis specifier. - axis: "y" | "z", - // Specifies which direction the axis is pointing. - direction: "positive" | "negative", -}, -}, - type: "stl", - // The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. Defaults to millimeters. - units: "cm" | "ft" | "in" | "m" | "mm" | "yd", -} -``` - -#### Returns - -* `ImportedGeometry` - Data for an imported geometry. -``` -{ - // The ID of the imported geometry. - id: uuid, - // The original file paths. - value: [string], -} -``` - - - -### lastSegX - -Returns the last segment of x. - - - -``` -lastSegX(sketch_group: SketchGroup) -> number -``` - -#### Examples - -```kcl -startSketchOn("YZ") - |> startProfileAt([0, 0], %) - |> line({ to: [5, 0], tag: "thing" }, %) - |> line([5, 5], %) - |> line([0, lastSegX(%)], %) - |> close(%) - |> extrude(5, %) -``` - -#### Arguments - -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `number` - - - -### lastSegY - -Returns the last segment of y. - - - -``` -lastSegY(sketch_group: SketchGroup) -> number -``` - -#### Examples - -```kcl -startSketchOn("YZ") - |> startProfileAt([0, 0], %) - |> line({ to: [5, 0], tag: "thing" }, %) - |> line([5, 5], %) - |> line([0, lastSegY(%)], %) - |> close(%) - |> extrude(5, %) -``` - -#### Arguments - -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `number` - - - -### legAngX - -Returns the angle of the given leg for x. - - - -``` -legAngX(hypotenuse: number, leg: number) -> number -``` - -#### Examples - -```kcl -legAngX(5, 3) -``` - -#### Arguments - -* `hypotenuse`: `number` (REQUIRED) -* `leg`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### legAngY - -Returns the angle of the given leg for y. - - - -``` -legAngY(hypotenuse: number, leg: number) -> number -``` - -#### Examples - -```kcl -legAngY(5, 3) -``` - -#### Arguments - -* `hypotenuse`: `number` (REQUIRED) -* `leg`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### legLen - -Returns the length of the given leg. - - - -``` -legLen(hypotenuse: number, leg: number) -> number -``` - -#### Examples - -```kcl -legLen(5, 3) -``` - -#### Arguments - -* `hypotenuse`: `number` (REQUIRED) -* `leg`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### line - -Draw a line. - - - -``` -line(data: LineData, sketch_group: SketchGroup) -> SketchGroup -``` - -#### Examples - -```kcl -startSketchOn('-XY') - |> startProfileAt([0, 0], %) - |> line([10, 10], %) - |> line({ to: [20, 10], tag: "edge1" }, %) - |> close(%, "edge2") - |> extrude(10, %) -``` - -#### Arguments - -* `data`: `LineData` - Data to draw a line. (REQUIRED) -``` -{ - // The tag. - tag: string, - // The to point. - to: [number, number], -} | -[number, number] -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### lineTo - -Draw a line to a point. - - - -``` -lineTo(data: LineToData, sketch_group: SketchGroup) -> SketchGroup -``` - -#### Examples - -```kcl -fn rectShape = (pos, w, l) => { - const rr = startSketchOn('YZ') - |> startProfileAt([pos[0] - (w / 2), pos[1] - (l / 2)], %) - |> lineTo({ - to: [pos[0] + w / 2, pos[1] - (l / 2)], - tag: "edge1" - }, %) - |> lineTo({ - to: [pos[0] + w / 2, pos[1] + l / 2], - tag: "edge2" - }, %) - |> lineTo({ - to: [pos[0] - (w / 2), pos[1] + l / 2], - tag: "edge3" - }, %) - |> close(%, "edge4") - return rr -} - -// Create the mounting plate extrusion, holes, and fillets -const part = rectShape([0, 0], 20, 20) -``` - -#### Arguments - -* `data`: `LineToData` - Data to draw a line to a point. (REQUIRED) -``` -{ - // The tag. - tag: string, - // The to point. - to: [number, number], -} | -[number, number] -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### ln - -Computes the natural logarithm of the number. - - - -``` -ln(num: number) -> number -``` - -#### Examples - -```kcl -const myVar = ln(4) -``` - -#### Arguments - -* `num`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### log - -Computes the logarithm of the number with respect to an arbitrary base. - -The result might not be correctly rounded owing to implementation details; `log2()` can produce more accurate results for base 2, and `log10()` can produce more accurate results for base 10. - -``` -log(num: number, base: number) -> number -``` - -#### Examples - -```kcl -const myVar = log(4, 2) -``` - -#### Arguments - -* `num`: `number` (REQUIRED) -* `base`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### log10 - -Computes the base 10 logarithm of the number. - - - -``` -log10(num: number) -> number -``` - -#### Examples - -```kcl -const myVar = log10(4) -``` - -#### Arguments - -* `num`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### log2 - -Computes the base 2 logarithm of the number. - - - -``` -log2(num: number) -> number -``` - -#### Examples - -```kcl -const myVar = log2(4) -``` - -#### Arguments - -* `num`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### max - -Computes the maximum of the given arguments. - - - -``` -max(args: [number]) -> number -``` - -#### Examples - -```kcl -const myVar = max(4, 5, 6) -``` - -#### Arguments - -* `args`: `[number]` (REQUIRED) - -#### Returns - -* `number` - - - -### min - -Computes the minimum of the given arguments. - - - -``` -min(args: [number]) -> number -``` - -#### Examples - -```kcl -const myVar = min(4, 5, 6) -``` - -#### Arguments - -* `args`: `[number]` (REQUIRED) - -#### Returns - -* `number` - - - -### patternCircular2d - -A circular pattern on a 2D sketch. - - - -``` -patternCircular2d(data: CircularPattern2dData, sketch_group: SketchGroup) -> [SketchGroup] -``` - -#### Examples - -```kcl -const part = startSketchOn('XY') - |> circle([0, 0], 2, %) - |> patternCircular2d({ - center: [20, 20], - repetitions: 12, - arcDegrees: 210, - rotateDuplicates: true - }, %) -``` - -#### Arguments - -* `data`: `CircularPattern2dData` - Data for a circular pattern on a 2D sketch. (REQUIRED) -``` -{ - // The arc angle (in degrees) to place the repetitions. Must be greater than 0. - arcDegrees: number, - // The center about which to make th pattern. This is a 2D vector. - center: [number, number], - // The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once. - repetitions: number, - // Whether or not to rotate the duplicates as they are copied. - rotateDuplicates: string, -} -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `[SketchGroup]` - - - -### patternCircular3d - -A circular pattern on a 3D model. - - - -``` -patternCircular3d(data: CircularPattern3dData, extrude_group: ExtrudeGroup) -> [ExtrudeGroup] -``` - -#### Examples - -```kcl -const part = startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> line([0, 1], %) - |> line([1, 0], %) - |> line([0, -1], %) - |> close(%) - |> extrude(1, %) - |> patternCircular3d({ - axis: [1, 1, 0], - center: [10, 0, 10], - repetitions: 10, - arcDegrees: 360, - rotateDuplicates: true - }, %) -``` - -#### Arguments - -* `data`: `CircularPattern3dData` - Data for a circular pattern on a 3D model. (REQUIRED) -``` -{ - // The arc angle (in degrees) to place the repetitions. Must be greater than 0. - arcDegrees: number, - // The axis around which to make the pattern. This is a 3D vector. - axis: [number, number, number], - // The center about which to make th pattern. This is a 3D vector. - center: [number, number, number], - // The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once. - repetitions: number, - // Whether or not to rotate the duplicates as they are copied. - rotateDuplicates: string, -} -``` -* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) -``` -{ - // The id of the extrusion end cap - endCapId: uuid, - // The height of the extrude group. - height: number, - // The id of the extrude group. - id: uuid, - // The position of the extrude group. - position: [number, number, number], - // The rotation of the extrude group. - rotation: [number, number, number, number], - // The sketch group paths. - sketchGroupValues: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The id of the extrusion start cap - startCapId: uuid, - // The extrude surfaces. - value: [{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudePlane", -} | -{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudeArc", -}], - // The x-axis of the extrude group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the extrude group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the extrude group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `[ExtrudeGroup]` - - - -### patternLinear2d - -A linear pattern on a 2D sketch. - - - -``` -patternLinear2d(data: LinearPattern2dData, sketch_group: SketchGroup) -> [SketchGroup] -``` - -#### Examples - -```kcl -const part = startSketchOn('XY') - |> circle([0, 0], 2, %) - |> patternLinear2d({ - axis: [0, 1], - repetitions: 12, - distance: 2 - }, %) -``` - -#### Arguments - -* `data`: `LinearPattern2dData` - Data for a linear pattern on a 2D sketch. (REQUIRED) -``` -{ - // The axis of the pattern. This is a 2D vector. - axis: [number, number], - // The distance between each repetition. This can also be referred to as spacing. - distance: number, - // The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once. - repetitions: number, -} -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `[SketchGroup]` - - - -### patternLinear3d - -A linear pattern on a 3D model. - - - -``` -patternLinear3d(data: LinearPattern3dData, extrude_group: ExtrudeGroup) -> [ExtrudeGroup] -``` - -#### Examples - -```kcl -const part = startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> line([0, 1], %) - |> line([1, 0], %) - |> line([0, -1], %) - |> close(%) - |> extrude(1, %) - |> patternLinear3d({ - axis: [1, 0, 1], - repetitions: 3, - distance: 6 - }, %) -``` - -#### Arguments - -* `data`: `LinearPattern3dData` - Data for a linear pattern on a 3D model. (REQUIRED) -``` -{ - // The axis of the pattern. - axis: [number, number, number], - // The distance between each repetition. This can also be referred to as spacing. - distance: number, - // The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once. - repetitions: number, -} -``` -* `extrude_group`: `ExtrudeGroup` - An extrude group is a collection of extrude surfaces. (REQUIRED) -``` -{ - // The id of the extrusion end cap - endCapId: uuid, - // The height of the extrude group. - height: number, - // The id of the extrude group. - id: uuid, - // The position of the extrude group. - position: [number, number, number], - // The rotation of the extrude group. - rotation: [number, number, number, number], - // The sketch group paths. - sketchGroupValues: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The id of the extrusion start cap - startCapId: uuid, - // The extrude surfaces. - value: [{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudePlane", -} | -{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudeArc", -}], - // The x-axis of the extrude group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the extrude group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the extrude group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `[ExtrudeGroup]` - - - -### pi - -Return the value of `pi`. Archimedes’ constant (π). - - - -``` -pi() -> number -``` - -#### Examples - -```kcl -const myVar = pi() * 3.0 -``` - -#### Arguments - - -#### Returns - -* `number` - - - -### pow - -Computes the number to a power. - - - -``` -pow(num: number, pow: number) -> number -``` - -#### Examples - -```kcl -const myVar = pow(4, 2) -``` - -#### Arguments - -* `num`: `number` (REQUIRED) -* `pow`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### segAng - -Returns the angle of the segment. - - - -``` -segAng(segment_name: string, sketch_group: SketchGroup) -> number -``` - -#### Examples - -```kcl -const part001 = startSketchOn('XY') - |> startProfileAt([4.83, 12.56], %) - |> line([15.1, 2.48], %) - |> line({ to: [3.15, -9.85], tag: 'seg01' }, %) - |> line([-15.17, -4.1], %) - |> angledLine([segAng('seg01', %), 12.35], %) - |> line([-13.02, 10.03], %) - |> close(%) - |> extrude(4, %) -``` - -#### Arguments - -* `segment_name`: `string` (REQUIRED) -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `number` - - - -### segEndX - -Returns the segment end of x. - - - -``` -segEndX(segment_name: string, sketch_group: SketchGroup) -> number -``` - -#### Examples - -```kcl -startSketchOn("YZ") - |> startProfileAt([0, 0], %) - |> line({ to: [5, 0], tag: "thing" }, %) - |> line([5, 5], %) - |> line([segEndX("thing", %), 5], %) - |> close(%) - |> extrude(5, %) -``` - -#### Arguments - -* `segment_name`: `string` (REQUIRED) -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `number` - - - -### segEndY - -Returns the segment end of y. - - - -``` -segEndY(segment_name: string, sketch_group: SketchGroup) -> number -``` - -#### Examples - -```kcl -startSketchOn("YZ") - |> startProfileAt([0, 0], %) - |> line({ to: [5, 0], tag: "thing" }, %) - |> line([5, 5], %) - |> line([segEndY("thing", %), 5], %) - |> close(%) - |> extrude(5, %) -``` - -#### Arguments - -* `segment_name`: `string` (REQUIRED) -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `number` - - - -### segLen - -Returns the length of the segment. - - - -``` -segLen(segment_name: string, sketch_group: SketchGroup) -> number -``` - -#### Examples - -```kcl -startSketchOn("YZ") - |> startProfileAt([0, 0], %) - |> line({ to: [5, 0], tag: "thing" }, %) - |> line([5, 5], %) - |> line([0, segLen("thing", %)], %) - |> close(%) - |> extrude(5, %) -``` - -#### Arguments - -* `segment_name`: `string` (REQUIRED) -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `number` - - - -### sin - -Computes the sine of a number (in radians). - - - -``` -sin(num: number) -> number -``` - -#### Examples - -```kcl -const myVar = sin(2 * pi()) -``` - -#### Arguments - -* `num`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### sqrt - -Computes the square root of a number. - - - -``` -sqrt(num: number) -> number -``` - -#### Examples - -```kcl -const myVar = sqrt(4) -``` - -#### Arguments - -* `num`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### startProfileAt - -Start a profile at a given point. - - - -``` -startProfileAt(data: LineData, sketch_surface: SketchSurface) -> SketchGroup -``` - -#### Examples - -```kcl -startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> line([10, 10], %) -``` - -#### Arguments - -* `data`: `LineData` - Data to draw a line. (REQUIRED) -``` -{ - // The tag. - tag: string, - // The to point. - to: [number, number], -} | -[number, number] -``` -* `sketch_surface`: `SketchSurface` - A sketch group type. (REQUIRED) -``` -{ - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### startSketchAt - -Start a sketch at a given point on the 'XY' plane. - - - -``` -startSketchAt(data: LineData) -> SketchGroup -``` - -#### Examples - -```kcl -startSketchAt([0, 0]) - |> line([10, 10], %) -``` - -#### Arguments - -* `data`: `LineData` - Data to draw a line. (REQUIRED) -``` -{ - // The tag. - tag: string, - // The to point. - to: [number, number], -} | -[number, number] -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### startSketchOn - -Start a sketch on a specific plane or face. - - - -``` -startSketchOn(data: SketchData, tag?: SketchOnFaceTag) -> SketchSurface -``` - -#### Examples - -```kcl -startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> line([10, 10], %) - |> line({ to: [20, 10], tag: "edge1" }, %) - |> close(%, "edge2") -``` - -```kcl -fn cube = (pos, scale) => { - const sg = startSketchOn('XY') - |> startProfileAt(pos, %) - |> line([0, scale], %) - |> line([scale, 0], %) - |> line([0, -scale], %) - |> close(%) - |> extrude(scale, %) - - return sg -} - -const box = cube([0, 0], 20) - -const part001 = startSketchOn(box, "start") - |> startProfileAt([0, 0], %) - |> line([10, 10], %) - |> line({ to: [20, 10], tag: "edge1" }, %) - |> close(%) - |> extrude(20, %) -``` - -#### Arguments - -* `data`: `SketchData` - Data for start sketch on. You can start a sketch on a plane or an extrude group. (REQUIRED) -``` -"XY" | -"-XY" | -"XZ" | -"-XZ" | -"YZ" | -"-YZ" | -{ - plane: { - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - // What should the plane’s X axis be? - x_axis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - y_axis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - z_axis: { - x: number, - y: number, - z: number, -}, -}, -} | -{ - // The id of the extrusion end cap - endCapId: uuid, - // The height of the extrude group. - height: number, - // The id of the extrude group. - id: uuid, - // The position of the extrude group. - position: [number, number, number], - // The rotation of the extrude group. - rotation: [number, number, number, number], - // The sketch group paths. - sketchGroupValues: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The id of the extrusion start cap - startCapId: uuid, - // The extrude surfaces. - value: [{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudePlane", -} | -{ - // The face id for the extrude plane. - faceId: uuid, - // The id of the geometry. - id: uuid, - // The name. - name: string, - // The position. - position: [number, number, number], - // The rotation. - rotation: [number, number, number, number], - // The source range. - sourceRange: [number, number], - type: "extrudeArc", -}], - // The x-axis of the extrude group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the extrude group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the extrude group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` -* `tag`: `SketchOnFaceTag` - A tag for sketch on face. (OPTIONAL) -``` -"start" | "end" | -string -``` - -#### Returns - -* `SketchSurface` - A sketch group type. -``` -{ - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### tan - -Computes the tangent of a number (in radians). - - - -``` -tan(num: number) -> number -``` - -#### Examples - -```kcl -const myVar = tan(2 * pi()) -``` - -#### Arguments - -* `num`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### tangentialArc - -Draw an arc. - - - -``` -tangentialArc(data: TangentialArcData, sketch_group: SketchGroup) -> SketchGroup -``` - -#### Examples - -```kcl -startSketchOn('-YZ') - |> startProfileAt([0, 0], %) - |> line({ to: [10, 10], tag: "edge0" }, %) - |> tangentialArc({ radius: 10, offset: 90, tag: "edge1" }, %) - |> close(%) - |> extrude(10, %) -``` - -#### Arguments - -* `data`: `TangentialArcData` - Data to draw a tangential arc. (REQUIRED) -``` -{ - // Offset of the arc, in degrees. - offset: number, - // Radius of the arc. Not to be confused with Raiders of the Lost Ark. - radius: number, -} | -{ - // The tag. - tag: string, - // Where the arc should end. Must lie in the same plane as the current path pen position. Must not be colinear with current path pen position. - to: [number, number], -} | -[number, number] -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### tangentialArcTo - -Draw an arc. - - - -``` -tangentialArcTo(to: [number], sketch_group: SketchGroup, tag?: String) -> SketchGroup -``` - -#### Examples - -```kcl -startSketchOn('-YZ') - |> startProfileAt([0, 0], %) - |> line({ to: [10, 10], tag: "edge0" }, %) - |> tangentialArcTo([10, 0], %) - |> close(%) -``` - -#### Arguments - -* `to`: `[number]` (REQUIRED) -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` -* `tag`: `String` (OPTIONAL) - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### tau - -Return the value of `tau`. The full circle constant (τ). Equal to 2π. - - - -``` -tau() -> number -``` - -#### Examples - -```kcl -const myVar = tau() -``` - -#### Arguments - - -#### Returns - -* `number` - - - -### toDegrees - -Converts a number from radians to degrees. - - - -``` -toDegrees(num: number) -> number -``` - -#### Examples - -```kcl -const myVar = toDegrees(2 * pi()) -``` - -#### Arguments - -* `num`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### toRadians - -Converts a number from degrees to radians. - - - -``` -toRadians(num: number) -> number -``` - -#### Examples - -```kcl -const myVar = toRadians(180) -``` - -#### Arguments - -* `num`: `number` (REQUIRED) - -#### Returns - -* `number` - - - -### xLine - -Draw a line on the x-axis. - - - -``` -xLine(data: AxisLineData, sketch_group: SketchGroup) -> SketchGroup -``` - -#### Examples - -```kcl -startSketchOn('YZ') - |> startProfileAt([0, 0], %) - |> xLine(10, %) - |> line([10, 10], %) - |> close(%, "edge1") - |> extrude(10, %) -``` - -#### Arguments - -* `data`: `AxisLineData` - Data to draw a line on an axis. (REQUIRED) -``` -{ - // The length of the line. - length: number, - // The tag. - tag: string, -} | -number -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### xLineTo - -Draw a line to a point on the x-axis. - - - -``` -xLineTo(data: AxisLineToData, sketch_group: SketchGroup) -> SketchGroup -``` - -#### Examples - -```kcl -startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> xLineTo({ to: 10, tag: "edge1" }, %) - |> line([10, 10], %) - |> close(%, "edge2") - |> extrude(10, %) -``` - -#### Arguments - -* `data`: `AxisLineToData` - Data to draw a line to a point on an axis. (REQUIRED) -``` -{ - // The tag. - tag: string, - // The to point. - to: number, -} | -number -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### yLine - -Draw a line on the y-axis. - - - -``` -yLine(data: AxisLineData, sketch_group: SketchGroup) -> SketchGroup -``` - -#### Examples - -```kcl -startSketchOn('XY') - |> startProfileAt([0, 0], %) - |> yLine(10, %) - |> line([10, 10], %) - |> close(%, "edge1") - |> extrude(10, %) -``` - -#### Arguments - -* `data`: `AxisLineData` - Data to draw a line on an axis. (REQUIRED) -``` -{ - // The length of the line. - length: number, - // The tag. - tag: string, -} | -number -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - -### yLineTo - -Draw a line to a point on the y-axis. - - - -``` -yLineTo(data: AxisLineToData, sketch_group: SketchGroup) -> SketchGroup -``` - -#### Examples - -```kcl -startSketchOn('XZ') - |> startProfileAt([0, 0], %) - |> yLineTo({ to: 10, tag: "edge1" }, %) - |> line([10, 10], %) - |> close(%, "edge2") - |> extrude(10, %) - |> fillet({ radius: 2, tags: ["edge2"] }, %) -``` - -#### Arguments - -* `data`: `AxisLineToData` - Data to draw a line to a point on an axis. (REQUIRED) -``` -{ - // The tag. - tag: string, - // The to point. - to: number, -} | -number -``` -* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - -#### Returns - -* `SketchGroup` - A sketch group is a collection of paths. -``` -{ - // The plane id or face id of the sketch group. - entityId: uuid, - // The id of the sketch group. - id: uuid, - // What the sketch is on (can be a plane or a face). - on: { - // The id of the plane. - id: uuid, - // Origin of the plane. - origin: { - x: number, - y: number, - z: number, -}, - type: "plane", - // Type for a plane. - value: "XY" | "XZ" | "YZ" | "Custom", - // What should the plane’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the plane’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -} | -{ - // The id of the face. - id: uuid, - // The original sketch group id of the object we are sketching on. - sketchGroupId: uuid, - type: "face", - // The tag of the face. - value: string, - // What should the face’s X axis be? - xAxis: { - x: number, - y: number, - z: number, -}, - // What should the face’s Y axis be? - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis (normal). - zAxis: { - x: number, - y: number, - z: number, -}, -}, - // The position of the sketch group. - position: [number, number, number], - // The rotation of the sketch group base plane. - rotation: [number, number, number, number], - // The starting path. - start: { - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], -}, - // The paths in the sketch group. - value: [{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "ToPoint", -} | -{ - // arc's direction - ccw: string, - // the arc's center - center: [number, number], - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArcTo", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "TangentialArc", -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Horizontal", - // The x coordinate. - x: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "AngledLineTo", - // The x coordinate. - x: number, - // The y coordinate. - y: number, -} | -{ - // The from point. - from: [number, number], - // The name of the path. - name: string, - // The to point. - to: [number, number], - type: "Base", -}], - // The x-axis of the sketch group base plane in the 3D space - xAxis: { - x: number, - y: number, - z: number, -}, - // The y-axis of the sketch group base plane in the 3D space - yAxis: { - x: number, - y: number, - z: number, -}, - // The z-axis of the sketch group base plane in the 3D space - zAxis: { - x: number, - y: number, - z: number, -}, -} -``` - - - diff --git a/docs/kcl/tan.md b/docs/kcl/tan.md new file mode 100644 index 0000000000..33b1722423 --- /dev/null +++ b/docs/kcl/tan.md @@ -0,0 +1,30 @@ +--- +title: "tan" +excerpt: "Computes the tangent of a number (in radians)." +layout: manual +--- + +Computes the tangent of a number (in radians). + + + +``` +tan(num: number) -> number +``` + +### Examples + +```kcl +const myVar = tan(2 * pi()) +``` + +### Arguments + +* `num`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/tangentialArc.md b/docs/kcl/tangentialArc.md new file mode 100644 index 0000000000..d2c8cdf7a9 --- /dev/null +++ b/docs/kcl/tangentialArc.md @@ -0,0 +1,377 @@ +--- +title: "tangentialArc" +excerpt: "Draw an arc." +layout: manual +--- + +Draw an arc. + + + +``` +tangentialArc(data: TangentialArcData, sketch_group: SketchGroup) -> SketchGroup +``` + +### Examples + +```kcl +startSketchOn('-YZ') + |> startProfileAt([0, 0], %) + |> line({ to: [10, 10], tag: "edge0" }, %) + |> tangentialArc({ radius: 10, offset: 90, tag: "edge1" }, %) + |> close(%) + |> extrude(10, %) +``` + +### Arguments + +* `data`: `TangentialArcData` - Data to draw a tangential arc. (REQUIRED) +``` +{ + // Offset of the arc, in degrees. + offset: number, + // Radius of the arc. Not to be confused with Raiders of the Lost Ark. + radius: number, +} | +{ + // The tag. + tag: string, + // Where the arc should end. Must lie in the same plane as the current path pen position. Must not be colinear with current path pen position. + to: [number, number], +} | +[number, number] +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/tangentialArcTo.md b/docs/kcl/tangentialArcTo.md new file mode 100644 index 0000000000..106e615664 --- /dev/null +++ b/docs/kcl/tangentialArcTo.md @@ -0,0 +1,362 @@ +--- +title: "tangentialArcTo" +excerpt: "Draw an arc." +layout: manual +--- + +Draw an arc. + + + +``` +tangentialArcTo(to: [number], sketch_group: SketchGroup, tag?: String) -> SketchGroup +``` + +### Examples + +```kcl +startSketchOn('-YZ') + |> startProfileAt([0, 0], %) + |> line({ to: [10, 10], tag: "edge0" }, %) + |> tangentialArcTo([10, 0], %) + |> close(%) +``` + +### Arguments + +* `to`: `[number]` (REQUIRED) +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` +* `tag`: `String` (OPTIONAL) + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/tau.md b/docs/kcl/tau.md new file mode 100644 index 0000000000..ff2ed22ee8 --- /dev/null +++ b/docs/kcl/tau.md @@ -0,0 +1,29 @@ +--- +title: "tau" +excerpt: "Return the value of `tau`. The full circle constant (τ). Equal to 2π." +layout: manual +--- + +Return the value of `tau`. The full circle constant (τ). Equal to 2π. + + + +``` +tau() -> number +``` + +### Examples + +```kcl +const myVar = tau() +``` + +### Arguments + + +### Returns + +`number` + + + diff --git a/docs/kcl/toDegrees.md b/docs/kcl/toDegrees.md new file mode 100644 index 0000000000..78932f9dac --- /dev/null +++ b/docs/kcl/toDegrees.md @@ -0,0 +1,30 @@ +--- +title: "toDegrees" +excerpt: "Converts a number from radians to degrees." +layout: manual +--- + +Converts a number from radians to degrees. + + + +``` +toDegrees(num: number) -> number +``` + +### Examples + +```kcl +const myVar = toDegrees(2 * pi()) +``` + +### Arguments + +* `num`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/toRadians.md b/docs/kcl/toRadians.md new file mode 100644 index 0000000000..7da8a854fb --- /dev/null +++ b/docs/kcl/toRadians.md @@ -0,0 +1,30 @@ +--- +title: "toRadians" +excerpt: "Converts a number from degrees to radians." +layout: manual +--- + +Converts a number from degrees to radians. + + + +``` +toRadians(num: number) -> number +``` + +### Examples + +```kcl +const myVar = toRadians(180) +``` + +### Arguments + +* `num`: `number` (REQUIRED) + +### Returns + +`number` + + + diff --git a/docs/kcl/types.md b/docs/kcl/types.md index ee38dd6074..32a1a1a808 100644 --- a/docs/kcl/types.md +++ b/docs/kcl/types.md @@ -1,4 +1,8 @@ -# Types +--- +title: "KCL Types" +excerpt: "Documentation of types for the KCL standard library for the Zoo Modeling App." +layout: manual +--- `KCL` defines the following types and keywords the language. diff --git a/docs/kcl/xLine.md b/docs/kcl/xLine.md new file mode 100644 index 0000000000..631953405f --- /dev/null +++ b/docs/kcl/xLine.md @@ -0,0 +1,371 @@ +--- +title: "xLine" +excerpt: "Draw a line on the x-axis." +layout: manual +--- + +Draw a line on the x-axis. + + + +``` +xLine(data: AxisLineData, sketch_group: SketchGroup) -> SketchGroup +``` + +### Examples + +```kcl +startSketchOn('YZ') + |> startProfileAt([0, 0], %) + |> xLine(10, %) + |> line([10, 10], %) + |> close(%, "edge1") + |> extrude(10, %) +``` + +### Arguments + +* `data`: `AxisLineData` - Data to draw a line on an axis. (REQUIRED) +``` +{ + // The length of the line. + length: number, + // The tag. + tag: string, +} | +number +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/xLineTo.md b/docs/kcl/xLineTo.md new file mode 100644 index 0000000000..b54487d0f4 --- /dev/null +++ b/docs/kcl/xLineTo.md @@ -0,0 +1,371 @@ +--- +title: "xLineTo" +excerpt: "Draw a line to a point on the x-axis." +layout: manual +--- + +Draw a line to a point on the x-axis. + + + +``` +xLineTo(data: AxisLineToData, sketch_group: SketchGroup) -> SketchGroup +``` + +### Examples + +```kcl +startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> xLineTo({ to: 10, tag: "edge1" }, %) + |> line([10, 10], %) + |> close(%, "edge2") + |> extrude(10, %) +``` + +### Arguments + +* `data`: `AxisLineToData` - Data to draw a line to a point on an axis. (REQUIRED) +``` +{ + // The tag. + tag: string, + // The to point. + to: number, +} | +number +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/yLine.md b/docs/kcl/yLine.md new file mode 100644 index 0000000000..23f71b403f --- /dev/null +++ b/docs/kcl/yLine.md @@ -0,0 +1,371 @@ +--- +title: "yLine" +excerpt: "Draw a line on the y-axis." +layout: manual +--- + +Draw a line on the y-axis. + + + +``` +yLine(data: AxisLineData, sketch_group: SketchGroup) -> SketchGroup +``` + +### Examples + +```kcl +startSketchOn('XY') + |> startProfileAt([0, 0], %) + |> yLine(10, %) + |> line([10, 10], %) + |> close(%, "edge1") + |> extrude(10, %) +``` + +### Arguments + +* `data`: `AxisLineData` - Data to draw a line on an axis. (REQUIRED) +``` +{ + // The length of the line. + length: number, + // The tag. + tag: string, +} | +number +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/docs/kcl/yLineTo.md b/docs/kcl/yLineTo.md new file mode 100644 index 0000000000..58db8deba9 --- /dev/null +++ b/docs/kcl/yLineTo.md @@ -0,0 +1,372 @@ +--- +title: "yLineTo" +excerpt: "Draw a line to a point on the y-axis." +layout: manual +--- + +Draw a line to a point on the y-axis. + + + +``` +yLineTo(data: AxisLineToData, sketch_group: SketchGroup) -> SketchGroup +``` + +### Examples + +```kcl +startSketchOn('XZ') + |> startProfileAt([0, 0], %) + |> yLineTo({ to: 10, tag: "edge1" }, %) + |> line([10, 10], %) + |> close(%, "edge2") + |> extrude(10, %) + |> fillet({ radius: 2, tags: ["edge2"] }, %) +``` + +### Arguments + +* `data`: `AxisLineToData` - Data to draw a line to a point on an axis. (REQUIRED) +``` +{ + // The tag. + tag: string, + // The to point. + to: number, +} | +number +``` +* `sketch_group`: `SketchGroup` - A sketch group is a collection of paths. (REQUIRED) +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + +### Returns + +`SketchGroup` - A sketch group is a collection of paths. +``` +{ + // The plane id or face id of the sketch group. + entityId: uuid, + // The id of the sketch group. + id: uuid, + // What the sketch is on (can be a plane or a face). + on: { + // The id of the plane. + id: uuid, + // Origin of the plane. + origin: { + x: number, + y: number, + z: number, +}, + type: "plane", + // Type for a plane. + value: "XY" | "XZ" | "YZ" | "Custom", + // What should the plane’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the plane’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +} | +{ + // The id of the face. + id: uuid, + // The original sketch group id of the object we are sketching on. + sketchGroupId: uuid, + type: "face", + // The tag of the face. + value: string, + // What should the face’s X axis be? + xAxis: { + x: number, + y: number, + z: number, +}, + // What should the face’s Y axis be? + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis (normal). + zAxis: { + x: number, + y: number, + z: number, +}, +}, + // The position of the sketch group. + position: [number, number, number], + // The rotation of the sketch group base plane. + rotation: [number, number, number, number], + // The starting path. + start: { + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], +}, + // The paths in the sketch group. + value: [{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "ToPoint", +} | +{ + // arc's direction + ccw: string, + // the arc's center + center: [number, number], + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArcTo", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "TangentialArc", +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Horizontal", + // The x coordinate. + x: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "AngledLineTo", + // The x coordinate. + x: number, + // The y coordinate. + y: number, +} | +{ + // The from point. + from: [number, number], + // The name of the path. + name: string, + // The to point. + to: [number, number], + type: "Base", +}], + // The x-axis of the sketch group base plane in the 3D space + xAxis: { + x: number, + y: number, + z: number, +}, + // The y-axis of the sketch group base plane in the 3D space + yAxis: { + x: number, + y: number, + z: number, +}, + // The z-axis of the sketch group base plane in the 3D space + zAxis: { + x: number, + y: number, + z: number, +}, +} +``` + + + diff --git a/public/expectations.md b/public/expectations.md index 0dcdb5b844..6e504edc5b 100644 --- a/public/expectations.md +++ b/public/expectations.md @@ -23,7 +23,7 @@ Plenty of you have professional CAD experience, and may not understand why codin Before you dive straight into the app, we wanted to lay some expectations out for you. - ZMA is in early development. Kurt pitched the idea back in January, and the team has been working hard on it since then. ZMA has really basic CAD features for now, but we have plenty of features on our roadmap. Most of the features that you may be currently used to in your CAD workflow today will be available down the road. -- For a list of all scripting functions, please reference our [documentation](https://github.com/KittyCAD/modeling-app/blob/main/docs/kcl/std.md). For a basic rundown of our types, please reference [this document](https://github.com/KittyCAD/modeling-app/blob/main/docs/kcl/types.md). +- For a list of all scripting functions, please reference our [documentation](https://github.com/KittyCAD/modeling-app/blob/main/docs/kcl/index.md). For a basic rundown of our types, please reference [this document](https://github.com/KittyCAD/modeling-app/blob/main/docs/kcl/types.md). - With that being said, we have created an external new features list in [GH Discussions](https://github.com/KittyCAD/modeling-app/discussions). For our current priority list, please click [here](https://github.com/KittyCAD/modeling-app/blob/main/public/roadmap.md). Please upvote any features in the GH Discussions page that you would like to see implemented first. We will prioritize the highest upvoted items or items that are foundational for other features on the list. You can also add your own, but we will review it to make sure it’s not a duplicate or it’s feasible for the current state of the app. - Please report any and all bugs/issues you find. Even the smallest bugs are important! You can report them in a GH Issue [here](https://github.com/KittyCAD/modeling-app/issues/new). You are more than welcome to link your GH Issue in the **bugs** section of our Discord, but if you want to discuss the bug further, please keep that in the GH Issue thread. Please include the severity of the bug in your GH Issue ticket (High, Medium, or Low). If you are having trouble deciding what severity the bug is, use this guideline: - **High:** The bug is blocking you from continuing. diff --git a/src/components/CodeMenu.tsx b/src/components/CodeMenu.tsx index d544b55894..153a01ee72 100644 --- a/src/components/CodeMenu.tsx +++ b/src/components/CodeMenu.tsx @@ -59,7 +59,7 @@ export const CodeMenu = ({ children }: PropsWithChildren) => { diff --git a/src/routes/Onboarding/CodeEditor.tsx b/src/routes/Onboarding/CodeEditor.tsx index f9b1b2e4e4..88dbfc6209 100644 --- a/src/routes/Onboarding/CodeEditor.tsx +++ b/src/routes/Onboarding/CodeEditor.tsx @@ -40,7 +40,7 @@ export default function CodeEditor() { in kcl before they're available as point-and-click tools, so it's good to have a link to{' '} diff --git a/src/wasm-lib/Cargo.lock b/src/wasm-lib/Cargo.lock index 970c58143f..06b87f8e22 100644 --- a/src/wasm-lib/Cargo.lock +++ b/src/wasm-lib/Cargo.lock @@ -963,6 +963,23 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "derive-docs" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4e18a04fe569a325dd50743821f2605057ff5c4b48e60512270b4406907825b" +dependencies = [ + "Inflector", + "convert_case", + "once_cell", + "proc-macro2", + "quote", + "regex", + "serde", + "serde_tokenstream", + "syn 2.0.52", +] + [[package]] name = "diesel_derives" version = "2.1.2" @@ -1904,7 +1921,7 @@ dependencies = [ "criterion", "dashmap", "databake", - "derive-docs", + "derive-docs 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "expectorate", "futures", "gltf-json", diff --git a/src/wasm-lib/kcl/Cargo.toml b/src/wasm-lib/kcl/Cargo.toml index 2b0cb695ab..7b0f56f228 100644 --- a/src/wasm-lib/kcl/Cargo.toml +++ b/src/wasm-lib/kcl/Cargo.toml @@ -18,8 +18,8 @@ chrono = "0.4.35" clap = { version = "4.5.2", features = ["cargo", "derive", "env", "unicode"], optional = true } dashmap = "5.5.3" databake = { version = "0.1.7", features = ["derive"] } -#derive-docs = { version = "0.1.11" } -derive-docs = { path = "../derive-docs" } +derive-docs = { version = "0.1.11" } +#derive-docs = { path = "../derive-docs" } futures = { version = "0.3.30" } gltf-json = "1.4.0" kittycad = { workspace = true } diff --git a/src/wasm-lib/kcl/src/std/mod.rs b/src/wasm-lib/kcl/src/std/mod.rs index 849e584b01..60dc7fec70 100644 --- a/src/wasm-lib/kcl/src/std/mod.rs +++ b/src/wasm-lib/kcl/src/std/mod.rs @@ -835,14 +835,25 @@ mod tests { let combined = stdlib.combined(); let mut buf = String::new(); - buf.push_str("\n\n"); + buf.push_str( + r#"--- +title: "KCL Standard Library" +excerpt: "Documentation for the KCL standard library for the Zoo Modeling App." +layout: manual +--- + +"#, + ); buf.push_str("# KCL Standard Library\n\n"); + buf.push_str("## Types\n\n"); + // Generate a table of contents. buf.push_str("## Table of Contents\n\n"); - buf.push_str("* [Functions](#functions)\n"); + buf.push_str("* [Types](types.md)\n"); + buf.push_str("* [Known Issues](KNOWN-ISSUES.md)\n"); for key in combined.keys().sorted() { let internal_fn = combined.get(key).unwrap(); @@ -850,14 +861,14 @@ mod tests { continue; } - buf.push_str(&format!("\t* [`{}`](#{})\n", internal_fn.name(), internal_fn.name())); + buf.push_str(&format!("* [`{}`]({}.md)\n", internal_fn.name(), internal_fn.name())); } - buf.push_str("\n\n"); - - buf.push_str("## Functions\n\n"); + // Write the index. + expectorate::assert_contents("../../../docs/kcl/index.md", &buf); for key in combined.keys().sorted() { + let mut buf = String::new(); let internal_fn = combined.get(key).unwrap(); if internal_fn.unpublished() { continue; @@ -865,10 +876,20 @@ mod tests { let mut fn_docs = String::new(); + fn_docs.push_str(&format!( + r#"--- +title: "{}" +excerpt: "{}" +layout: manual +--- + +"#, + internal_fn.name(), + internal_fn.summary() + )); + if internal_fn.deprecated() { - fn_docs.push_str(&format!("### {} DEPRECATED\n\n", internal_fn.name())); - } else { - fn_docs.push_str(&format!("### {}\n\n", internal_fn.name())); + fn_docs.push_str("**WARNING:** This function is deprecated.\n\n"); } fn_docs.push_str(&format!("{}\n\n", internal_fn.summary())); @@ -880,7 +901,7 @@ mod tests { fn_docs.push_str("\n```\n\n"); if !internal_fn.examples().is_empty() { - fn_docs.push_str("#### Examples\n\n"); + fn_docs.push_str("### Examples\n\n"); for example in internal_fn.examples() { fn_docs.push_str("```kcl\n"); @@ -889,7 +910,7 @@ mod tests { } } - fn_docs.push_str("#### Arguments\n\n"); + fn_docs.push_str("### Arguments\n\n"); for arg in internal_fn.args() { let (format, should_be_indented) = arg.get_type_string().unwrap(); let optional_string = if arg.required { " (REQUIRED)" } else { " (OPTIONAL)" }.to_string(); @@ -908,11 +929,11 @@ mod tests { } if let Some(return_type) = internal_fn.return_value() { - fn_docs.push_str("\n#### Returns\n\n"); + fn_docs.push_str("\n### Returns\n\n"); if let Some(description) = return_type.description() { - fn_docs.push_str(&format!("* `{}` - {}\n", return_type.type_, description)); + fn_docs.push_str(&format!("`{}` - {}\n", return_type.type_, description)); } else { - fn_docs.push_str(&format!("* `{}`\n", return_type.type_)); + fn_docs.push_str(&format!("`{}`\n", return_type.type_)); } let (format, should_be_indented) = return_type.get_type_string().unwrap(); @@ -924,9 +945,10 @@ mod tests { fn_docs.push_str("\n\n\n"); buf.push_str(&fn_docs); - } - expectorate::assert_contents("../../../docs/kcl/std.md", &buf); + // Write the file. + expectorate::assert_contents(&format!("../../../docs/kcl/{}.md", internal_fn.name()), &buf); + } } #[test]