Compare commits
106 Commits
jtran/fix-
...
v0.47.0
Author | SHA1 | Date | |
---|---|---|---|
d6ad4b6e66 | |||
546b4ea3b8 | |||
310932dc5a | |||
51459bb413 | |||
e00dae11ba | |||
831c7f764a | |||
ec4ad268f7 | |||
be640ea0bd | |||
f8ceab2233 | |||
aea82e004a | |||
bc3a0e3896 | |||
be69039d40 | |||
2c6d69497c | |||
18db3783af | |||
b536040feb | |||
dd45cd4ef9 | |||
25cc5581be | |||
f7c192b64b | |||
faae169154 | |||
c74b9ba940 | |||
6cce3cda36 | |||
5d25f4a0e5 | |||
79d37d360a | |||
69553fded7 | |||
200a9af61f | |||
2696ddb996 | |||
4e1b0daacb | |||
8aa46099a8 | |||
00ff6371ed | |||
b947dad6e9 | |||
c13bdbb749 | |||
e500fad0e1 | |||
bcac4d3798 | |||
63897bd60e | |||
d429e868ac | |||
faa51ddc18 | |||
c28eb360c0 | |||
69cac17543 | |||
50c7356b6a | |||
37715d9fa8 | |||
e8af61e11f | |||
de85c31e71 | |||
725c56ea6f | |||
1b958ee29f | |||
4b0f67e604 | |||
8ba1a5cd4d | |||
df278c7e6a | |||
6e57a80c13 | |||
efe6565857 | |||
fa0a34585b | |||
dec74f633b | |||
dfcea282ec | |||
191dcf8bb0 | |||
cb1bbe4660 | |||
ff66cb1deb | |||
ab46349d63 | |||
cffad78bf7 | |||
bfb81877d3 | |||
c56398db83 | |||
36e0d35968 | |||
62bf7d8715 | |||
a4db302174 | |||
66f3500ca9 | |||
c3bdc6f106 | |||
0a2bf4b55f | |||
bbae9b6363 | |||
180d52280d | |||
dce1dca7c7 | |||
343f6572a2 | |||
c8e58d49e0 | |||
c18546fb2f | |||
466c23a9d8 | |||
8403025c77 | |||
9ce591a1a1 | |||
f238f3882b | |||
a91208eb1c | |||
b92b0a9afe | |||
964347f43a | |||
3811c88b5c | |||
69a1473197 | |||
1f1e996cfa | |||
58167deda7 | |||
83d22a4f5f | |||
7003b19a70 | |||
687ef1429d | |||
b1b00a9a22 | |||
a0924bcfa3 | |||
5ce22e2de8 | |||
850c5c62d1 | |||
b31786c9ab | |||
936549d60f | |||
0babbcff49 | |||
02c2e80b31 | |||
da236d9a3e | |||
1104d908c0 | |||
2efea3ec06 | |||
775007ef0d | |||
f490e7d6fe | |||
89bc93e4cd | |||
12edb6375d | |||
8d9bba02d6 | |||
56e100fad7 | |||
38f7a4089e | |||
91f5465e2d | |||
58a9c60d0b | |||
725c4d95f8 |
@ -1,3 +1,3 @@
|
|||||||
[codespell]
|
[codespell]
|
||||||
ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,atleast,ue,afterall,ser
|
ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,atleast,ue,afterall,ser
|
||||||
skip: **/target,node_modules,build,dist,./out,**/Cargo.lock,./docs/kcl/*.md,.yarn.lock,**/yarn.lock,./openapi/*.json,./packages/codemirror-lang-kcl/test/all.test.ts,tsconfig.tsbuildinfo
|
skip: **/target,node_modules,build,dist,./out,**/Cargo.lock,./docs/kcl/*.md,.yarn.lock,**/yarn.lock,./openapi/*.json,./packages/codemirror-lang-kcl/test/all.test.ts,./public/kcl-samples,./rust/kcl-lib/tests/kcl_samples,tsconfig.tsbuildinfo
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
src/wasm-lib/*
|
rust/**/*.ts
|
||||||
|
!rust/kcl-language-server/client/src/**/*.ts
|
||||||
*.typegen.ts
|
*.typegen.ts
|
||||||
packages/codemirror-lsp-client/dist/*
|
packages/codemirror-lsp-client/dist/*
|
||||||
|
e2e/playwright/snapshots/prompt-to-edit/*
|
||||||
|
.vscode-test
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"project": "./tsconfig.json"
|
"project": "./tsconfig.json"
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": [
|
||||||
|
"react-perf",
|
||||||
"css-modules",
|
"css-modules",
|
||||||
"jest",
|
"jest",
|
||||||
"jsx-a11y",
|
"jsx-a11y",
|
||||||
|
8
.github/actions/github-release/Dockerfile
vendored
Normal file
8
.github/actions/github-release/Dockerfile
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
FROM node:slim
|
||||||
|
|
||||||
|
COPY . /action
|
||||||
|
WORKDIR /action
|
||||||
|
|
||||||
|
RUN npm install --production
|
||||||
|
|
||||||
|
ENTRYPOINT ["node", "/action/main.js"]
|
21
.github/actions/github-release/README.md
vendored
Normal file
21
.github/actions/github-release/README.md
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# github-release
|
||||||
|
|
||||||
|
Copy-pasted from
|
||||||
|
https://github.com/bytecodealliance/wasmtime/tree/8acfdbdd8aa550d1b84e0ce1e6222a6605d14e38/.github/actions/github-release
|
||||||
|
|
||||||
|
An action used to publish GitHub releases for `wasmtime`.
|
||||||
|
|
||||||
|
As of the time of this writing there's a few actions floating around which
|
||||||
|
perform github releases but they all tend to have their set of drawbacks.
|
||||||
|
Additionally nothing handles deleting releases which we need for our rolling
|
||||||
|
`dev` release.
|
||||||
|
|
||||||
|
To handle all this, this action rolls its own implementation using the
|
||||||
|
actions/toolkit repository and packages published there. These run in a Docker
|
||||||
|
container and take various inputs to orchestrate the release from the build.
|
||||||
|
|
||||||
|
More comments can be found in `main.js`.
|
||||||
|
|
||||||
|
Testing this is really hard. If you want to try though run `npm install` and
|
||||||
|
then `node main.js`. You'll have to configure a bunch of env vars though to get
|
||||||
|
anything reasonably working.
|
15
.github/actions/github-release/action.yml
vendored
Normal file
15
.github/actions/github-release/action.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
name: "wasmtime github releases"
|
||||||
|
description: "wasmtime github releases"
|
||||||
|
inputs:
|
||||||
|
token:
|
||||||
|
description: ""
|
||||||
|
required: true
|
||||||
|
name:
|
||||||
|
description: ""
|
||||||
|
required: true
|
||||||
|
files:
|
||||||
|
description: ""
|
||||||
|
required: true
|
||||||
|
runs:
|
||||||
|
using: "docker"
|
||||||
|
image: "Dockerfile"
|
143
.github/actions/github-release/main.js
vendored
Normal file
143
.github/actions/github-release/main.js
vendored
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
const core = require("@actions/core");
|
||||||
|
const path = require("path");
|
||||||
|
const fs = require("fs");
|
||||||
|
const github = require("@actions/github");
|
||||||
|
const glob = require("glob");
|
||||||
|
|
||||||
|
function sleep(milliseconds) {
|
||||||
|
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function runOnce() {
|
||||||
|
// Load all our inputs and env vars. Note that `getInput` reads from `INPUT_*`
|
||||||
|
const files = core.getInput("files");
|
||||||
|
const name = core.getInput("name");
|
||||||
|
const token = core.getInput("token");
|
||||||
|
const slug = process.env.GITHUB_REPOSITORY;
|
||||||
|
const owner = slug.split("/")[0];
|
||||||
|
const repo = slug.split("/")[1];
|
||||||
|
const sha = process.env.HEAD_SHA;
|
||||||
|
|
||||||
|
core.info(`files: ${files}`);
|
||||||
|
core.info(`name: ${name}`);
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
request: {
|
||||||
|
timeout: 30000,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const octokit = github.getOctokit(token, options);
|
||||||
|
|
||||||
|
// Delete the previous release since we can't overwrite one. This may happen
|
||||||
|
// due to retrying an upload or it may happen because we're doing the dev
|
||||||
|
// release.
|
||||||
|
const releases = await octokit.paginate("GET /repos/:owner/:repo/releases", { owner, repo });
|
||||||
|
for (const release of releases) {
|
||||||
|
if (release.tag_name !== name) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const release_id = release.id;
|
||||||
|
core.info(`deleting release ${release_id}`);
|
||||||
|
await octokit.rest.repos.deleteRelease({ owner, repo, release_id });
|
||||||
|
}
|
||||||
|
|
||||||
|
// We also need to update the `dev` tag while we're at it on the `dev` branch.
|
||||||
|
if (name == "nightly") {
|
||||||
|
try {
|
||||||
|
core.info(`updating nightly tag`);
|
||||||
|
await octokit.rest.git.updateRef({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
ref: "tags/nightly",
|
||||||
|
sha,
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
core.error(e);
|
||||||
|
core.info(`creating nightly tag`);
|
||||||
|
await octokit.rest.git.createTag({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
tag: "nightly",
|
||||||
|
message: "nightly release",
|
||||||
|
object: sha,
|
||||||
|
type: "commit",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creates an official GitHub release for this `tag`, and if this is `dev`
|
||||||
|
// then we know that from the previous block this should be a fresh release.
|
||||||
|
core.info(`creating a release`);
|
||||||
|
const release = await octokit.rest.repos.createRelease({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
name,
|
||||||
|
tag_name: name,
|
||||||
|
target_commitish: sha,
|
||||||
|
prerelease: name === "nightly",
|
||||||
|
});
|
||||||
|
const release_id = release.data.id;
|
||||||
|
|
||||||
|
// Upload all the relevant assets for this release as just general blobs.
|
||||||
|
for (const file of glob.sync(files)) {
|
||||||
|
const size = fs.statSync(file).size;
|
||||||
|
const name = path.basename(file);
|
||||||
|
|
||||||
|
await runWithRetry(async function () {
|
||||||
|
// We can't overwrite assets, so remove existing ones from a previous try.
|
||||||
|
let assets = await octokit.rest.repos.listReleaseAssets({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
release_id,
|
||||||
|
});
|
||||||
|
for (const asset of assets.data) {
|
||||||
|
if (asset.name === name) {
|
||||||
|
core.info(`delete asset ${name}`);
|
||||||
|
const asset_id = asset.id;
|
||||||
|
await octokit.rest.repos.deleteReleaseAsset({ owner, repo, asset_id });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
core.info(`upload ${file}`);
|
||||||
|
const headers = { "content-length": size, "content-type": "application/octet-stream" };
|
||||||
|
const data = fs.createReadStream(file);
|
||||||
|
await octokit.rest.repos.uploadReleaseAsset({
|
||||||
|
data,
|
||||||
|
headers,
|
||||||
|
name,
|
||||||
|
url: release.data.upload_url,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function runWithRetry(f) {
|
||||||
|
const retries = 10;
|
||||||
|
const maxDelay = 4000;
|
||||||
|
let delay = 1000;
|
||||||
|
|
||||||
|
for (let i = 0; i < retries; i++) {
|
||||||
|
try {
|
||||||
|
await f();
|
||||||
|
break;
|
||||||
|
} catch (e) {
|
||||||
|
if (i === retries - 1) throw e;
|
||||||
|
|
||||||
|
core.error(e);
|
||||||
|
const currentDelay = Math.round(Math.random() * delay);
|
||||||
|
core.info(`sleeping ${currentDelay} ms`);
|
||||||
|
await sleep(currentDelay);
|
||||||
|
delay = Math.min(delay * 2, maxDelay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function run() {
|
||||||
|
await runWithRetry(runOnce);
|
||||||
|
}
|
||||||
|
|
||||||
|
run().catch((err) => {
|
||||||
|
core.error(err);
|
||||||
|
core.setFailed(err.message);
|
||||||
|
});
|
10
.github/actions/github-release/package.json
vendored
Normal file
10
.github/actions/github-release/package.json
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"name": "wasmtime-github-release",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"main": "main.js",
|
||||||
|
"dependencies": {
|
||||||
|
"@actions/core": "^1.6",
|
||||||
|
"@actions/github": "^5.0",
|
||||||
|
"glob": "^7.1.5"
|
||||||
|
}
|
||||||
|
}
|
350
.github/dependabot.yml
vendored
350
.github/dependabot.yml
vendored
@ -1,41 +1,331 @@
|
|||||||
# To get started with Dependabot version updates, you'll need to specify which
|
# DO NOT EDIT THIS FILE. This dependabot file was generated
|
||||||
# package ecosystems to update and where the package manifests are located.
|
# by https://github.com/KittyCAD/ciso Changes to this file should be addressed in
|
||||||
# Please see the documentation for all configuration options:
|
# the ciso repository.
|
||||||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
||||||
|
|
||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
- package-ecosystem: 'npm' # See documentation for possible values
|
- package-ecosystem: github-actions
|
||||||
directories:
|
directory: /
|
||||||
- '/'
|
|
||||||
- '/packages/codemirror-lang-kcl/'
|
|
||||||
- '/packages/codemirror-lsp-client/'
|
|
||||||
schedule:
|
schedule:
|
||||||
interval: weekly
|
interval: weekly
|
||||||
day: monday
|
day: monday
|
||||||
|
time: '03:00'
|
||||||
|
timezone: America/Los_Angeles
|
||||||
|
open-pull-requests-limit: 5
|
||||||
|
groups:
|
||||||
|
security:
|
||||||
|
applies-to: security-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
patch:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- patch
|
||||||
|
major:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
minor:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
- package-ecosystem: cargo
|
||||||
|
directory: /rust
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: monday
|
||||||
|
time: '03:00'
|
||||||
|
timezone: America/Los_Angeles
|
||||||
|
open-pull-requests-limit: 5
|
||||||
reviewers:
|
reviewers:
|
||||||
|
- adamchalmers
|
||||||
- franknoirot
|
- franknoirot
|
||||||
- irev-dev
|
- irev-dev
|
||||||
- package-ecosystem: 'github-actions' # See documentation for possible values
|
|
||||||
directory: '/' # Location of package manifests
|
|
||||||
schedule:
|
|
||||||
interval: weekly
|
|
||||||
day: monday
|
|
||||||
reviewers:
|
|
||||||
- adamchalmers
|
|
||||||
- jessfraz
|
|
||||||
- package-ecosystem: 'cargo' # See documentation for possible values
|
|
||||||
directory: '/src/wasm-lib/' # Location of package manifests
|
|
||||||
schedule:
|
|
||||||
interval: weekly
|
|
||||||
day: monday
|
|
||||||
reviewers:
|
|
||||||
- adamchalmers
|
|
||||||
- jessfraz
|
- jessfraz
|
||||||
groups:
|
groups:
|
||||||
serde-dependencies:
|
security:
|
||||||
patterns:
|
applies-to: security-updates
|
||||||
- "serde*"
|
update-types:
|
||||||
wasm-bindgen-deps:
|
- major
|
||||||
patterns:
|
- minor
|
||||||
- "wasm-bindgen*"
|
- patch
|
||||||
|
patch:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- patch
|
||||||
|
major:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
minor:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
- package-ecosystem: npm
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: monday
|
||||||
|
time: '03:00'
|
||||||
|
timezone: America/Los_Angeles
|
||||||
|
open-pull-requests-limit: 5
|
||||||
|
reviewers:
|
||||||
|
- adamchalmers
|
||||||
|
- franknoirot
|
||||||
|
- irev-dev
|
||||||
|
- jessfraz
|
||||||
|
groups:
|
||||||
|
security:
|
||||||
|
applies-to: security-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
patch:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- patch
|
||||||
|
major:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
minor:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
- package-ecosystem: npm
|
||||||
|
directory: /rust/kcl-language-server
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: monday
|
||||||
|
time: '03:00'
|
||||||
|
timezone: America/Los_Angeles
|
||||||
|
open-pull-requests-limit: 5
|
||||||
|
reviewers:
|
||||||
|
- adamchalmers
|
||||||
|
- franknoirot
|
||||||
|
- irev-dev
|
||||||
|
- jessfraz
|
||||||
|
groups:
|
||||||
|
security:
|
||||||
|
applies-to: security-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
patch:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- patch
|
||||||
|
major:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
minor:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
- package-ecosystem: npm
|
||||||
|
directory: /packages/codemirror-lang-kcl
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: monday
|
||||||
|
time: '03:00'
|
||||||
|
timezone: America/Los_Angeles
|
||||||
|
open-pull-requests-limit: 5
|
||||||
|
reviewers:
|
||||||
|
- adamchalmers
|
||||||
|
- franknoirot
|
||||||
|
- irev-dev
|
||||||
|
- jessfraz
|
||||||
|
groups:
|
||||||
|
security:
|
||||||
|
applies-to: security-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
patch:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- patch
|
||||||
|
major:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
minor:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
- package-ecosystem: npm
|
||||||
|
directory: /packages/codemirror-lsp-client
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: monday
|
||||||
|
time: '03:00'
|
||||||
|
timezone: America/Los_Angeles
|
||||||
|
open-pull-requests-limit: 5
|
||||||
|
reviewers:
|
||||||
|
- adamchalmers
|
||||||
|
- franknoirot
|
||||||
|
- irev-dev
|
||||||
|
- jessfraz
|
||||||
|
groups:
|
||||||
|
security:
|
||||||
|
applies-to: security-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
patch:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- patch
|
||||||
|
major:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
minor:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
- package-ecosystem: npm
|
||||||
|
directory: /.github/actions/github-release
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: monday
|
||||||
|
time: '03:00'
|
||||||
|
timezone: America/Los_Angeles
|
||||||
|
open-pull-requests-limit: 5
|
||||||
|
reviewers:
|
||||||
|
- adamchalmers
|
||||||
|
- franknoirot
|
||||||
|
- irev-dev
|
||||||
|
- jessfraz
|
||||||
|
groups:
|
||||||
|
security:
|
||||||
|
applies-to: security-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
patch:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- patch
|
||||||
|
major:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
minor:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
- package-ecosystem: pip
|
||||||
|
directory: /public/kcl-samples
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: monday
|
||||||
|
time: '03:00'
|
||||||
|
timezone: America/Los_Angeles
|
||||||
|
open-pull-requests-limit: 5
|
||||||
|
reviewers:
|
||||||
|
- adamchalmers
|
||||||
|
- franknoirot
|
||||||
|
- irev-dev
|
||||||
|
- jessfraz
|
||||||
|
groups:
|
||||||
|
security:
|
||||||
|
applies-to: security-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
patch:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- patch
|
||||||
|
major:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
minor:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
- package-ecosystem: pip
|
||||||
|
directory: /rust/kcl-python-bindings
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: monday
|
||||||
|
time: '03:00'
|
||||||
|
timezone: America/Los_Angeles
|
||||||
|
open-pull-requests-limit: 5
|
||||||
|
reviewers:
|
||||||
|
- adamchalmers
|
||||||
|
- franknoirot
|
||||||
|
- irev-dev
|
||||||
|
- jessfraz
|
||||||
|
groups:
|
||||||
|
security:
|
||||||
|
applies-to: security-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
patch:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- patch
|
||||||
|
major:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
minor:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
- package-ecosystem: docker
|
||||||
|
directory: /.github/actions/github-release
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: monday
|
||||||
|
time: '03:00'
|
||||||
|
timezone: America/Los_Angeles
|
||||||
|
open-pull-requests-limit: 5
|
||||||
|
reviewers:
|
||||||
|
- adamchalmers
|
||||||
|
- franknoirot
|
||||||
|
- irev-dev
|
||||||
|
- jessfraz
|
||||||
|
groups:
|
||||||
|
security:
|
||||||
|
applies-to: security-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
patch:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- patch
|
||||||
|
major:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- major
|
||||||
|
minor:
|
||||||
|
applies-to: version-updates
|
||||||
|
update-types:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
20
.github/workflows/build-and-store-wasm.yml
vendored
20
.github/workflows/build-and-store-wasm.yml
vendored
@ -16,15 +16,21 @@ jobs:
|
|||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn
|
run: yarn
|
||||||
- name: Setup Rust
|
- name: Use correct Rust toolchain
|
||||||
uses: dtolnay/rust-toolchain@stable
|
shell: bash
|
||||||
- name: Cache wasm
|
run: |
|
||||||
uses: Swatinem/rust-cache@v2
|
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
|
||||||
|
- name: Install rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
workspaces: './src/wasm-lib'
|
cache: false # Configured below.
|
||||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
||||||
with:
|
with:
|
||||||
tool: wasm-pack
|
tool: wasm-pack
|
||||||
|
- name: Rust Cache
|
||||||
|
uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
workspaces: rust
|
||||||
- name: build wasm
|
- name: build wasm
|
||||||
run: yarn build:wasm
|
run: yarn build:wasm
|
||||||
|
|
||||||
@ -33,4 +39,4 @@ jobs:
|
|||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: wasm-bundle
|
name: wasm-bundle
|
||||||
path: src/wasm-lib/pkg
|
path: rust/kcl-wasm-lib/pkg
|
||||||
|
40
.github/workflows/build-apps.yml
vendored
40
.github/workflows/build-apps.yml
vendored
@ -33,18 +33,25 @@ jobs:
|
|||||||
|
|
||||||
- run: yarn install
|
- run: yarn install
|
||||||
|
|
||||||
- name: Setup Rust
|
- name: Use correct Rust toolchain
|
||||||
uses: dtolnay/rust-toolchain@stable
|
shell: bash
|
||||||
|
run: |
|
||||||
- uses: Swatinem/rust-cache@v2
|
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
|
||||||
|
- name: Install rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
workspaces: './src/wasm-lib'
|
cache: false # Configured below.
|
||||||
|
|
||||||
# TODO: see if we can fetch from main instead if no diff at src/wasm-lib
|
# TODO: see if we can fetch from main instead if no diff at rust
|
||||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
||||||
with:
|
with:
|
||||||
tool: wasm-pack
|
tool: wasm-pack
|
||||||
|
|
||||||
|
- name: Rust Cache
|
||||||
|
uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
workspaces: rust
|
||||||
|
|
||||||
- name: Run build:wasm
|
- name: Run build:wasm
|
||||||
run: "yarn build:wasm"
|
run: "yarn build:wasm"
|
||||||
|
|
||||||
@ -67,7 +74,7 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
package.json
|
package.json
|
||||||
electron-builder.yml
|
electron-builder.yml
|
||||||
src/wasm-lib/pkg/wasm_lib*
|
rust/kcl-wasm-lib/pkg/kcl_wasm_lib*
|
||||||
release-notes.md
|
release-notes.md
|
||||||
assets/icon.ico
|
assets/icon.ico
|
||||||
assets/icon.png
|
assets/icon.png
|
||||||
@ -117,9 +124,9 @@ jobs:
|
|||||||
ls -R prepared-files
|
ls -R prepared-files
|
||||||
cp prepared-files/package.json package.json
|
cp prepared-files/package.json package.json
|
||||||
cp prepared-files/electron-builder.yml electron-builder.yml
|
cp prepared-files/electron-builder.yml electron-builder.yml
|
||||||
cp prepared-files/src/wasm-lib/pkg/wasm_lib_bg.wasm public
|
cp prepared-files/rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public
|
||||||
mkdir src/wasm-lib/pkg
|
mkdir rust/kcl-wasm-lib/pkg
|
||||||
cp prepared-files/src/wasm-lib/pkg/wasm_lib* src/wasm-lib/pkg
|
cp prepared-files/rust/kcl-wasm-lib/pkg/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
|
||||||
cp prepared-files/release-notes.md release-notes.md
|
cp prepared-files/release-notes.md release-notes.md
|
||||||
cp prepared-files/assets/icon.ico assets/icon.ico
|
cp prepared-files/assets/icon.ico assets/icon.ico
|
||||||
cp prepared-files/assets/icon.png assets/icon.png
|
cp prepared-files/assets/icon.png assets/icon.png
|
||||||
@ -132,8 +139,9 @@ jobs:
|
|||||||
|
|
||||||
- name: yarn install
|
- name: yarn install
|
||||||
# Windows is picky sometimes and fails on fetch. Step takes about ~30s
|
# Windows is picky sometimes and fails on fetch. Step takes about ~30s
|
||||||
uses: nick-fields/retry@v3.0.1
|
uses: nick-fields/retry@v3.0.2
|
||||||
with:
|
with:
|
||||||
|
shell: bash
|
||||||
timeout_minutes: 2
|
timeout_minutes: 2
|
||||||
max_attempts: 3
|
max_attempts: 3
|
||||||
command: yarn install
|
command: yarn install
|
||||||
@ -183,8 +191,9 @@ jobs:
|
|||||||
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
|
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
|
||||||
DEBUG: "electron-notarize*"
|
DEBUG: "electron-notarize*"
|
||||||
# TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures
|
# TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures
|
||||||
uses: nick-fields/retry@v3.0.1
|
uses: nick-fields/retry@v3.0.2
|
||||||
with:
|
with:
|
||||||
|
shell: bash
|
||||||
timeout_minutes: 10
|
timeout_minutes: 10
|
||||||
max_attempts: 3
|
max_attempts: 3
|
||||||
command: yarn tronb:package:prod
|
command: yarn tronb:package:prod
|
||||||
@ -244,8 +253,9 @@ jobs:
|
|||||||
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
|
WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }}
|
||||||
DEBUG: "electron-notarize*"
|
DEBUG: "electron-notarize*"
|
||||||
# TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures
|
# TODO: Fix electron-notarize flakes. The logs above should help gather more data on failures
|
||||||
uses: nick-fields/retry@v3.0.1
|
uses: nick-fields/retry@v3.0.2
|
||||||
with:
|
with:
|
||||||
|
shell: bash
|
||||||
timeout_minutes: 10
|
timeout_minutes: 10
|
||||||
max_attempts: 3
|
max_attempts: 3
|
||||||
command: yarn tronb:package:prod
|
command: yarn tronb:package:prod
|
||||||
@ -386,7 +396,7 @@ jobs:
|
|||||||
# see https://github.com/actions/checkout/issues/1471
|
# see https://github.com/actions/checkout/issues/1471
|
||||||
git fetch --prune --unshallow --tags
|
git fetch --prune --unshallow --tags
|
||||||
export TAG="nightly-${VERSION}"
|
export TAG="nightly-${VERSION}"
|
||||||
export PREVIOUS_TAG=$(git describe --tags --match="nightly-v[0-9]*" --abbrev=0)
|
export PREVIOUS_TAG=$(git tag --list --sort=-committerdate "nightly-v[0-9]*" | head -n2 | tail -n1)
|
||||||
export NOTES=$(./scripts/get-nightly-changelog.sh)
|
export NOTES=$(./scripts/get-nightly-changelog.sh)
|
||||||
yarn files:set-notes
|
yarn files:set-notes
|
||||||
|
|
||||||
|
52
.github/workflows/cargo-bench.yml
vendored
Normal file
52
.github/workflows/cargo-bench.yml
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- '**.rs'
|
||||||
|
- '**/Cargo.toml'
|
||||||
|
- '**/Cargo.lock'
|
||||||
|
- '**/rust-toolchain.toml'
|
||||||
|
- .github/workflows/cargo-bench.yml
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '**.rs'
|
||||||
|
- '**/Cargo.toml'
|
||||||
|
- '**/Cargo.lock'
|
||||||
|
- '**/rust-toolchain.toml'
|
||||||
|
- .github/workflows/cargo-bench.yml
|
||||||
|
workflow_dispatch:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
name: cargo bench
|
||||||
|
jobs:
|
||||||
|
cargo-bench:
|
||||||
|
name: cargo bench
|
||||||
|
runs-on: ubuntu-latest-8-cores
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Use correct Rust toolchain
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
|
||||||
|
- name: Install rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
cache: rust
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
cargo install cargo-criterion
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -y valgrind
|
||||||
|
- uses: boa-dev/criterion-compare-action@v3
|
||||||
|
with:
|
||||||
|
cwd: "rust"
|
||||||
|
defaultFeatures: true
|
||||||
|
# Needed. The name of the branch to compare with. This default uses the branch which is being pulled against
|
||||||
|
branchName: ${{ github.base_ref }}
|
||||||
|
env:
|
||||||
|
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
|
19
.github/workflows/cargo-check.yml
vendored
19
.github/workflows/cargo-check.yml
vendored
@ -17,23 +17,20 @@ jobs:
|
|||||||
cargocheck:
|
cargocheck:
|
||||||
name: cargo check
|
name: cargo check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
dir: ['src/wasm-lib']
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install latest rust
|
- name: Use correct Rust toolchain
|
||||||
uses: actions-rs/toolchain@v1
|
shell: bash
|
||||||
|
run: |
|
||||||
|
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
|
||||||
|
- name: Install rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
cache-workspaces: rust
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Rust Cache
|
|
||||||
uses: Swatinem/rust-cache@v2.6.1
|
|
||||||
|
|
||||||
- name: Run check
|
- name: Run check
|
||||||
run: |
|
run: |
|
||||||
cd "${{ matrix.dir }}"
|
cd rust
|
||||||
# We specifically want to test the disable-println feature
|
# We specifically want to test the disable-println feature
|
||||||
# Since it is not enabled by default, we need to specify it
|
# Since it is not enabled by default, we need to specify it
|
||||||
# This is used in kcl-lsp
|
# This is used in kcl-lsp
|
||||||
|
19
.github/workflows/cargo-clippy.yml
vendored
19
.github/workflows/cargo-clippy.yml
vendored
@ -23,25 +23,22 @@ jobs:
|
|||||||
cargoclippy:
|
cargoclippy:
|
||||||
name: cargo clippy
|
name: cargo clippy
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
dir: ['src/wasm-lib']
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: taiki-e/install-action@just
|
- uses: taiki-e/install-action@just
|
||||||
- name: Install latest rust
|
- name: Use correct Rust toolchain
|
||||||
uses: actions-rs/toolchain@v1
|
shell: bash
|
||||||
|
run: |
|
||||||
|
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
|
||||||
|
- name: Install rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
cache-workspaces: rust
|
||||||
override: true
|
|
||||||
components: clippy
|
components: clippy
|
||||||
|
|
||||||
- name: Rust Cache
|
|
||||||
uses: Swatinem/rust-cache@v2.6.1
|
|
||||||
|
|
||||||
- name: Run clippy
|
- name: Run clippy
|
||||||
run: |
|
run: |
|
||||||
cd "${{ matrix.dir }}"
|
cd rust
|
||||||
just lint
|
just lint
|
||||||
# If this fails, run "cargo check" to update Cargo.lock,
|
# If this fails, run "cargo check" to update Cargo.lock,
|
||||||
# then add Cargo.lock to the PR.
|
# then add Cargo.lock to the PR.
|
||||||
|
19
.github/workflows/cargo-fmt.yml
vendored
19
.github/workflows/cargo-fmt.yml
vendored
@ -26,23 +26,20 @@ jobs:
|
|||||||
cargofmt:
|
cargofmt:
|
||||||
name: cargo fmt
|
name: cargo fmt
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
dir: ['src/wasm-lib']
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install latest rust
|
- name: Use correct Rust toolchain
|
||||||
uses: actions-rs/toolchain@v1
|
shell: bash
|
||||||
|
run: |
|
||||||
|
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
|
||||||
|
- name: Install rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
cache-workspaces: rust
|
||||||
override: true
|
|
||||||
components: rustfmt
|
components: rustfmt
|
||||||
|
|
||||||
- name: Rust Cache
|
|
||||||
uses: Swatinem/rust-cache@v2.6.1
|
|
||||||
|
|
||||||
- name: Run cargo fmt
|
- name: Run cargo fmt
|
||||||
run: |
|
run: |
|
||||||
cd "${{ matrix.dir }}"
|
cd rust
|
||||||
cargo fmt -- --check
|
cargo fmt -- --check
|
||||||
shell: bash
|
shell: bash
|
||||||
|
111
.github/workflows/cargo-test.yml
vendored
111
.github/workflows/cargo-test.yml
vendored
@ -5,25 +5,35 @@ on:
|
|||||||
|
|
||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
permissions: read-all
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
name: cargo test of wasm-lib
|
name: cargo test
|
||||||
jobs:
|
jobs:
|
||||||
cargotest:
|
cargotest:
|
||||||
name: cargo test
|
name: cargo test
|
||||||
runs-on: ubuntu-latest-8-cores
|
runs-on: ubuntu-latest-8-cores
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
dir: ['src/wasm-lib']
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/create-github-app-token@v1
|
||||||
- name: Install latest rust
|
id: app-token
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
app-id: ${{ secrets.MODELING_APP_GH_APP_ID }}
|
||||||
override: true
|
private-key: ${{ secrets.MODELING_APP_GH_APP_PRIVATE_KEY }}
|
||||||
|
owner: ${{ github.repository_owner }}
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
|
- name: Use correct Rust toolchain
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
|
||||||
|
- name: Install rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
cache: false # Configured below.
|
||||||
- name: Install vector
|
- name: Install vector
|
||||||
run: |
|
run: |
|
||||||
curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh
|
curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh
|
||||||
@ -40,22 +50,95 @@ jobs:
|
|||||||
${HOME}/.vector/bin/vector --config /tmp/vector.toml &
|
${HOME}/.vector/bin/vector --config /tmp/vector.toml &
|
||||||
- uses: taiki-e/install-action@cargo-llvm-cov
|
- uses: taiki-e/install-action@cargo-llvm-cov
|
||||||
- uses: taiki-e/install-action@nextest
|
- uses: taiki-e/install-action@nextest
|
||||||
|
- name: Install just
|
||||||
|
uses: taiki-e/install-action@just
|
||||||
|
- name: Install cargo-insta
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cargo install cargo-insta
|
||||||
- name: Rust Cache
|
- name: Rust Cache
|
||||||
uses: Swatinem/rust-cache@v2.6.1
|
uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
workspaces: rust
|
||||||
|
- name: Fetch the base branch
|
||||||
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
|
run: git fetch origin ${{ github.base_ref }} --depth=1
|
||||||
|
- name: Check for path changes
|
||||||
|
id: path-changes
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Manual runs or push should run all tests.
|
||||||
|
if [[ ${{ github.event_name }} != 'pull_request' ]]; then
|
||||||
|
echo "outside-kcl-samples=true" >> $GITHUB_OUTPUT
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
changed_files=$(git diff --name-only origin/${{ github.base_ref }})
|
||||||
|
echo "$changed_files"
|
||||||
|
if grep -Evq '^public/kcl-samples/|^rust/kcl-lib/tests/kcl_samples/' <<< "$changed_files" ; then
|
||||||
|
echo "outside-kcl-samples=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "outside-kcl-samples=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
- name: cargo test only kcl-samples
|
||||||
|
id: cargo-test-kcl-samples
|
||||||
|
if: steps.path-changes.outputs.outside-kcl-samples == 'false'
|
||||||
|
continue-on-error: true
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
cd rust
|
||||||
|
cargo nextest run --workspace --retries=2 --no-fail-fast --profile ci simulation_tests::kcl_samples 2>&1 | tee /tmp/github-actions.log
|
||||||
|
env:
|
||||||
|
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
|
||||||
|
RUST_BACKTRACE: full
|
||||||
|
RUST_MIN_STACK: 10485760000
|
||||||
|
- name: Commit differences
|
||||||
|
if: steps.path-changes.outputs.outside-kcl-samples == 'false' && steps.cargo-test-kcl-samples.outcome == 'failure'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
cd rust
|
||||||
|
just overwrite-sim-test kcl_samples
|
||||||
|
git add kcl-lib/tests
|
||||||
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git config --local user.name "github-actions[bot]"
|
||||||
|
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
|
||||||
|
git fetch origin
|
||||||
|
echo ${{ github.head_ref }}
|
||||||
|
git checkout ${{ github.head_ref }}
|
||||||
|
if ! git commit -m "Update kcl-samples simulation test output" ; then
|
||||||
|
echo "No changes to commit"
|
||||||
|
# This only runs if tests failed, so we should fail the step.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
git push origin ${{ github.head_ref }}
|
||||||
|
env:
|
||||||
|
# The default is auto, and insta behaves differently in CI vs. not.
|
||||||
|
INSTA_UPDATE: always
|
||||||
|
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
|
||||||
|
# Configure nextest when it's run by insta (via just).
|
||||||
|
NEXTEST_PROFILE: ci
|
||||||
|
RUST_BACKTRACE: full
|
||||||
|
RUST_MIN_STACK: 10485760000
|
||||||
- name: cargo test
|
- name: cargo test
|
||||||
|
if: steps.path-changes.outputs.outside-kcl-samples == 'true'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |-
|
run: |-
|
||||||
cd "${{ matrix.dir }}"
|
cd rust
|
||||||
cargo llvm-cov nextest --workspace --lcov --output-path lcov.info --test-threads=1 --retries=2 --no-fail-fast -P ci 2>&1 | tee /tmp/github-actions.log
|
cargo llvm-cov nextest --workspace --lcov --output-path lcov.info --retries=2 --no-fail-fast -P ci 2>&1 | tee /tmp/github-actions.log
|
||||||
env:
|
env:
|
||||||
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
|
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
|
||||||
RUST_MIN_STACK: 10485760000
|
RUST_MIN_STACK: 10485760000
|
||||||
- name: Upload to codecov.io
|
- name: Upload to codecov.io
|
||||||
|
if: steps.path-changes.outputs.outside-kcl-samples == 'true'
|
||||||
uses: codecov/codecov-action@v5
|
uses: codecov/codecov-action@v5
|
||||||
with:
|
with:
|
||||||
token: ${{secrets.CODECOV_TOKEN}}
|
token: ${{secrets.CODECOV_TOKEN}}
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
flags: wasm-lib
|
flags: rust
|
||||||
verbose: true
|
verbose: true
|
||||||
files: lcov.info
|
files: lcov.info
|
||||||
|
|
||||||
|
48
.github/workflows/check-kcl-header.yml
vendored
Normal file
48
.github/workflows/check-kcl-header.yml
vendored
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
name: Check kcl-samples files for proper header structure
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'public/kcl-samples/**/*.kcl'
|
||||||
|
- .github/workflows/check-kcl-header.yml
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- 'public/kcl-samples/**/*.kcl'
|
||||||
|
- .github/workflows/check-kcl-header.yml
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-kcl-header:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Check KCL files for header comment block and blank line
|
||||||
|
run: |
|
||||||
|
files=$(find public/kcl-samples -type f -name '*.kcl')
|
||||||
|
failed_files=()
|
||||||
|
|
||||||
|
for file in $files; do
|
||||||
|
if ! awk '
|
||||||
|
NR == 1 && $0 !~ /^\/\// { exit 1 }
|
||||||
|
BEGIN { in_comment = 1 }
|
||||||
|
NF == 0 && in_comment == 1 { in_comment = 0; next }
|
||||||
|
$1 !~ /^\/\// && in_comment == 1 { exit 1 }
|
||||||
|
in_comment == 0 && NF > 0 { exit 0 }
|
||||||
|
END { if (in_comment == 1) exit 1 }
|
||||||
|
' "$file"; then
|
||||||
|
failed_files+=("$file")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ${#failed_files[@]} -ne 0 ]; then
|
||||||
|
echo "One or more KCL files do not begin with a header comment block followed by a blank line:"
|
||||||
|
printf '%s\n' "${failed_files[@]}"
|
||||||
|
exit 1
|
||||||
|
fi
|
157
.github/workflows/e2e-tests.yml
vendored
157
.github/workflows/e2e-tests.yml
vendored
@ -3,6 +3,8 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
pull_request:
|
pull_request:
|
||||||
|
schedule:
|
||||||
|
- cron: 0 * * * * # hourly
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
@ -16,21 +18,55 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
check-rust-changes:
|
conditions:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
rust-changed: ${{ steps.filter.outputs.rust }}
|
significant: ${{ steps.path-changes.outputs.significant }}
|
||||||
|
should-run: ${{ steps.should-run.outputs.should-run }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- name: Fetch the base branch
|
||||||
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
|
run: git fetch origin ${{ github.base_ref }} --depth=1
|
||||||
|
- name: Check for path changes
|
||||||
|
id: path-changes
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
- id: filter
|
# Manual runs or push should run all tests.
|
||||||
name: Check for Rust changes
|
if [[ ${{ github.event_name }} != 'pull_request' ]]; then
|
||||||
uses: dorny/paths-filter@v3
|
echo "significant=true" >> $GITHUB_OUTPUT
|
||||||
with:
|
exit 0
|
||||||
filters: |
|
fi
|
||||||
rust:
|
|
||||||
- 'src/wasm-lib/**'
|
changed_files=$(git diff --name-only origin/${{ github.base_ref }})
|
||||||
|
echo "$changed_files"
|
||||||
|
if grep -Evq '^README.md|^public/kcl-samples/|^rust/kcl-lib/tests/kcl_samples/' <<< "$changed_files" ; then
|
||||||
|
echo "significant=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "significant=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
- name: Should run
|
||||||
|
id: should-run
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
# We should run when this is a scheduled run or if there are
|
||||||
|
# significant changes in the diff.
|
||||||
|
if [[ ${{ github.event_name }} == 'schedule' || ${{ steps.path-changes.outputs.significant }} == 'true' ]]; then
|
||||||
|
echo "should-run=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "should-run=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
- name: Display conditions
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# For debugging purposes.
|
||||||
|
set -euo pipefail
|
||||||
|
echo "significant: ${{ steps.path-changes.outputs.significant }}"
|
||||||
|
echo "should-run: ${{ steps.should-run.outputs.should-run }}"
|
||||||
|
|
||||||
electron:
|
electron:
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
@ -42,8 +78,9 @@ jobs:
|
|||||||
os: [namespace-profile-ubuntu-8-cores, namespace-profile-macos-8-cores, windows-16-cores]
|
os: [namespace-profile-ubuntu-8-cores, namespace-profile-macos-8-cores, windows-16-cores]
|
||||||
shardIndex: [1, 2, 3, 4]
|
shardIndex: [1, 2, 3, 4]
|
||||||
shardTotal: [4]
|
shardTotal: [4]
|
||||||
|
# TODO: add ref here for main and latest release tag
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
needs: check-rust-changes
|
needs: conditions
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/create-github-app-token@v1
|
- uses: actions/create-github-app-token@v1
|
||||||
id: app-token
|
id: app-token
|
||||||
@ -54,26 +91,37 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
|
- id: filter
|
||||||
|
name: Check for Rust changes
|
||||||
|
uses: dorny/paths-filter@v3
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
rust:
|
||||||
|
- 'rust/**'
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- uses: KittyCAD/action-install-cli@main
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
id: deps-install
|
||||||
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: yarn
|
run: yarn
|
||||||
- name: Cache Playwright Browsers
|
- name: Cache Playwright Browsers
|
||||||
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cache/ms-playwright/
|
~/.cache/ms-playwright/
|
||||||
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
|
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
|
||||||
- name: Install Playwright Browsers
|
- name: Install Playwright Browsers
|
||||||
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: yarn playwright install --with-deps
|
run: yarn playwright install --with-deps
|
||||||
- name: Download Wasm Cache
|
- name: Download Wasm Cache
|
||||||
id: download-wasm
|
id: download-wasm
|
||||||
if: needs.check-rust-changes.outputs.rust-changed == 'false'
|
if: ${{ needs.conditions.outputs.should-run == 'true' && github.event_name != 'schedule' && steps.filter.outputs.rust == 'false' }}
|
||||||
uses: dawidd6/action-download-artifact@v7
|
uses: dawidd6/action-download-artifact@v7
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
@ -81,29 +129,46 @@ jobs:
|
|||||||
name: wasm-bundle
|
name: wasm-bundle
|
||||||
workflow: build-and-store-wasm.yml
|
workflow: build-and-store-wasm.yml
|
||||||
branch: main
|
branch: main
|
||||||
path: src/wasm-lib/pkg
|
path: rust/kcl-wasm-lib/pkg
|
||||||
- name: copy wasm blob
|
- name: copy wasm blob
|
||||||
if: needs.check-rust-changes.outputs.rust-changed == 'false'
|
if: ${{ needs.conditions.outputs.should-run == 'true' && github.event_name != 'schedule' && steps.filter.outputs.rust == 'false' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cp src/wasm-lib/pkg/wasm_lib_bg.wasm public
|
run: cp rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: Setup Rust
|
- name: Build WASM condition
|
||||||
uses: dtolnay/rust-toolchain@stable
|
id: wasm
|
||||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euox pipefail
|
||||||
|
# Build wasm if this is a scheduled run, there are Rust changes, or
|
||||||
|
# downloading from the wasm cache failed.
|
||||||
|
if [[ ${{github.event_name}} == 'schedule' || ${{steps.filter.outputs.rust}} == 'true' || ${{steps.download-wasm.outcome}} == 'failure' ]]; then
|
||||||
|
echo "should-build-wasm=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "should-build-wasm=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
- name: Use correct Rust toolchain
|
||||||
|
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
|
||||||
|
- name: Install rust
|
||||||
|
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
cache: false # Configured below.
|
||||||
|
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
||||||
|
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
|
||||||
with:
|
with:
|
||||||
tool: wasm-pack
|
tool: wasm-pack
|
||||||
- name: Cache Wasm (because rust diff)
|
- name: Rust Cache
|
||||||
if: needs.check-rust-changes.outputs.rust-changed == 'true'
|
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
workspaces: './src/wasm-lib'
|
workspaces: './rust'
|
||||||
- name: OR Cache Wasm (because wasm cache failed)
|
|
||||||
if: steps.download-wasm.outcome == 'failure'
|
|
||||||
uses: Swatinem/rust-cache@v2
|
|
||||||
with:
|
|
||||||
workspaces: './src/wasm-lib'
|
|
||||||
- name: install good sed
|
- name: install good sed
|
||||||
if: ${{ startsWith(matrix.os, 'macos') }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && startsWith(matrix.os, 'macos') }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
brew install gnu-sed
|
brew install gnu-sed
|
||||||
@ -125,24 +190,21 @@ jobs:
|
|||||||
sed -i "s#GH_ACTIONS_AXIOM_TOKEN#${{secrets.GH_ACTIONS_AXIOM_TOKEN}}#g" /tmp/vector.toml
|
sed -i "s#GH_ACTIONS_AXIOM_TOKEN#${{secrets.GH_ACTIONS_AXIOM_TOKEN}}#g" /tmp/vector.toml
|
||||||
cat /tmp/vector.toml
|
cat /tmp/vector.toml
|
||||||
${HOME}/.vector/bin/vector --config /tmp/vector.toml &
|
${HOME}/.vector/bin/vector --config /tmp/vector.toml &
|
||||||
- name: Build Wasm (because rust diff)
|
- name: Build Wasm
|
||||||
if: needs.check-rust-changes.outputs.rust-changed == 'true'
|
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
|
||||||
shell: bash
|
|
||||||
run: yarn build:wasm
|
|
||||||
- name: OR Build Wasm (because wasm cache failed)
|
|
||||||
if: steps.download-wasm.outcome == 'failure'
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: yarn build:wasm
|
run: yarn build:wasm
|
||||||
- name: build web
|
- name: build web
|
||||||
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: yarn tronb:vite:dev
|
run: yarn tronb:vite:dev
|
||||||
- name: Run ubuntu/chrome snapshots
|
- name: Run ubuntu/chrome snapshots
|
||||||
if: ${{ matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 }}
|
||||||
shell: bash
|
shell: bash
|
||||||
# TODO: break this in its own job, for now it's not slowing down the overall execution as ubuntu is the quickest,
|
# TODO: break this in its own job, for now it's not slowing down the overall execution as ubuntu is the quickest,
|
||||||
# but we could do better. This forces a large 1/1 shard of all 20 snapshot tests that runs in about 3 minutes.
|
# but we could do better. This forces a large 1/1 shard of all 20 snapshot tests that runs in about 3 minutes.
|
||||||
run: |
|
run: |
|
||||||
PLATFORM=web yarn playwright test --config=playwright.config.ts --retries="3" --update-snapshots --grep=@snapshot --trace=on --shard=1/1
|
yarn test:snapshots
|
||||||
env:
|
env:
|
||||||
CI: true
|
CI: true
|
||||||
NODE_ENV: development
|
NODE_ENV: development
|
||||||
@ -151,7 +213,7 @@ jobs:
|
|||||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
|
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: ${{ !cancelled() && (success() || failure()) }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
|
||||||
with:
|
with:
|
||||||
name: playwright-report-snapshots-${{ matrix.os }}-snapshot-${{ matrix.shardIndex }}-${{ github.sha }}
|
name: playwright-report-snapshots-${{ matrix.os }}-snapshot-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||||
path: playwright-report/
|
path: playwright-report/
|
||||||
@ -159,24 +221,24 @@ jobs:
|
|||||||
retention-days: 30
|
retention-days: 30
|
||||||
overwrite: true
|
overwrite: true
|
||||||
- name: Clean up test-results
|
- name: Clean up test-results
|
||||||
if: ${{ !cancelled() && (success() || failure()) }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: rm -r test-results
|
run: rm -r test-results
|
||||||
- name: check for changes
|
- name: check for changes
|
||||||
if: ${{ matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 && github.ref != 'refs/heads/main' }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 && github.ref != 'refs/heads/main' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
id: git-check
|
id: git-check
|
||||||
run: |
|
run: |
|
||||||
git add e2e/playwright/snapshot-tests.spec.ts-snapshots
|
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
|
||||||
if git status | grep -q "Changes to be committed"
|
if git status | grep -q "Changes to be committed"
|
||||||
then echo "modified=true" >> $GITHUB_OUTPUT
|
then echo "modified=true" >> $GITHUB_OUTPUT
|
||||||
else echo "modified=false" >> $GITHUB_OUTPUT
|
else echo "modified=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
- name: Commit changes, if any
|
- name: Commit changes, if any
|
||||||
if: steps.git-check.outputs.modified == 'true'
|
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.git-check.outputs.modified == 'true' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
git add e2e/playwright/snapshot-tests.spec.ts-snapshots
|
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
|
||||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git config --local user.name "github-actions[bot]"
|
git config --local user.name "github-actions[bot]"
|
||||||
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
|
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
|
||||||
@ -188,23 +250,24 @@ jobs:
|
|||||||
git push origin ${{ github.head_ref }}
|
git push origin ${{ github.head_ref }}
|
||||||
# only upload artifacts if there's actually changes
|
# only upload artifacts if there's actually changes
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: steps.git-check.outputs.modified == 'true'
|
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.git-check.outputs.modified == 'true' }}
|
||||||
with:
|
with:
|
||||||
name: playwright-report-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
name: playwright-report-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||||
path: playwright-report/
|
path: playwright-report/
|
||||||
include-hidden-files: true
|
include-hidden-files: true
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
if: ${{ !cancelled() && (success() || failure()) }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||||
path: test-results/
|
path: test-results/
|
||||||
- name: Run playwright/electron flow (with retries)
|
- name: Run playwright/electron flow (with retries)
|
||||||
id: retry
|
id: retry
|
||||||
if: ${{ !cancelled() && (success() || failure()) }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && steps.deps-install.outcome == 'success' }}
|
||||||
uses: nick-fields/retry@v3.0.1
|
uses: nick-fields/retry@v3.0.2
|
||||||
with:
|
with:
|
||||||
|
shell: bash
|
||||||
command: .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}}
|
command: .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}}
|
||||||
timeout_minutes: 30
|
timeout_minutes: 30
|
||||||
max_attempts: 25
|
max_attempts: 25
|
||||||
@ -216,7 +279,7 @@ jobs:
|
|||||||
VITE_KC_SKIP_AUTH: true
|
VITE_KC_SKIP_AUTH: true
|
||||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: always()
|
if: ${{ needs.conditions.outputs.should-run == 'true' && always() }}
|
||||||
with:
|
with:
|
||||||
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||||
path: test-results/
|
path: test-results/
|
||||||
@ -224,7 +287,7 @@ jobs:
|
|||||||
retention-days: 30
|
retention-days: 30
|
||||||
overwrite: true
|
overwrite: true
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: always()
|
if: ${{ needs.conditions.outputs.should-run == 'true' && always() }}
|
||||||
with:
|
with:
|
||||||
name: playwright-report-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
name: playwright-report-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||||
path: playwright-report/
|
path: playwright-report/
|
||||||
|
9
.github/workflows/generate-website-docs.yml
vendored
9
.github/workflows/generate-website-docs.yml
vendored
@ -5,6 +5,7 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- .github/workflows/generate-website-docs.yml
|
- .github/workflows/generate-website-docs.yml
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
|
- 'public/kcl-samples/**'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- .github/workflows/generate-website-docs.yml
|
- .github/workflows/generate-website-docs.yml
|
||||||
@ -42,6 +43,14 @@ jobs:
|
|||||||
# move new
|
# move new
|
||||||
mv -f docs/kcl/*.md documentation/content/pages/docs/kcl/
|
mv -f docs/kcl/*.md documentation/content/pages/docs/kcl/
|
||||||
mv -f docs/kcl/types documentation/content/pages/docs/kcl/
|
mv -f docs/kcl/types documentation/content/pages/docs/kcl/
|
||||||
|
- name: move kcl-samples
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p documentation/content/pages/docs/kcl-samples
|
||||||
|
# cleanup old
|
||||||
|
rm -rf documentation/content/pages/docs/kcl-samples/*
|
||||||
|
# move new
|
||||||
|
mv -f public/kcl-samples/* documentation/content/pages/docs/kcl-samples/
|
||||||
- name: commit the changes in the docs repo
|
- name: commit the changes in the docs repo
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
401
.github/workflows/kcl-language-server.yml
vendored
Normal file
401
.github/workflows/kcl-language-server.yml
vendored
Normal file
@ -0,0 +1,401 @@
|
|||||||
|
name: kcl-language-server
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- '**/Cargo.toml'
|
||||||
|
- '**/Cargo.lock'
|
||||||
|
- '**/rust-toolchain.toml'
|
||||||
|
- 'rust/kcl-language-server/**'
|
||||||
|
- '**.rs'
|
||||||
|
- .github/workflows/kcl-language-server.yml
|
||||||
|
tags:
|
||||||
|
- 'kcl-*'
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '**/Cargo.toml'
|
||||||
|
- '**/Cargo.lock'
|
||||||
|
- '**/rust-toolchain.toml'
|
||||||
|
- 'rust/kcl-language-server/**'
|
||||||
|
- '**.rs'
|
||||||
|
- .github/workflows/kcl-language-server.yml
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_INCREMENTAL: 0
|
||||||
|
CARGO_NET_RETRY: 10
|
||||||
|
RUSTFLAGS: ""
|
||||||
|
RUSTUP_MAX_RETRIES: 10
|
||||||
|
FETCH_DEPTH: 0 # pull in the tags for the version string
|
||||||
|
MACOSX_DEPLOYMENT_TARGET: 10.15
|
||||||
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
||||||
|
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: vscode tests
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Install Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: ".nvmrc"
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
yarn install
|
||||||
|
cd rust/kcl-language-server
|
||||||
|
yarn install
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
cd rust/kcl-language-server
|
||||||
|
yarn build
|
||||||
|
yarn test-compile
|
||||||
|
ls -la dist
|
||||||
|
xvfb-run -a yarn test
|
||||||
|
if: runner.os == 'Linux'
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
cd rust/kcl-language-server
|
||||||
|
yarn test
|
||||||
|
if: runner.os != 'Linux'
|
||||||
|
build-release:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: windows-latest
|
||||||
|
target: x86_64-pc-windows-msvc
|
||||||
|
code-target:
|
||||||
|
win32-x64
|
||||||
|
#- os: windows-latest
|
||||||
|
#target: i686-pc-windows-msvc
|
||||||
|
#code-target:
|
||||||
|
#win32-ia32
|
||||||
|
#- os: windows-latest
|
||||||
|
#target: aarch64-pc-windows-msvc
|
||||||
|
#code-target: win32-arm64
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
code-target:
|
||||||
|
linux-x64
|
||||||
|
#- os: ubuntu-latest
|
||||||
|
#target: aarch64-unknown-linux-musl
|
||||||
|
#code-target: linux-arm64
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: aarch64-unknown-linux-gnu
|
||||||
|
code-target: linux-arm64
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: arm-unknown-linux-gnueabihf
|
||||||
|
code-target: linux-armhf
|
||||||
|
- os: macos-latest
|
||||||
|
target: x86_64-apple-darwin
|
||||||
|
code-target: darwin-x64
|
||||||
|
- os: macos-latest
|
||||||
|
target: aarch64-apple-darwin
|
||||||
|
code-target: darwin-arm64
|
||||||
|
|
||||||
|
name: build-release (${{ matrix.target }})
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
container: ${{ matrix.container }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
RA_TARGET: ${{ matrix.target }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: ${{ env.FETCH_DEPTH }}
|
||||||
|
|
||||||
|
- name: Use correct Rust toolchain
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
rm rust/rust-toolchain.toml
|
||||||
|
|
||||||
|
- name: Install rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
cache: rust
|
||||||
|
components: rust-src
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Install Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: ".nvmrc"
|
||||||
|
|
||||||
|
- name: Update apt repositories
|
||||||
|
if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'arm-unknown-linux-gnueabihf' || matrix.os == 'ubuntu-latest'
|
||||||
|
run: sudo apt-get update
|
||||||
|
|
||||||
|
- if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||||
|
name: Install deps
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
sudo apt install -y \
|
||||||
|
ca-certificates \
|
||||||
|
clang \
|
||||||
|
cmake \
|
||||||
|
curl \
|
||||||
|
g++ \
|
||||||
|
gcc \
|
||||||
|
gcc-mingw-w64-i686 \
|
||||||
|
gcc-mingw-w64 \
|
||||||
|
jq \
|
||||||
|
libmpc-dev \
|
||||||
|
libmpfr-dev \
|
||||||
|
libgmp-dev \
|
||||||
|
libssl-dev \
|
||||||
|
libxml2-dev \
|
||||||
|
mingw-w64 \
|
||||||
|
wget \
|
||||||
|
zlib1g-dev
|
||||||
|
|
||||||
|
cargo install cross
|
||||||
|
|
||||||
|
- name: Install AArch64 target toolchain
|
||||||
|
if: matrix.target == 'aarch64-unknown-linux-gnu'
|
||||||
|
run: sudo apt-get install gcc-aarch64-linux-gnu
|
||||||
|
|
||||||
|
- name: Install ARM target toolchain
|
||||||
|
if: matrix.target == 'arm-unknown-linux-gnueabihf'
|
||||||
|
run: sudo apt-get install gcc-arm-linux-gnueabihf
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
run: |
|
||||||
|
cd rust
|
||||||
|
cargo kcl-language-server-release build --client-patch-version ${{ github.run_number }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
cd rust/kcl-language-server
|
||||||
|
yarn install
|
||||||
|
|
||||||
|
- name: Package Extension (release)
|
||||||
|
if: startsWith(github.event.ref, 'refs/tags/')
|
||||||
|
run: |
|
||||||
|
cd rust/kcl-language-server
|
||||||
|
npx vsce package -o "../build/kcl-language-server-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }}
|
||||||
|
|
||||||
|
- name: Package Extension (nightly)
|
||||||
|
if: startsWith(github.event.ref, 'refs/tags/') == false
|
||||||
|
run: |
|
||||||
|
cd rust/kcl-language-server
|
||||||
|
npx vsce package -o "../build/kcl-language-server-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }} --pre-release
|
||||||
|
|
||||||
|
- name: remove server
|
||||||
|
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
||||||
|
run: |
|
||||||
|
cd rust/kcl-language-server
|
||||||
|
rm -rf server
|
||||||
|
|
||||||
|
- name: Package Extension (no server, release)
|
||||||
|
if: matrix.target == 'x86_64-unknown-linux-gnu' && startsWith(github.event.ref, 'refs/tags/')
|
||||||
|
run: |
|
||||||
|
cd rust/kcl-language-server
|
||||||
|
npx vsce package -o ../build/kcl-language-server-no-server.vsix
|
||||||
|
|
||||||
|
- name: Package Extension (no server, nightly)
|
||||||
|
if: matrix.target == 'x86_64-unknown-linux-gnu' && startsWith(github.event.ref, 'refs/tags/') == false
|
||||||
|
run: |
|
||||||
|
cd rust/kcl-language-server
|
||||||
|
npx vsce package -o ../build/kcl-language-server-no-server.vsix --pre-release
|
||||||
|
|
||||||
|
- name: Upload artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-${{ matrix.target }}
|
||||||
|
path: ./rust/build
|
||||||
|
|
||||||
|
build-release-x86_64-unknown-linux-musl:
|
||||||
|
name: build-release (x86_64-unknown-linux-musl)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
RA_TARGET: x86_64-unknown-linux-musl
|
||||||
|
# For some reason `-crt-static` is not working for clang without lld
|
||||||
|
RUSTFLAGS: "-C link-arg=-fuse-ld=lld -C target-feature=-crt-static"
|
||||||
|
container:
|
||||||
|
image: alpine:latest
|
||||||
|
volumes:
|
||||||
|
- /usr/local/cargo/registry:/usr/local/cargo/registry
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
apk add --no-cache \
|
||||||
|
bash \
|
||||||
|
curl \
|
||||||
|
git \
|
||||||
|
clang \
|
||||||
|
lld \
|
||||||
|
musl-dev \
|
||||||
|
nodejs \
|
||||||
|
yarn \
|
||||||
|
npm
|
||||||
|
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: ${{ env.FETCH_DEPTH }}
|
||||||
|
|
||||||
|
- name: Use correct Rust toolchain
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
rm rust/rust-toolchain.toml
|
||||||
|
|
||||||
|
- name: Install rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
cache: rust
|
||||||
|
components: rust-src
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
run: |
|
||||||
|
cd rust
|
||||||
|
cargo kcl-language-server-release build --client-patch-version ${{ github.run_number }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
cd rust/kcl-language-server
|
||||||
|
yarn install
|
||||||
|
|
||||||
|
- name: Package Extension (release)
|
||||||
|
if: startsWith(github.event.ref, 'refs/tags/')
|
||||||
|
run: |
|
||||||
|
cd rust/kcl-language-server
|
||||||
|
npx vsce package -o "../build/kcl-language-server-alpine-x64.vsix" --target alpine-x64
|
||||||
|
|
||||||
|
- name: Package Extension (release)
|
||||||
|
if: startsWith(github.event.ref, 'refs/tags/') == false
|
||||||
|
run: |
|
||||||
|
cd rust/kcl-language-server
|
||||||
|
npx vsce package -o "../build/kcl-language-server-alpine-x64.vsix" --target alpine-x64 --pre-release
|
||||||
|
|
||||||
|
- name: Upload artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-x86_64-unknown-linux-musl
|
||||||
|
path: ./rust/build
|
||||||
|
|
||||||
|
publish:
|
||||||
|
name: publish
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: ["build-release", "build-release-x86_64-unknown-linux-musl"]
|
||||||
|
if: startsWith(github.event.ref, 'refs/tags')
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- run: 'echo "TAG: $TAG"'
|
||||||
|
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: ${{ env.FETCH_DEPTH }}
|
||||||
|
|
||||||
|
- name: Install Nodejs
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: ".nvmrc"
|
||||||
|
|
||||||
|
- run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
|
||||||
|
- run: 'echo "HEAD_SHA: $HEAD_SHA"'
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-aarch64-apple-darwin
|
||||||
|
path: rust/build
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-x86_64-apple-darwin
|
||||||
|
path: rust/build
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-x86_64-unknown-linux-gnu
|
||||||
|
path: rust/build
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-x86_64-unknown-linux-musl
|
||||||
|
path: rust/build
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-aarch64-unknown-linux-gnu
|
||||||
|
path: rust/build
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-arm-unknown-linux-gnueabihf
|
||||||
|
path: rust/build
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-x86_64-pc-windows-msvc
|
||||||
|
path:
|
||||||
|
rust/build
|
||||||
|
#- uses: actions/download-artifact@v4
|
||||||
|
#with:
|
||||||
|
#name: release-i686-pc-windows-msvc
|
||||||
|
#path:
|
||||||
|
#build
|
||||||
|
#- uses: actions/download-artifact@v4
|
||||||
|
#with:
|
||||||
|
#name: release-aarch64-pc-windows-msvc
|
||||||
|
#path: rust/build
|
||||||
|
- run: ls -al ./rust/build
|
||||||
|
|
||||||
|
- name: Publish Release
|
||||||
|
uses: ./.github/actions/github-release
|
||||||
|
with:
|
||||||
|
files: "rust/build/*"
|
||||||
|
name: ${{ env.TAG }}
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: move files to dir for upload
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd rust
|
||||||
|
mkdir -p releases/language-server/${{ env.TAG }}
|
||||||
|
cp -r build/* releases/language-server/${{ env.TAG }}
|
||||||
|
|
||||||
|
- name: "Authenticate to Google Cloud"
|
||||||
|
uses: "google-github-actions/auth@v2.1.8"
|
||||||
|
with:
|
||||||
|
credentials_json: "${{ secrets.GOOGLE_CLOUD_DL_SA }}"
|
||||||
|
- name: Set up Cloud SDK
|
||||||
|
uses: google-github-actions/setup-gcloud@v2.1.2
|
||||||
|
with:
|
||||||
|
project_id: kittycadapi
|
||||||
|
- name: "upload files to gcp"
|
||||||
|
id: upload-files
|
||||||
|
uses: google-github-actions/upload-cloud-storage@v2.2.2
|
||||||
|
with:
|
||||||
|
path: rust/releases
|
||||||
|
destination: dl.kittycad.io
|
||||||
|
|
||||||
|
- run: rm rust/build/kcl-language-server-no-server.vsix
|
||||||
|
|
||||||
|
- name: Publish Extension (Code Marketplace, release)
|
||||||
|
# token from https://dev.azure.com/kcl-language-server/
|
||||||
|
run: |
|
||||||
|
cd rust/kcl-language-server
|
||||||
|
npx vsce publish --pat ${{ secrets.VSCE_PAT }} --packagePath ../build/kcl-language-server-*.vsix
|
||||||
|
|
||||||
|
- name: Publish Extension (OpenVSX, release)
|
||||||
|
run: |
|
||||||
|
cd rust/kcl-language-server
|
||||||
|
npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ../build/kcl-language-server-*.vsix
|
||||||
|
timeout-minutes: 2
|
180
.github/workflows/kcl-python-bindings.yml
vendored
Normal file
180
.github/workflows/kcl-python-bindings.yml
vendored
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
# This file is autogenerated by maturin v1.6.0 and then modified
|
||||||
|
# To update, run
|
||||||
|
#
|
||||||
|
# maturin generate-ci github
|
||||||
|
#
|
||||||
|
name: kcl-python-bindings
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- '**/Cargo.toml'
|
||||||
|
- '**/Cargo.lock'
|
||||||
|
- '**/rust-toolchain.toml'
|
||||||
|
- 'rust/kcl-python-bindings/**'
|
||||||
|
- '**.rs'
|
||||||
|
- .github/workflows/kcl-python-bindings.yml
|
||||||
|
tags:
|
||||||
|
- 'kcl-*'
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '**/Cargo.toml'
|
||||||
|
- '**/Cargo.lock'
|
||||||
|
- '**/rust-toolchain.toml'
|
||||||
|
- 'rust/kcl-python-bindings/**'
|
||||||
|
- '**.rs'
|
||||||
|
- .github/workflows/kcl-python-bindings.yml
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
linux-x86_64:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
- name: Build wheels
|
||||||
|
uses: PyO3/maturin-action@v1
|
||||||
|
with:
|
||||||
|
working-directory: rust/kcl-python-bindings
|
||||||
|
target: x86_64
|
||||||
|
args: --release --out dist --find-interpreter
|
||||||
|
sccache: 'true'
|
||||||
|
manylinux: auto
|
||||||
|
before-script-linux: |
|
||||||
|
yum install openssl-devel -y
|
||||||
|
- name: Upload wheels
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: wheels-linux-x86_64
|
||||||
|
path: rust/kcl-python-bindings/dist
|
||||||
|
|
||||||
|
windows:
|
||||||
|
runs-on: windows-16-cores
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target:
|
||||||
|
- x64
|
||||||
|
fail-fast: false
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
architecture: ${{ matrix.target }}
|
||||||
|
- name: Build wheels
|
||||||
|
uses: PyO3/maturin-action@v1
|
||||||
|
with:
|
||||||
|
working-directory: rust/kcl-python-bindings
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
args: --release --out dist --find-interpreter
|
||||||
|
sccache: 'true'
|
||||||
|
- name: Upload wheels
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: wheels-windows-${{ matrix.target }}
|
||||||
|
path: rust/kcl-python-bindings/dist
|
||||||
|
|
||||||
|
macos:
|
||||||
|
runs-on: macos-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target:
|
||||||
|
- x86_64
|
||||||
|
- aarch64
|
||||||
|
fail-fast: false
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
- name: Build wheels
|
||||||
|
uses: PyO3/maturin-action@v1
|
||||||
|
with:
|
||||||
|
working-directory: rust/kcl-python-bindings
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
args: --release --out dist --find-interpreter
|
||||||
|
sccache: 'true'
|
||||||
|
- name: Upload wheels
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: wheels-macos-${{ matrix.target }}
|
||||||
|
path: rust/kcl-python-bindings/dist
|
||||||
|
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Install uv
|
||||||
|
uses: astral-sh/setup-uv@v5
|
||||||
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
- uses: taiki-e/install-action@just
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
cd rust/kcl-python-bindings
|
||||||
|
just setup-uv
|
||||||
|
just test
|
||||||
|
env:
|
||||||
|
KITTYCAD_API_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN }}
|
||||||
|
|
||||||
|
sdist:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Install the latest version of uv
|
||||||
|
uses: astral-sh/setup-uv@v5
|
||||||
|
- name: Install codespell
|
||||||
|
run: |
|
||||||
|
uv venv .venv
|
||||||
|
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
|
||||||
|
echo "$PWD/.venv/bin" >> $GITHUB_PATH
|
||||||
|
uv pip install pip --upgrade
|
||||||
|
- name: Build sdist
|
||||||
|
uses: PyO3/maturin-action@v1
|
||||||
|
with:
|
||||||
|
working-directory: rust/kcl-python-bindings
|
||||||
|
command: sdist
|
||||||
|
args: --out dist
|
||||||
|
- name: Upload sdist
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: wheels-sdist
|
||||||
|
path: rust/kcl-python-bindings/dist
|
||||||
|
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
needs: [linux-x86_64, windows, macos, sdist]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
- name: Install the latest version of uv
|
||||||
|
uses: astral-sh/setup-uv@v5
|
||||||
|
- name: do uv things
|
||||||
|
run: |
|
||||||
|
cd rust/kcl-python-bindings
|
||||||
|
uv venv .venv
|
||||||
|
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
|
||||||
|
echo "$PWD/.venv/bin" >> $GITHUB_PATH
|
||||||
|
uv pip install pip --upgrade
|
||||||
|
- name: Publish to PyPI
|
||||||
|
uses: PyO3/maturin-action@v1
|
||||||
|
env:
|
||||||
|
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
|
with:
|
||||||
|
working-directory: rust/kcl-python-bindings
|
||||||
|
command: upload
|
||||||
|
args: --non-interactive --skip-existing wheels-*/*
|
24
.github/workflows/ruff.yml
vendored
Normal file
24
.github/workflows/ruff.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
name: ruff
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: main
|
||||||
|
paths:
|
||||||
|
- '**.py'
|
||||||
|
- .github/workflows/ruff.yml
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '**.py'
|
||||||
|
- .github/workflows/ruff.yml
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
jobs:
|
||||||
|
ruff:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: astral-sh/ruff-action@v3
|
||||||
|
|
14
.github/workflows/static-analysis.yml
vendored
14
.github/workflows/static-analysis.yml
vendored
@ -37,7 +37,7 @@ jobs:
|
|||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- run: yarn install
|
- run: yarn install
|
||||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
||||||
with:
|
with:
|
||||||
tool: wasm-pack
|
tool: wasm-pack
|
||||||
- run: yarn build:wasm
|
- run: yarn build:wasm
|
||||||
@ -52,11 +52,12 @@ jobs:
|
|||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- run: yarn install
|
- run: yarn install
|
||||||
|
- run: yarn --cwd ./rust/kcl-language-server --modules-folder node_modules install
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
workspaces: './src/wasm-lib'
|
workspaces: './rust'
|
||||||
|
|
||||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
||||||
with:
|
with:
|
||||||
tool: wasm-pack
|
tool: wasm-pack
|
||||||
- run: yarn build:wasm
|
- run: yarn build:wasm
|
||||||
@ -72,6 +73,7 @@ jobs:
|
|||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- run: yarn install
|
- run: yarn install
|
||||||
|
- run: yarn --cwd ./rust/kcl-language-server --modules-folder node_modules install
|
||||||
- run: yarn lint
|
- run: yarn lint
|
||||||
|
|
||||||
python-codespell:
|
python-codespell:
|
||||||
@ -98,7 +100,7 @@ jobs:
|
|||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
|
|
||||||
- run: yarn install
|
- run: yarn install
|
||||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
||||||
with:
|
with:
|
||||||
tool: wasm-pack
|
tool: wasm-pack
|
||||||
- run: yarn build:wasm
|
- run: yarn build:wasm
|
||||||
@ -127,7 +129,7 @@ jobs:
|
|||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
|
|
||||||
- run: yarn install
|
- run: yarn install
|
||||||
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
|
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
||||||
with:
|
with:
|
||||||
tool: wasm-pack
|
tool: wasm-pack
|
||||||
- run: yarn build:wasm
|
- run: yarn build:wasm
|
||||||
@ -141,7 +143,7 @@ jobs:
|
|||||||
|
|
||||||
- name: run unit tests
|
- name: run unit tests
|
||||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||||
run: yarn test:unit
|
run: xvfb-run -a yarn test:unit
|
||||||
env:
|
env:
|
||||||
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
|
|
||||||
|
37
.gitignore
vendored
37
.gitignore
vendored
@ -1,7 +1,7 @@
|
|||||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
/node_modules
|
node_modules
|
||||||
/.pnp
|
/.pnp
|
||||||
.pnp.js
|
.pnp.js
|
||||||
|
|
||||||
@ -9,7 +9,7 @@
|
|||||||
/coverage
|
/coverage
|
||||||
|
|
||||||
# production
|
# production
|
||||||
/build
|
build
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
.DS_Store
|
.DS_Store
|
||||||
@ -26,16 +26,19 @@ yarn-error.log*
|
|||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
.helix
|
.helix
|
||||||
src/wasm-lib/.idea
|
|
||||||
src/wasm-lib/.vscode
|
|
||||||
|
|
||||||
# rust
|
# rust
|
||||||
src/wasm-lib/target
|
rust/target
|
||||||
src/wasm-lib/bindings
|
rust/kcl-lib/bindings
|
||||||
src/wasm-lib/kcl/bindings
|
public/kcl_wasm_lib_bg.wasm
|
||||||
public/wasm_lib_bg.wasm
|
rust/lcov.info
|
||||||
src/wasm-lib/lcov.info
|
rust/kcl-wasm-lib/pkg
|
||||||
src/wasm-lib/grackle/test_json_output
|
*.snap.new
|
||||||
|
rust/kcl-lib/fuzz/Cargo.lock
|
||||||
|
rust/kcl-language-server-release/Cargo.lock
|
||||||
|
|
||||||
|
# kcl language server package
|
||||||
|
rust/kcl-language-server/dist/
|
||||||
|
|
||||||
e2e/playwright/playwright-secrets.env
|
e2e/playwright/playwright-secrets.env
|
||||||
e2e/playwright/temp1.png
|
e2e/playwright/temp1.png
|
||||||
@ -48,7 +51,8 @@ e2e/playwright/export-snapshots/*
|
|||||||
!e2e/playwright/export-snapshots/*.png
|
!e2e/playwright/export-snapshots/*.png
|
||||||
!e2e/playwright/snapshot-tests.spec.ts-snapshots/*.png
|
!e2e/playwright/snapshot-tests.spec.ts-snapshots/*.png
|
||||||
|
|
||||||
/kcl-samples
|
/public/kcl-samples.zip
|
||||||
|
/public/kcl-samples/.github
|
||||||
/test-results/
|
/test-results/
|
||||||
/playwright-report/
|
/playwright-report/
|
||||||
/blob-report/
|
/blob-report/
|
||||||
@ -59,15 +63,20 @@ e2e/playwright/export-snapshots/*
|
|||||||
## generated files
|
## generated files
|
||||||
src/**/*.typegen.ts
|
src/**/*.typegen.ts
|
||||||
|
|
||||||
src/wasm-lib/grackle/stdlib_cube_partial.json
|
|
||||||
Mac_App_Distribution.provisionprofile
|
Mac_App_Distribution.provisionprofile
|
||||||
|
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
src/wasm-lib/pkg
|
|
||||||
|
|
||||||
.eslintcache
|
.eslintcache
|
||||||
venv
|
|
||||||
.vite/
|
.vite/
|
||||||
|
|
||||||
# electron
|
# electron
|
||||||
out/
|
out/
|
||||||
|
|
||||||
|
# python
|
||||||
|
__pycache__/
|
||||||
|
uv.lock
|
||||||
|
dist
|
||||||
|
venv
|
||||||
|
|
||||||
|
.vscode-test
|
||||||
|
@ -7,10 +7,10 @@ coverage
|
|||||||
*.rs
|
*.rs
|
||||||
*.hbs
|
*.hbs
|
||||||
target
|
target
|
||||||
src/wasm-lib/pkg
|
|
||||||
src/wasm-lib/kcl/bindings
|
|
||||||
e2e/playwright/export-snapshots
|
e2e/playwright/export-snapshots
|
||||||
|
e2e/playwright/snapshots/prompt-to-edit
|
||||||
|
|
||||||
|
|
||||||
# XState generated files
|
# XState generated files
|
||||||
src/machines/**.typegen.ts
|
src/machines/**.typegen.ts
|
||||||
|
.vscode-test
|
||||||
|
4
Makefile
4
Makefile
@ -1,6 +1,6 @@
|
|||||||
.PHONY: dev
|
.PHONY: dev
|
||||||
|
|
||||||
WASM_LIB_FILES := $(wildcard src/wasm-lib/**/*.rs)
|
KCL_WASM_LIB_FILES := $(wildcard rust/**/*.rs)
|
||||||
TS_SRC := $(wildcard src/**/*.tsx) $(wildcard src/**/*.ts)
|
TS_SRC := $(wildcard src/**/*.tsx) $(wildcard src/**/*.ts)
|
||||||
XSTATE_TYPEGENS := $(wildcard src/machines/*.typegen.ts)
|
XSTATE_TYPEGENS := $(wildcard src/machines/*.typegen.ts)
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ lee-electron-test:
|
|||||||
$(XSTATE_TYPEGENS): $(TS_SRC)
|
$(XSTATE_TYPEGENS): $(TS_SRC)
|
||||||
yarn xstate typegen 'src/**/*.ts?(x)'
|
yarn xstate typegen 'src/**/*.ts?(x)'
|
||||||
|
|
||||||
public/wasm_lib_bg.wasm: $(WASM_LIB_FILES)
|
public/kcl_wasm_lib_bg.wasm: $(KCL_WASM_LIB_FILES)
|
||||||
yarn build:wasm
|
yarn build:wasm
|
||||||
|
|
||||||
node_modules: package.json yarn.lock
|
node_modules: package.json yarn.lock
|
||||||
|
28
README.md
28
README.md
@ -40,7 +40,7 @@ The 3D view in Modeling App is just a video stream from our hosted geometry engi
|
|||||||
|
|
||||||
[Original demo video](https://drive.google.com/file/d/183_wjqGdzZ8EEZXSqZ3eDcJocYPCyOdC/view?pli=1)
|
[Original demo video](https://drive.google.com/file/d/183_wjqGdzZ8EEZXSqZ3eDcJocYPCyOdC/view?pli=1)
|
||||||
|
|
||||||
[Original demo slides](https://github.com/KittyCAD/Eng/files/10398178/demo.pdf)
|
[Original demo slides](https://github.com/user-attachments/files/19010536/demo.pdf)
|
||||||
|
|
||||||
## Get started
|
## Get started
|
||||||
|
|
||||||
@ -53,17 +53,20 @@ Install a node version manager such as [fnm](https://github.com/Schniz/fnm?tab=r
|
|||||||
On Windows, it's also recommended to [upgrade your PowerShell version](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.5#winget), we're using 7.
|
On Windows, it's also recommended to [upgrade your PowerShell version](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.5#winget), we're using 7.
|
||||||
|
|
||||||
Then in the repo run the following to install and use the node version specified in `.nvmrc`. You might need to specify your processor architecture with `--arch arm64` or `--arch x64` if it's not autodetected.
|
Then in the repo run the following to install and use the node version specified in `.nvmrc`. You might need to specify your processor architecture with `--arch arm64` or `--arch x64` if it's not autodetected.
|
||||||
|
|
||||||
```
|
```
|
||||||
fnm install --corepack-enabled
|
fnm install --corepack-enabled
|
||||||
fnm use
|
fnm use
|
||||||
```
|
```
|
||||||
|
|
||||||
Install the NPM dependencies with:
|
Install the NPM dependencies with:
|
||||||
|
|
||||||
```
|
```
|
||||||
yarn install
|
yarn install
|
||||||
```
|
```
|
||||||
|
|
||||||
This project uses a lot of Rust compiled to [WASM](https://webassembly.org/) within it. We have package scripts to run rustup, see `package.json` for reference:
|
This project uses a lot of Rust compiled to [WASM](https://webassembly.org/) within it. We have package scripts to run rustup, see `package.json` for reference:
|
||||||
|
|
||||||
```
|
```
|
||||||
# macOS/Linux
|
# macOS/Linux
|
||||||
yarn install:rust
|
yarn install:rust
|
||||||
@ -75,6 +78,7 @@ yarn install:wasm-pack:cargo
|
|||||||
```
|
```
|
||||||
|
|
||||||
Then to build the WASM layer, run:
|
Then to build the WASM layer, run:
|
||||||
|
|
||||||
```
|
```
|
||||||
# macOS/Linux
|
# macOS/Linux
|
||||||
yarn build:wasm
|
yarn build:wasm
|
||||||
@ -135,6 +139,7 @@ To package the app for your platform with electron-builder, run `yarn tronb:pack
|
|||||||
Which commands from setup are one off vs need to be run every time?
|
Which commands from setup are one off vs need to be run every time?
|
||||||
|
|
||||||
The following will need to be run when checking out a new commit and guarantees the build is not stale:
|
The following will need to be run when checking out a new commit and guarantees the build is not stale:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
yarn install
|
yarn install
|
||||||
yarn build:wasm
|
yarn build:wasm
|
||||||
@ -190,6 +195,7 @@ The other `build-apps` output in the release `build-apps` workflow (triggered by
|
|||||||
The only difference with these builds is that they point to a different update location on the release bucket, with this dummy v0.255.255 always available. This helps ensuring that the version we release will be able to update to the next one available.
|
The only difference with these builds is that they point to a different update location on the release bucket, with this dummy v0.255.255 always available. This helps ensuring that the version we release will be able to update to the next one available.
|
||||||
|
|
||||||
If the prompt doesn't show up, start the app in command line to grab the electron-updater logs. This is likely an issue with the current build that needs addressing (or the updater-test location in the storage bucket).
|
If the prompt doesn't show up, start the app in command line to grab the electron-updater logs. This is likely an issue with the current build that needs addressing (or the updater-test location in the storage bucket).
|
||||||
|
|
||||||
```
|
```
|
||||||
# Windows (PowerShell)
|
# Windows (PowerShell)
|
||||||
& 'C:\Program Files\Zoo Modeling App\Zoo Modeling App.exe'
|
& 'C:\Program Files\Zoo Modeling App\Zoo Modeling App.exe'
|
||||||
@ -213,7 +219,6 @@ A new `publish-apps-release` will kick in and you should be able to find it [her
|
|||||||
|
|
||||||
If everything is well and the release is out to the public, the issue tracking the release shall be closed.
|
If everything is well and the release is out to the public, the issue tracking the release shall be closed.
|
||||||
|
|
||||||
|
|
||||||
## Fuzzing the parser
|
## Fuzzing the parser
|
||||||
|
|
||||||
Make sure you install cargo fuzz:
|
Make sure you install cargo fuzz:
|
||||||
@ -223,7 +228,7 @@ $ cargo install cargo-fuzz
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ cd src/wasm-lib/kcl
|
$ cd rust/kcl-lib
|
||||||
|
|
||||||
# list the fuzz targets
|
# list the fuzz targets
|
||||||
$ cargo fuzz list
|
$ cargo fuzz list
|
||||||
@ -251,6 +256,7 @@ snapshottoken=<your-snapshot-token>
|
|||||||
For a portable way to run Playwright you'll need Docker.
|
For a portable way to run Playwright you'll need Docker.
|
||||||
|
|
||||||
#### Generic example
|
#### Generic example
|
||||||
|
|
||||||
After that, open a terminal and run:
|
After that, open a terminal and run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -263,7 +269,6 @@ and in another terminal, run:
|
|||||||
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project="Google Chrome" <test suite>
|
PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project="Google Chrome" <test suite>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
#### Specific example
|
#### Specific example
|
||||||
|
|
||||||
open a terminal and run:
|
open a terminal and run:
|
||||||
@ -281,7 +286,6 @@ PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:4444/ yarn playwright test --project=
|
|||||||
run a specific test change the test from `test('...` to `test.only('...`
|
run a specific test change the test from `test('...` to `test.only('...`
|
||||||
(note if you commit this, the tests will instantly fail without running any of the tests)
|
(note if you commit this, the tests will instantly fail without running any of the tests)
|
||||||
|
|
||||||
|
|
||||||
**Gotcha**: running the docker container with a mismatched image against your `./node_modules/playwright` will cause a failure. Make sure the versions are matched and up to date.
|
**Gotcha**: running the docker container with a mismatched image against your `./node_modules/playwright` will cause a failure. Make sure the versions are matched and up to date.
|
||||||
|
|
||||||
run headed
|
run headed
|
||||||
@ -375,17 +379,19 @@ Which will run our suite of [Vitest unit](https://vitest.dev/) and [React Testin
|
|||||||
- `just`
|
- `just`
|
||||||
|
|
||||||
#### Setting KITTYCAD_API_TOKEN
|
#### Setting KITTYCAD_API_TOKEN
|
||||||
|
|
||||||
Use the production zoo.dev token, set this environment variable before running the tests
|
Use the production zoo.dev token, set this environment variable before running the tests
|
||||||
|
|
||||||
#### Installing cargonextest
|
#### Installing cargonextest
|
||||||
|
|
||||||
```
|
```
|
||||||
cd src/wasm-lib
|
cd rust
|
||||||
cargo search cargo-nextest
|
cargo search cargo-nextest
|
||||||
cargo install cargo-nextest
|
cargo install cargo-nextest
|
||||||
```
|
```
|
||||||
|
|
||||||
#### just
|
#### just
|
||||||
|
|
||||||
install [`just`](https://github.com/casey/just?tab=readme-ov-file#pre-built-binaries)
|
install [`just`](https://github.com/casey/just?tab=readme-ov-file#pre-built-binaries)
|
||||||
|
|
||||||
#### Running the tests
|
#### Running the tests
|
||||||
@ -395,7 +401,7 @@ install [`just`](https://github.com/casey/just?tab=readme-ov-file#pre-built-bina
|
|||||||
# Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set
|
# Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set
|
||||||
# Make sure you installed cargo-nextest
|
# Make sure you installed cargo-nextest
|
||||||
# Make sure you installed just
|
# Make sure you installed just
|
||||||
cd src/wasm-lib
|
cd rust
|
||||||
just test
|
just test
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -403,7 +409,7 @@ just test
|
|||||||
# Without just
|
# Without just
|
||||||
# Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set
|
# Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set
|
||||||
# Make sure you installed cargo-nextest
|
# Make sure you installed cargo-nextest
|
||||||
cd src/wasm-lib
|
cd rust
|
||||||
export RUST_BRACKTRACE="full" && cargo nextest run --workspace --test-threads=1
|
export RUST_BRACKTRACE="full" && cargo nextest run --workspace --test-threads=1
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -412,13 +418,14 @@ Where `XXX` is an API token from the production engine (NOT the dev environment)
|
|||||||
We recommend using [nextest](https://nexte.st/) to run the Rust tests (its faster and is used in CI). Once installed, run the tests using
|
We recommend using [nextest](https://nexte.st/) to run the Rust tests (its faster and is used in CI). Once installed, run the tests using
|
||||||
|
|
||||||
```
|
```
|
||||||
cd src/wasm-lib
|
cd rust
|
||||||
KITTYCAD_API_TOKEN=XXX cargo run nextest
|
KITTYCAD_API_TOKEN=XXX cargo run nextest
|
||||||
```
|
```
|
||||||
|
|
||||||
### Mapping CI CD jobs to local commands
|
### Mapping CI CD jobs to local commands
|
||||||
|
|
||||||
When you see the CI CD fail on jobs you may wonder three things
|
When you see the CI CD fail on jobs you may wonder three things
|
||||||
|
|
||||||
- Do I have a bug in my code?
|
- Do I have a bug in my code?
|
||||||
- Is the test flaky?
|
- Is the test flaky?
|
||||||
- Is there a bug in `main`?
|
- Is there a bug in `main`?
|
||||||
@ -437,7 +444,6 @@ yarn test-setup
|
|||||||
|
|
||||||
> Gotcha, are packages up to date and is the wasm built?
|
> Gotcha, are packages up to date and is the wasm built?
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
yarn tsc
|
yarn tsc
|
||||||
yarn fmt-check
|
yarn fmt-check
|
||||||
@ -493,7 +499,7 @@ PS: for the debug panel, the following JSON is useful for snapping the camera
|
|||||||
|
|
||||||
## KCL
|
## KCL
|
||||||
|
|
||||||
For how to contribute to KCL, [see our KCL README](https://github.com/KittyCAD/modeling-app/tree/main/src/wasm-lib/kcl).
|
For how to contribute to KCL, [see our KCL README](https://github.com/KittyCAD/modeling-app/tree/main/rust/kcl-lib).
|
||||||
|
|
||||||
### Logging
|
### Logging
|
||||||
|
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "QUARTER_TURN"
|
|
||||||
excerpt: ""
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
QUARTER_TURN: number(deg) = 90deg
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "THREE_QUARTER_TURN"
|
|
||||||
excerpt: ""
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
THREE_QUARTER_TURN: number(deg) = 270deg
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
@ -9,7 +9,7 @@ Compute the absolute value of a number.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
abs(num: number) -> number
|
abs(num: number): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -21,11 +21,11 @@ abs(num: number) -> number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `num` | `number` | | Yes |
|
| `num` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -9,7 +9,7 @@ Compute the arccosine of a number (in radians).
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
acos(num: number) -> number
|
acos(num: number): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -21,11 +21,11 @@ acos(num: number) -> number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `num` | `number` | | Yes |
|
| `num` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -9,7 +9,11 @@ Returns the angle to match the given length for x.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angleToMatchLengthX(tag: TagIdentifier, to: number, sketch: Sketch) -> number
|
angleToMatchLengthX(
|
||||||
|
tag: TagIdentifier,
|
||||||
|
to: number,
|
||||||
|
sketch: Sketch,
|
||||||
|
): number
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,13 +21,13 @@ angleToMatchLengthX(tag: TagIdentifier, to: number, sketch: Sketch) -> number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
| [`tag`](/docs/kcl/types/tag) | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
||||||
| `to` | `number` | | Yes |
|
| `to` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -9,7 +9,11 @@ Returns the angle to match the given length for y.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angleToMatchLengthY(tag: TagIdentifier, to: number, sketch: Sketch) -> number
|
angleToMatchLengthY(
|
||||||
|
tag: TagIdentifier,
|
||||||
|
to: number,
|
||||||
|
sketch: Sketch,
|
||||||
|
): number
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,13 +21,13 @@ angleToMatchLengthY(tag: TagIdentifier, to: number, sketch: Sketch) -> number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
| [`tag`](/docs/kcl/types/tag) | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
||||||
| `to` | `number` | | Yes |
|
| `to` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
@ -36,7 +40,7 @@ sketch001 = startSketchOn('XZ')
|
|||||||
angle = angleToMatchLengthY(seg01, 15, %),
|
angle = angleToMatchLengthY(seg01, 15, %),
|
||||||
length = 5
|
length = 5
|
||||||
}, %)
|
}, %)
|
||||||
|> yLineTo(0, %)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
extrusion = extrude(sketch001, length = 5)
|
extrusion = extrude(sketch001, length = 5)
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
---
|
---
|
||||||
title: "angledLine"
|
title: "angledLine"
|
||||||
excerpt: "Draw a line segment relative to the current origin using the polar"
|
excerpt: "Draw a line segment relative to the current origin using the polar measure of some angle and distance."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Draw a line segment relative to the current origin using the polar
|
Draw a line segment relative to the current origin using the polar measure of some angle and distance.
|
||||||
|
|
||||||
|
|
||||||
measure of some angle and distance.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLine(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
angledLine(
|
||||||
|
data: AngledLineData,
|
||||||
|
sketch: Sketch,
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
): Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,23 +22,23 @@ angledLine(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
|
[`Sketch`](/docs/kcl/types/Sketch)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> yLineTo(15, %)
|
|> yLine(endAbsolute = 15)
|
||||||
|> angledLine({ angle = 30, length = 15 }, %)
|
|> angledLine({ angle = 30, length = 15 }, %)
|
||||||
|> line(end = [8, -10])
|
|> line(end = [8, -10])
|
||||||
|> yLineTo(0, %)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
example = extrude(exampleSketch, length = 10)
|
example = extrude(exampleSketch, length = 10)
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
---
|
---
|
||||||
title: "angledLineOfXLength"
|
title: "angledLineOfXLength"
|
||||||
excerpt: "Create a line segment from the current 2-dimensional sketch origin"
|
excerpt: "Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some relative length in the 'x' dimension."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Create a line segment from the current 2-dimensional sketch origin
|
Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some relative length in the 'x' dimension.
|
||||||
|
|
||||||
|
|
||||||
along some angle (in degrees) for some relative length in the 'x' dimension.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineOfXLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
angledLineOfXLength(
|
||||||
|
data: AngledLineData,
|
||||||
|
sketch: Sketch,
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
): Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,18 +22,18 @@ angledLineOfXLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
|
[`Sketch`](/docs/kcl/types/Sketch)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
sketch001 = startSketchOn('XZ')
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLineOfXLength({ angle = 45, length = 10 }, %, $edge1)
|
|> angledLineOfXLength({ angle = 45, length = 10 }, %, $edge1)
|
||||||
|> angledLineOfXLength({ angle = -15, length = 20 }, %, $edge2)
|
|> angledLineOfXLength({ angle = -15, length = 20 }, %, $edge2)
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
---
|
---
|
||||||
title: "angledLineOfYLength"
|
title: "angledLineOfYLength"
|
||||||
excerpt: "Create a line segment from the current 2-dimensional sketch origin"
|
excerpt: "Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some relative length in the 'y' dimension."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Create a line segment from the current 2-dimensional sketch origin
|
Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some relative length in the 'y' dimension.
|
||||||
|
|
||||||
|
|
||||||
along some angle (in degrees) for some relative length in the 'y' dimension.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineOfYLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
angledLineOfYLength(
|
||||||
|
data: AngledLineData,
|
||||||
|
sketch: Sketch,
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
): Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,18 +22,18 @@ angledLineOfYLength(data: AngledLineData, sketch: Sketch, tag?: TagDeclarator) -
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
| `data` | [`AngledLineData`](/docs/kcl/types/AngledLineData) | Data to draw an angled line. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
|
[`Sketch`](/docs/kcl/types/Sketch)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line(end = [10, 0])
|
|> line(end = [10, 0])
|
||||||
|> angledLineOfYLength({ angle = 45, length = 10 }, %)
|
|> angledLineOfYLength({ angle = 45, length = 10 }, %)
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
---
|
---
|
||||||
title: "angledLineThatIntersects"
|
title: "angledLineThatIntersects"
|
||||||
excerpt: "Draw an angled line from the current origin, constructing a line segment"
|
excerpt: "Draw an angled line from the current origin, constructing a line segment such that the newly created line intersects the desired target line segment."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Draw an angled line from the current origin, constructing a line segment
|
Draw an angled line from the current origin, constructing a line segment such that the newly created line intersects the desired target line segment.
|
||||||
|
|
||||||
|
|
||||||
such that the newly created line intersects the desired target line segment.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
angledLineThatIntersects(
|
||||||
|
data: AngledLineThatIntersectsData,
|
||||||
|
sketch: Sketch,
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
): Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,18 +22,18 @@ angledLineThatIntersects(data: AngledLineThatIntersectsData, sketch: Sketch, tag
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`AngledLineThatIntersectsData`](/docs/kcl/types/AngledLineThatIntersectsData) | Data for drawing an angled line that intersects with a given line. | Yes |
|
| `data` | [`AngledLineThatIntersectsData`](/docs/kcl/types/AngledLineThatIntersectsData) | Data for drawing an angled line that intersects with a given line. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
|
[`Sketch`](/docs/kcl/types/Sketch)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line(endAbsolute = [5, 10])
|
|> line(endAbsolute = [5, 10])
|
||||||
|> line(endAbsolute = [-10, 10], tag = $lineToIntersect)
|
|> line(endAbsolute = [-10, 10], tag = $lineToIntersect)
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
---
|
---
|
||||||
title: "angledLineToX"
|
title: "angledLineToX"
|
||||||
excerpt: "Create a line segment from the current 2-dimensional sketch origin"
|
excerpt: "Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some length, ending at the provided value in the 'x' dimension."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Create a line segment from the current 2-dimensional sketch origin
|
Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some length, ending at the provided value in the 'x' dimension.
|
||||||
|
|
||||||
|
|
||||||
along some angle (in degrees) for some length, ending at the provided value in the 'x' dimension.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineToX(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
angledLineToX(
|
||||||
|
data: AngledLineToData,
|
||||||
|
sketch: Sketch,
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
): Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,18 +22,18 @@ angledLineToX(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sk
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes |
|
| `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
|
[`Sketch`](/docs/kcl/types/Sketch)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLineToX({ angle = 30, to = 10 }, %)
|
|> angledLineToX({ angle = 30, to = 10 }, %)
|
||||||
|> line(end = [0, 10])
|
|> line(end = [0, 10])
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
---
|
---
|
||||||
title: "angledLineToY"
|
title: "angledLineToY"
|
||||||
excerpt: "Create a line segment from the current 2-dimensional sketch origin"
|
excerpt: "Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some length, ending at the provided value in the 'y' dimension."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Create a line segment from the current 2-dimensional sketch origin
|
Create a line segment from the current 2-dimensional sketch origin along some angle (in degrees) for some length, ending at the provided value in the 'y' dimension.
|
||||||
|
|
||||||
|
|
||||||
along some angle (in degrees) for some length, ending at the provided value in the 'y' dimension.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
angledLineToY(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
angledLineToY(
|
||||||
|
data: AngledLineToData,
|
||||||
|
sketch: Sketch,
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
): Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,18 +22,18 @@ angledLineToY(data: AngledLineToData, sketch: Sketch, tag?: TagDeclarator) -> Sk
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes |
|
| `data` | [`AngledLineToData`](/docs/kcl/types/AngledLineToData) | Data to draw an angled line to a point. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
|
[`Sketch`](/docs/kcl/types/Sketch)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLineToY({ angle = 60, to = 20 }, %)
|
|> angledLineToY({ angle = 60, to = 20 }, %)
|
||||||
|> line(end = [-20, 0])
|
|> line(end = [-20, 0])
|
||||||
|
File diff suppressed because one or more lines are too long
@ -11,7 +11,11 @@ The arc is constructed such that the current position of the sketch is placed al
|
|||||||
Unless this makes a lot of sense and feels like what you're looking for to construct your shape, you're likely looking for tangentialArc.
|
Unless this makes a lot of sense and feels like what you're looking for to construct your shape, you're likely looking for tangentialArc.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
arc(data: ArcData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
arc(
|
||||||
|
data: ArcData,
|
||||||
|
sketch: Sketch,
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
): Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -20,18 +24,18 @@ arc(data: ArcData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`ArcData`](/docs/kcl/types/ArcData) | Data to draw an arc. | Yes |
|
| `data` | [`ArcData`](/docs/kcl/types/ArcData) | Data to draw an arc. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
|
[`Sketch`](/docs/kcl/types/Sketch)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line(end = [10, 0])
|
|> line(end = [10, 0])
|
||||||
|> arc({
|
|> arc({
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
---
|
---
|
||||||
title: "arcTo"
|
title: "arcTo"
|
||||||
excerpt: "Draw a 3 point arc."
|
excerpt: "Draw a three point arc."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Draw a 3 point arc.
|
Draw a three point arc.
|
||||||
|
|
||||||
The arc is constructed such that the start point is the current position of the sketch and two more points defined as the end and interior point. The interior point is placed between the start point and end point. The radius of the arc will be controlled by how far the interior point is placed from the start and end.
|
The arc is constructed such that the start point is the current position of the sketch and two more points defined as the end and interior point. The interior point is placed between the start point and end point. The radius of the arc will be controlled by how far the interior point is placed from the start and end.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
arcTo(data: ArcToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
arcTo(
|
||||||
|
data: ArcToData,
|
||||||
|
sketch: Sketch,
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
): Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,18 +22,18 @@ arcTo(data: ArcToData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`ArcToData`](/docs/kcl/types/ArcToData) | Data to draw a three point arc (arcTo). | Yes |
|
| `data` | [`ArcToData`](/docs/kcl/types/ArcToData) | Data to draw a three point arc (arcTo). | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
|
[`Sketch`](/docs/kcl/types/Sketch)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> arcTo({ end = [10, 0], interior = [5, 5] }, %)
|
|> arcTo({ end = [10, 0], interior = [5, 5] }, %)
|
||||||
|> close()
|
|> close()
|
||||||
|
@ -9,7 +9,7 @@ Compute the arcsine of a number (in radians).
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
asin(num: number) -> number
|
asin(num: number): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -21,11 +21,11 @@ asin(num: number) -> number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `num` | `number` | | Yes |
|
| `num` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
@ -37,7 +37,7 @@ sketch001 = startSketchOn('XZ')
|
|||||||
angle = toDegrees(asin(0.5)),
|
angle = toDegrees(asin(0.5)),
|
||||||
length = 20
|
length = 20
|
||||||
}, %)
|
}, %)
|
||||||
|> yLineTo(0, %)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
extrude001 = extrude(sketch001, length = 5)
|
extrude001 = extrude(sketch001, length = 5)
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
---
|
---
|
||||||
title: "assert"
|
title: "assert"
|
||||||
excerpt: "Check a value at runtime, and raise an error if the argument provided"
|
excerpt: "Check a value at runtime, and raise an error if the argument provided is false."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Check a value at runtime, and raise an error if the argument provided
|
Check a value at runtime, and raise an error if the argument provided is false.
|
||||||
|
|
||||||
|
|
||||||
is false.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert(data: bool, message: string) -> ()
|
assert(
|
||||||
|
data: bool,
|
||||||
|
message: string,
|
||||||
|
): ()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,8 +20,8 @@ assert(data: bool, message: string) -> ()
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | `bool` | | Yes |
|
| `data` | [`bool`](/docs/kcl/types/bool) | | Yes |
|
||||||
| `message` | `string` | | Yes |
|
| `message` | [`string`](/docs/kcl/types/string) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -1,15 +1,20 @@
|
|||||||
---
|
---
|
||||||
title: "assertEqual"
|
title: "assertEqual"
|
||||||
excerpt: "Check that a numerical value equals another at runtime,"
|
excerpt: "Check that a numerical value equals another at runtime, otherwise raise an error."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Check that a numerical value equals another at runtime,
|
Check that a numerical value equals another at runtime, otherwise raise an error.
|
||||||
|
|
||||||
|
|
||||||
otherwise raise an error.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assertEqual(left: number, right: number, epsilon: number, message: string) -> ()
|
assertEqual(
|
||||||
|
left: number,
|
||||||
|
right: number,
|
||||||
|
epsilon: number,
|
||||||
|
message: string,
|
||||||
|
): ()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,10 +22,10 @@ assertEqual(left: number, right: number, epsilon: number, message: string) -> ()
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `left` | `number` | | Yes |
|
| `left` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `right` | `number` | | Yes |
|
| `right` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `epsilon` | `number` | | Yes |
|
| `epsilon` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `message` | `string` | | Yes |
|
| `message` | [`string`](/docs/kcl/types/string) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
---
|
---
|
||||||
title: "assertGreaterThan"
|
title: "assertGreaterThan"
|
||||||
excerpt: "Check that a numerical value is greater than another at runtime,"
|
excerpt: "Check that a numerical value is greater than another at runtime, otherwise raise an error."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Check that a numerical value is greater than another at runtime,
|
Check that a numerical value is greater than another at runtime, otherwise raise an error.
|
||||||
|
|
||||||
|
|
||||||
otherwise raise an error.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assertGreaterThan(left: number, right: number, message: string) -> ()
|
assertGreaterThan(
|
||||||
|
left: number,
|
||||||
|
right: number,
|
||||||
|
message: string,
|
||||||
|
): ()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,9 +21,9 @@ assertGreaterThan(left: number, right: number, message: string) -> ()
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `left` | `number` | | Yes |
|
| `left` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `right` | `number` | | Yes |
|
| `right` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `message` | `string` | | Yes |
|
| `message` | [`string`](/docs/kcl/types/string) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
---
|
---
|
||||||
title: "assertGreaterThanOrEq"
|
title: "assertGreaterThanOrEq"
|
||||||
excerpt: "Check that a numerical value is greater than or equal to another at runtime,"
|
excerpt: "Check that a numerical value is greater than or equal to another at runtime, otherwise raise an error."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Check that a numerical value is greater than or equal to another at runtime,
|
Check that a numerical value is greater than or equal to another at runtime, otherwise raise an error.
|
||||||
|
|
||||||
|
|
||||||
otherwise raise an error.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assertGreaterThanOrEq(left: number, right: number, message: string) -> ()
|
assertGreaterThanOrEq(
|
||||||
|
left: number,
|
||||||
|
right: number,
|
||||||
|
message: string,
|
||||||
|
): ()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,9 +21,9 @@ assertGreaterThanOrEq(left: number, right: number, message: string) -> ()
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `left` | `number` | | Yes |
|
| `left` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `right` | `number` | | Yes |
|
| `right` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `message` | `string` | | Yes |
|
| `message` | [`string`](/docs/kcl/types/string) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
---
|
---
|
||||||
title: "assertLessThan"
|
title: "assertLessThan"
|
||||||
excerpt: "Check that a numerical value is less than to another at runtime,"
|
excerpt: "Check that a numerical value is less than to another at runtime, otherwise raise an error."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Check that a numerical value is less than to another at runtime,
|
Check that a numerical value is less than to another at runtime, otherwise raise an error.
|
||||||
|
|
||||||
|
|
||||||
otherwise raise an error.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assertLessThan(left: number, right: number, message: string) -> ()
|
assertLessThan(
|
||||||
|
left: number,
|
||||||
|
right: number,
|
||||||
|
message: string,
|
||||||
|
): ()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,9 +21,9 @@ assertLessThan(left: number, right: number, message: string) -> ()
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `left` | `number` | | Yes |
|
| `left` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `right` | `number` | | Yes |
|
| `right` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `message` | `string` | | Yes |
|
| `message` | [`string`](/docs/kcl/types/string) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
---
|
---
|
||||||
title: "assertLessThanOrEq"
|
title: "assertLessThanOrEq"
|
||||||
excerpt: "Check that a numerical value is less than or equal to another at runtime,"
|
excerpt: "Check that a numerical value is less than or equal to another at runtime, otherwise raise an error."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Check that a numerical value is less than or equal to another at runtime,
|
Check that a numerical value is less than or equal to another at runtime, otherwise raise an error.
|
||||||
|
|
||||||
|
|
||||||
otherwise raise an error.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assertLessThanOrEq(left: number, right: number, message: string) -> ()
|
assertLessThanOrEq(
|
||||||
|
left: number,
|
||||||
|
right: number,
|
||||||
|
message: string,
|
||||||
|
): ()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,9 +21,9 @@ assertLessThanOrEq(left: number, right: number, message: string) -> ()
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `left` | `number` | | Yes |
|
| `left` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `right` | `number` | | Yes |
|
| `right` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `message` | `string` | | Yes |
|
| `message` | [`string`](/docs/kcl/types/string) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Compute the arctangent of a number (in radians).
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
atan(num: number) -> number
|
atan(num: number): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -21,11 +21,11 @@ atan(num: number) -> number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `num` | `number` | | Yes |
|
| `num` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
@ -37,7 +37,7 @@ sketch001 = startSketchOn('XZ')
|
|||||||
angle = toDegrees(atan(1.25)),
|
angle = toDegrees(atan(1.25)),
|
||||||
length = 20
|
length = 20
|
||||||
}, %)
|
}, %)
|
||||||
|> yLineTo(0, %)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
extrude001 = extrude(sketch001, length = 5)
|
extrude001 = extrude(sketch001, length = 5)
|
||||||
|
@ -9,7 +9,10 @@ Compute the four quadrant arctangent of Y and X (in radians).
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
atan2(y: number, x: number) -> number
|
atan2(
|
||||||
|
y: number,
|
||||||
|
x: number,
|
||||||
|
): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -21,12 +24,12 @@ atan2(y: number, x: number) -> number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `y` | `number` | | Yes |
|
| `y` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `x` | `number` | | Yes |
|
| `x` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
@ -38,7 +41,7 @@ sketch001 = startSketchOn('XZ')
|
|||||||
angle = toDegrees(atan2(1.25, 2)),
|
angle = toDegrees(atan2(1.25, 2)),
|
||||||
length = 20
|
length = 20
|
||||||
}, %)
|
}, %)
|
||||||
|> yLineTo(0, %)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
extrude001 = extrude(sketch001, length = 5)
|
extrude001 = extrude(sketch001, length = 5)
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
---
|
---
|
||||||
title: "bezierCurve"
|
title: "bezierCurve"
|
||||||
excerpt: "Draw a smooth, continuous, curved line segment from the current origin to"
|
excerpt: "Draw a smooth, continuous, curved line segment from the current origin to the desired (x, y), using a number of control points to shape the curve's shape."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Draw a smooth, continuous, curved line segment from the current origin to
|
Draw a smooth, continuous, curved line segment from the current origin to the desired (x, y), using a number of control points to shape the curve's shape.
|
||||||
|
|
||||||
|
|
||||||
the desired (x, y), using a number of control points to shape the curve's shape.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
bezierCurve(data: BezierData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
bezierCurve(
|
||||||
|
data: BezierData,
|
||||||
|
sketch: Sketch,
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
): Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,18 +22,18 @@ bezierCurve(data: BezierData, sketch: Sketch, tag?: TagDeclarator) -> Sketch
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`BezierData`](/docs/kcl/types/BezierData) | Data to draw a bezier curve. | Yes |
|
| `data` | [`BezierData`](/docs/kcl/types/BezierData) | Data to draw a bezier curve. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
|
[`Sketch`](/docs/kcl/types/Sketch)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn('XZ')
|
exampleSketch = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line(end = [0, 10])
|
|> line(end = [0, 10])
|
||||||
|> bezierCurve({
|
|> bezierCurve({
|
||||||
|
@ -9,7 +9,7 @@ Compute the smallest integer greater than or equal to a number.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
ceil(num: number) -> number
|
ceil(num: number): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -21,11 +21,11 @@ ceil(num: number) -> number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `num` | `number` | | Yes |
|
| `num` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
@ -35,7 +35,7 @@ sketch001 = startSketchOn('XZ')
|
|||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line(endAbsolute = [12, 10])
|
|> line(endAbsolute = [12, 10])
|
||||||
|> line(end = [ceil(7.02986), 0])
|
|> line(end = [ceil(7.02986), 0])
|
||||||
|> yLineTo(0, %)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
extrude001 = extrude(sketch001, length = 5)
|
extrude001 = extrude(sketch001, length = 5)
|
||||||
|
@ -9,7 +9,12 @@ Cut a straight transitional edge along a tagged path.
|
|||||||
Chamfer is similar in function and use to a fillet, except a fillet will blend the transition along an edge, rather than cut a sharp, straight transitional edge.
|
Chamfer is similar in function and use to a fillet, except a fillet will blend the transition along an edge, rather than cut a sharp, straight transitional edge.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
chamfer(solid: Solid, length: number, tags: [EdgeReference], tag?: TagDeclarator) -> Solid
|
chamfer(
|
||||||
|
solid: Solid,
|
||||||
|
length: number,
|
||||||
|
tags: [EdgeReference],
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
): Solid
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,13 +23,13 @@ chamfer(solid: Solid, length: number, tags: [EdgeReference], tag?: TagDeclarator
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `solid` | [`Solid`](/docs/kcl/types/Solid) | The solid whose edges should be chamfered | Yes |
|
| `solid` | [`Solid`](/docs/kcl/types/Solid) | The solid whose edges should be chamfered | Yes |
|
||||||
| `length` | `number` | The length of the chamfer | Yes |
|
| `length` | [`number`](/docs/kcl/types/number) | The length of the chamfer | Yes |
|
||||||
| `tags` | [`[EdgeReference]`](/docs/kcl/types/EdgeReference) | The paths you want to chamfer | Yes |
|
| `tags` | [`[EdgeReference]`](/docs/kcl/types/EdgeReference) | The paths you want to chamfer | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this chamfer | No |
|
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this chamfer | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Solid`](/docs/kcl/types/Solid) - A solid is a collection of extrude surfaces.
|
[`Solid`](/docs/kcl/types/Solid)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -1,15 +1,20 @@
|
|||||||
---
|
---
|
||||||
title: "circle"
|
title: "circle"
|
||||||
excerpt: "Construct a 2-dimensional circle, of the specified radius, centered at"
|
excerpt: "Construct a 2-dimensional circle, of the specified radius, centered at the provided (x, y) origin point."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Construct a 2-dimensional circle, of the specified radius, centered at
|
Construct a 2-dimensional circle, of the specified radius, centered at the provided (x, y) origin point.
|
||||||
|
|
||||||
|
|
||||||
the provided (x, y) origin point.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
circle(data: CircleData, sketchSurfaceOrGroup: SketchOrSurface, tag?: TagDeclarator) -> Sketch
|
circle(
|
||||||
|
sketchOrSurface: SketchOrSurface,
|
||||||
|
center: [number],
|
||||||
|
radius: number,
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
): Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,20 +22,21 @@ circle(data: CircleData, sketchSurfaceOrGroup: SketchOrSurface, tag?: TagDeclara
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`CircleData`](/docs/kcl/types/CircleData) | Data for drawing an circle | Yes |
|
| `sketchOrSurface` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes |
|
||||||
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | A sketch surface or a sketch. | Yes |
|
| `center` | [`[number]`](/docs/kcl/types/number) | The center of the circle. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | | No |
|
| `radius` | [`number`](/docs/kcl/types/number) | The radius of the circle. | Yes |
|
||||||
|
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this circle | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
|
[`Sketch`](/docs/kcl/types/Sketch)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn("-XZ")
|
exampleSketch = startSketchOn("-XZ")
|
||||||
|> circle({ center = [0, 0], radius = 10 }, %)
|
|> circle(center = [0, 0], radius = 10)
|
||||||
|
|
||||||
example = extrude(exampleSketch, length = 5)
|
example = extrude(exampleSketch, length = 5)
|
||||||
```
|
```
|
||||||
@ -44,7 +50,7 @@ exampleSketch = startSketchOn("XZ")
|
|||||||
|> line(end = [0, 30])
|
|> line(end = [0, 30])
|
||||||
|> line(end = [-30, 0])
|
|> line(end = [-30, 0])
|
||||||
|> close()
|
|> close()
|
||||||
|> hole(circle({ center = [0, 15], radius = 5 }, %), %)
|
|> hole(circle(center = [0, 15], radius = 5), %)
|
||||||
|
|
||||||
example = extrude(exampleSketch, length = 5)
|
example = extrude(exampleSketch, length = 5)
|
||||||
```
|
```
|
||||||
|
@ -9,7 +9,13 @@ Construct a circle derived from 3 points.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
circleThreePoint(p1: [number], p2: [number], p3: [number], sketchSurfaceOrGroup: SketchOrSurface, tag?: TagDeclarator) -> Sketch
|
circleThreePoint(
|
||||||
|
p1: [number],
|
||||||
|
p2: [number],
|
||||||
|
p3: [number],
|
||||||
|
sketchSurfaceOrGroup: SketchOrSurface,
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
): Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,15 +23,15 @@ circleThreePoint(p1: [number], p2: [number], p3: [number], sketchSurfaceOrGroup:
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `p1` | `[number]` | 1st point to derive the circle. | Yes |
|
| `p1` | [`[number]`](/docs/kcl/types/number) | 1st point to derive the circle. | Yes |
|
||||||
| `p2` | `[number]` | 2nd point to derive the circle. | Yes |
|
| `p2` | [`[number]`](/docs/kcl/types/number) | 2nd point to derive the circle. | Yes |
|
||||||
| `p3` | `[number]` | 3rd point to derive the circle. | Yes |
|
| `p3` | [`[number]`](/docs/kcl/types/number) | 3rd point to derive the circle. | Yes |
|
||||||
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes |
|
| `sketchSurfaceOrGroup` | [`SketchOrSurface`](/docs/kcl/types/SketchOrSurface) | Plane or surface to sketch on. | Yes |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Identifier for the circle to reference elsewhere. | No |
|
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Identifier for the circle to reference elsewhere. | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
|
[`Sketch`](/docs/kcl/types/Sketch)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
File diff suppressed because one or more lines are too long
@ -15,7 +15,7 @@ For example, if the current project uses inches, this function will return `0.39
|
|||||||
We merely provide these functions for convenience and readability, as `10 * cm()` is more readable that your intent is "I want 10 centimeters" than `10 * 10`, if the project settings are in millimeters.
|
We merely provide these functions for convenience and readability, as `10 * cm()` is more readable that your intent is "I want 10 centimeters" than `10 * 10`, if the project settings are in millimeters.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
cm() -> number
|
cm(): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -26,7 +26,7 @@ cm() -> number
|
|||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "HALF_TURN"
|
|
||||||
excerpt: ""
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
HALF_TURN: number(deg) = 180deg
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "QUARTER_TURN"
|
|
||||||
excerpt: ""
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
QUARTER_TURN: number(deg) = 90deg
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "THREE_QUARTER_TURN"
|
|
||||||
excerpt: ""
|
|
||||||
layout: manual
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
THREE_QUARTER_TURN: number(deg) = 270deg
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: "ZERO"
|
title: "std::XY"
|
||||||
excerpt: ""
|
excerpt: ""
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
@ -9,7 +9,7 @@ layout: manual
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
ZERO: number = 0
|
std::XY
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: "ZERO"
|
title: "std::XZ"
|
||||||
excerpt: ""
|
excerpt: ""
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
@ -9,7 +9,7 @@ layout: manual
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
ZERO: number = 0
|
std::XZ
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: "HALF_TURN"
|
title: "std::YZ"
|
||||||
excerpt: ""
|
excerpt: ""
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
@ -9,7 +9,7 @@ layout: manual
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
HALF_TURN: number(deg) = 180deg
|
std::YZ
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@ exampleSketch = startSketchOn("XZ")
|
|||||||
angle = 30,
|
angle = 30,
|
||||||
length = 2 * E ^ 2,
|
length = 2 * E ^ 2,
|
||||||
}, %)
|
}, %)
|
||||||
|> yLineTo(0, %)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
example = extrude(exampleSketch, length = 10)
|
example = extrude(exampleSketch, length = 10)
|
||||||
|
@ -18,7 +18,7 @@ std::math::PI: number = 3.14159265358979323846264338327950288_
|
|||||||
circumference = 70
|
circumference = 70
|
||||||
|
|
||||||
exampleSketch = startSketchOn("XZ")
|
exampleSketch = startSketchOn("XZ")
|
||||||
|> circle({ center = [0, 0], radius = circumference/ (2 * PI) }, %)
|
|> circle(center = [0, 0], radius = circumference/ (2 * PI))
|
||||||
|
|
||||||
example = extrude(exampleSketch, length = 5)
|
example = extrude(exampleSketch, length = 5)
|
||||||
```
|
```
|
||||||
|
File diff suppressed because one or more lines are too long
@ -11,7 +11,7 @@ Return the value of Euler’s number `e`.
|
|||||||
**DEPRECATED** use the constant E
|
**DEPRECATED** use the constant E
|
||||||
|
|
||||||
```js
|
```js
|
||||||
e() -> number
|
e(): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -22,7 +22,7 @@ e() -> number
|
|||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
@ -31,7 +31,7 @@ e() -> number
|
|||||||
exampleSketch = startSketchOn("XZ")
|
exampleSketch = startSketchOn("XZ")
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> angledLine({ angle = 30, length = 2 * e() ^ 2 }, %)
|
|> angledLine({ angle = 30, length = 2 * e() ^ 2 }, %)
|
||||||
|> yLineTo(0, %)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
example = extrude(exampleSketch, length = 10)
|
example = extrude(exampleSketch, length = 10)
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
---
|
---
|
||||||
title: "extrude"
|
title: "extrude"
|
||||||
excerpt: "Extend a 2-dimensional sketch through a third dimension in order to"
|
excerpt: "Extend a 2-dimensional sketch through a third dimension in order to create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Extend a 2-dimensional sketch through a third dimension in order to
|
Extend a 2-dimensional sketch through a third dimension in order to create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid.
|
||||||
|
|
||||||
|
|
||||||
create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
extrude(sketchSet: SketchSet, length: number) -> SolidSet
|
extrude(
|
||||||
|
sketchSet: SketchSet,
|
||||||
|
length: number,
|
||||||
|
): SolidSet
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,7 +21,7 @@ extrude(sketchSet: SketchSet, length: number) -> SolidSet
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketches should be extruded | Yes |
|
| `sketchSet` | [`SketchSet`](/docs/kcl/types/SketchSet) | Which sketches should be extruded | Yes |
|
||||||
| `length` | `number` | How far to extrude the given sketches | Yes |
|
| `length` | [`number`](/docs/kcl/types/number) | How far to extrude the given sketches | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,13 @@ Blend a transitional edge along a tagged path, smoothing the sharp edge.
|
|||||||
Fillet is similar in function and use to a chamfer, except a chamfer will cut a sharp transition along an edge while fillet will smoothly blend the transition.
|
Fillet is similar in function and use to a chamfer, except a chamfer will cut a sharp transition along an edge while fillet will smoothly blend the transition.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
fillet(solid: Solid, radius: number, tags: [EdgeReference], tolerance?: number, tag?: TagDeclarator) -> Solid
|
fillet(
|
||||||
|
solid: Solid,
|
||||||
|
radius: number,
|
||||||
|
tags: [EdgeReference],
|
||||||
|
tolerance?: number,
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
): Solid
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,14 +24,14 @@ fillet(solid: Solid, radius: number, tags: [EdgeReference], tolerance?: number,
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `solid` | [`Solid`](/docs/kcl/types/Solid) | The solid whose edges should be filletted | Yes |
|
| `solid` | [`Solid`](/docs/kcl/types/Solid) | The solid whose edges should be filletted | Yes |
|
||||||
| `radius` | `number` | The radius of the fillet | Yes |
|
| `radius` | [`number`](/docs/kcl/types/number) | The radius of the fillet | Yes |
|
||||||
| `tags` | [`[EdgeReference]`](/docs/kcl/types/EdgeReference) | The paths you want to fillet | Yes |
|
| `tags` | [`[EdgeReference]`](/docs/kcl/types/EdgeReference) | The paths you want to fillet | Yes |
|
||||||
| `tolerance` | `number` | The tolerance for this fillet | No |
|
| `tolerance` | [`number`](/docs/kcl/types/number) | The tolerance for this fillet | No |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this fillet | No |
|
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this fillet | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Solid`](/docs/kcl/types/Solid) - A solid is a collection of extrude surfaces.
|
[`Solid`](/docs/kcl/types/Solid)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -9,7 +9,7 @@ Compute the largest integer less than or equal to a number.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
floor(num: number) -> number
|
floor(num: number): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -21,11 +21,11 @@ floor(num: number) -> number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `num` | `number` | | Yes |
|
| `num` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
@ -35,7 +35,7 @@ sketch001 = startSketchOn('XZ')
|
|||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line(endAbsolute = [12, 10])
|
|> line(endAbsolute = [12, 10])
|
||||||
|> line(end = [floor(7.02986), 0])
|
|> line(end = [floor(7.02986), 0])
|
||||||
|> yLineTo(0, %)
|
|> yLine(endAbsolute = 0)
|
||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
extrude001 = extrude(sketch001, length = 5)
|
extrude001 = extrude(sketch001, length = 5)
|
||||||
|
@ -15,7 +15,7 @@ For example, if the current project uses inches, this function will return `12`.
|
|||||||
We merely provide these functions for convenience and readability, as `10 * ft()` is more readable that your intent is "I want 10 feet" than `10 * 304.8`, if the project settings are in millimeters.
|
We merely provide these functions for convenience and readability, as `10 * ft()` is more readable that your intent is "I want 10 feet" than `10 * 304.8`, if the project settings are in millimeters.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
ft() -> number
|
ft(): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -26,7 +26,7 @@ ft() -> number
|
|||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -9,7 +9,7 @@ Get the next adjacent edge to the edge given.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
getNextAdjacentEdge(tag: TagIdentifier) -> Uuid
|
getNextAdjacentEdge(tag: TagIdentifier): Uuid
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ getNextAdjacentEdge(tag: TagIdentifier) -> Uuid
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
| [`tag`](/docs/kcl/types/tag) | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Get the opposite edge to the edge given.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
getOppositeEdge(tag: TagIdentifier) -> Uuid
|
getOppositeEdge(tag: TagIdentifier): Uuid
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ getOppositeEdge(tag: TagIdentifier) -> Uuid
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
| [`tag`](/docs/kcl/types/tag) | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Get the previous adjacent edge to the edge given.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
getPreviousAdjacentEdge(tag: TagIdentifier) -> Uuid
|
getPreviousAdjacentEdge(tag: TagIdentifier): Uuid
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ getPreviousAdjacentEdge(tag: TagIdentifier) -> Uuid
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `tag` | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
| [`tag`](/docs/kcl/types/tag) | [`TagIdentifier`](/docs/kcl/types#tag-identifier) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
|
@ -9,7 +9,14 @@ Create a helix.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
helix(revolutions: number, angleStart: number, ccw?: bool, radius: number, axis: Axis3dOrEdgeReference, length?: number) -> HelixValue
|
helix(
|
||||||
|
revolutions: number,
|
||||||
|
angleStart: number,
|
||||||
|
ccw?: bool,
|
||||||
|
radius: number,
|
||||||
|
axis: Axis3dOrEdgeReference,
|
||||||
|
length?: number,
|
||||||
|
): HelixValue
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,12 +24,12 @@ helix(revolutions: number, angleStart: number, ccw?: bool, radius: number, axis:
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `revolutions` | `number` | Number of revolutions. | Yes |
|
| `revolutions` | [`number`](/docs/kcl/types/number) | Number of revolutions. | Yes |
|
||||||
| `angleStart` | `number` | Start angle (in degrees). | Yes |
|
| `angleStart` | [`number`](/docs/kcl/types/number) | Start angle (in degrees). | Yes |
|
||||||
| `ccw` | `bool` | Is the helix rotation counter clockwise? The default is `false`. | No |
|
| `ccw` | [`bool`](/docs/kcl/types/bool) | Is the helix rotation counter clockwise? The default is `false`. | No |
|
||||||
| `radius` | `number` | Radius of the helix. | Yes |
|
| `radius` | [`number`](/docs/kcl/types/number) | Radius of the helix. | Yes |
|
||||||
| `axis` | [`Axis3dOrEdgeReference`](/docs/kcl/types/Axis3dOrEdgeReference) | Axis to use for the helix. | Yes |
|
| `axis` | [`Axis3dOrEdgeReference`](/docs/kcl/types/Axis3dOrEdgeReference) | Axis to use for the helix. | Yes |
|
||||||
| `length` | `number` | Length of the helix. This is not necessary if the helix is created around an edge. If not given the length of the edge is used. | No |
|
| `length` | [`number`](/docs/kcl/types/number) | Length of the helix. This is not necessary if the helix is created around an edge. If not given the length of the edge is used. | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@ -44,7 +51,7 @@ helixPath = helix(
|
|||||||
|
|
||||||
// Create a spring by sweeping around the helix path.
|
// Create a spring by sweeping around the helix path.
|
||||||
springSketch = startSketchOn('YZ')
|
springSketch = startSketchOn('YZ')
|
||||||
|> circle({ center = [0, 0], radius = 0.5 }, %)
|
|> circle(center = [0, 0], radius = 0.5)
|
||||||
|> sweep(path = helixPath)
|
|> sweep(path = helixPath)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -67,7 +74,7 @@ helixPath = helix(
|
|||||||
|
|
||||||
// Create a spring by sweeping around the helix path.
|
// Create a spring by sweeping around the helix path.
|
||||||
springSketch = startSketchOn('XY')
|
springSketch = startSketchOn('XY')
|
||||||
|> circle({ center = [0, 0], radius = 0.5 }, %)
|
|> circle(center = [0, 0], radius = 0.5)
|
||||||
|> sweep(path = helixPath)
|
|> sweep(path = helixPath)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -91,7 +98,7 @@ helixPath = helix(
|
|||||||
|
|
||||||
// Create a spring by sweeping around the helix path.
|
// Create a spring by sweeping around the helix path.
|
||||||
springSketch = startSketchOn('XY')
|
springSketch = startSketchOn('XY')
|
||||||
|> circle({ center = [0, 0], radius = 1 }, %)
|
|> circle(center = [0, 0], radius = 1)
|
||||||
|> sweep(path = helixPath)
|
|> sweep(path = helixPath)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -9,7 +9,10 @@ Create a helix on a cylinder.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
helixRevolutions(data: HelixRevolutionsData, solid: Solid) -> Solid
|
helixRevolutions(
|
||||||
|
data: HelixRevolutionsData,
|
||||||
|
solid: Solid,
|
||||||
|
): Solid
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,18 +21,18 @@ helixRevolutions(data: HelixRevolutionsData, solid: Solid) -> Solid
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `data` | [`HelixRevolutionsData`](/docs/kcl/types/HelixRevolutionsData) | Data for helix revolutions. | Yes |
|
| `data` | [`HelixRevolutionsData`](/docs/kcl/types/HelixRevolutionsData) | Data for helix revolutions. | Yes |
|
||||||
| `solid` | [`Solid`](/docs/kcl/types/Solid) | A solid is a collection of extrude surfaces. | Yes |
|
| `solid` | [`Solid`](/docs/kcl/types/Solid) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Solid`](/docs/kcl/types/Solid) - A solid is a collection of extrude surfaces.
|
[`Solid`](/docs/kcl/types/Solid)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
part001 = startSketchOn('XY')
|
part001 = startSketchOn('XY')
|
||||||
|> circle({ center = [5, 5], radius = 10 }, %)
|
|> circle(center = [5, 5], radius = 10)
|
||||||
|> extrude(length = 10)
|
|> extrude(length = 10)
|
||||||
|> helixRevolutions({
|
|> helixRevolutions({
|
||||||
angleStart = 0,
|
angleStart = 0,
|
||||||
|
@ -9,7 +9,10 @@ Use a 2-dimensional sketch to cut a hole in another 2-dimensional sketch.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
hole(holeSketch: SketchSet, sketch: Sketch) -> Sketch
|
hole(
|
||||||
|
holeSketch: SketchSet,
|
||||||
|
sketch: Sketch,
|
||||||
|
): Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,24 +21,24 @@ hole(holeSketch: SketchSet, sketch: Sketch) -> Sketch
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `holeSketch` | [`SketchSet`](/docs/kcl/types/SketchSet) | A sketch or a group of sketches. | Yes |
|
| `holeSketch` | [`SketchSet`](/docs/kcl/types/SketchSet) | A sketch or a group of sketches. | Yes |
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
|
[`Sketch`](/docs/kcl/types/Sketch)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
exampleSketch = startSketchOn('XY')
|
exampleSketch = startSketchOn(XY)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
|> line(end = [0, 5])
|
|> line(end = [0, 5])
|
||||||
|> line(end = [5, 0])
|
|> line(end = [5, 0])
|
||||||
|> line(end = [0, -5])
|
|> line(end = [0, -5])
|
||||||
|> close()
|
|> close()
|
||||||
|> hole(circle({ center = [1, 1], radius = .25 }, %), %)
|
|> hole(circle(center = [1, 1], radius = .25), %)
|
||||||
|> hole(circle({ center = [1, 4], radius = .25 }, %), %)
|
|> hole(circle(center = [1, 4], radius = .25), %)
|
||||||
|
|
||||||
example = extrude(exampleSketch, length = 1)
|
example = extrude(exampleSketch, length = 1)
|
||||||
```
|
```
|
||||||
@ -44,7 +47,7 @@ example = extrude(exampleSketch, length = 1)
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
fn squareHoleSketch() {
|
fn squareHoleSketch() {
|
||||||
squareSketch = startSketchOn('-XZ')
|
squareSketch = startSketchOn(-XZ)
|
||||||
|> startProfileAt([-1, -1], %)
|
|> startProfileAt([-1, -1], %)
|
||||||
|> line(end = [2, 0])
|
|> line(end = [2, 0])
|
||||||
|> line(end = [0, 2])
|
|> line(end = [0, 2])
|
||||||
@ -53,8 +56,8 @@ fn squareHoleSketch() {
|
|||||||
return squareSketch
|
return squareSketch
|
||||||
}
|
}
|
||||||
|
|
||||||
exampleSketch = startSketchOn('-XZ')
|
exampleSketch = startSketchOn(-XZ)
|
||||||
|> circle({ center = [0, 0], radius = 3 }, %)
|
|> circle(center = [0, 0], radius = 3)
|
||||||
|> hole(squareHoleSketch(), %)
|
|> hole(squareHoleSketch(), %)
|
||||||
example = extrude(exampleSketch, length = 1)
|
example = extrude(exampleSketch, length = 1)
|
||||||
```
|
```
|
||||||
|
@ -9,7 +9,10 @@ Make the inside of a 3D object hollow.
|
|||||||
Remove volume from a 3-dimensional shape such that a wall of the provided thickness remains around the exterior of the shape.
|
Remove volume from a 3-dimensional shape such that a wall of the provided thickness remains around the exterior of the shape.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
hollow(thickness: number, solid: Solid) -> Solid
|
hollow(
|
||||||
|
thickness: number,
|
||||||
|
solid: Solid,
|
||||||
|
): Solid
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -17,12 +20,12 @@ hollow(thickness: number, solid: Solid) -> Solid
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `thickness` | `number` | | Yes |
|
| `thickness` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `solid` | [`Solid`](/docs/kcl/types/Solid) | A solid is a collection of extrude surfaces. | Yes |
|
| `solid` | [`Solid`](/docs/kcl/types/Solid) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Solid`](/docs/kcl/types/Solid) - A solid is a collection of extrude surfaces.
|
[`Solid`](/docs/kcl/types/Solid)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
@ -67,17 +70,11 @@ case = startSketchOn('-XZ')
|
|||||||
|> extrude(length = 65)
|
|> extrude(length = 65)
|
||||||
|
|
||||||
thing1 = startSketchOn(case, 'end')
|
thing1 = startSketchOn(case, 'end')
|
||||||
|> circle({
|
|> circle(center = [-size / 2, -size / 2], radius = 25)
|
||||||
center = [-size / 2, -size / 2],
|
|
||||||
radius = 25
|
|
||||||
}, %)
|
|
||||||
|> extrude(length = 50)
|
|> extrude(length = 50)
|
||||||
|
|
||||||
thing2 = startSketchOn(case, 'end')
|
thing2 = startSketchOn(case, 'end')
|
||||||
|> circle({
|
|> circle(center = [size / 2, -size / 2], radius = 25)
|
||||||
center = [size / 2, -size / 2],
|
|
||||||
radius = 25
|
|
||||||
}, %)
|
|
||||||
|> extrude(length = 50)
|
|> extrude(length = 50)
|
||||||
|
|
||||||
hollow(0.5, case)
|
hollow(0.5, case)
|
||||||
|
@ -15,7 +15,10 @@ For formats lacking unit data (such as STL, OBJ, or PLY files), the default unit
|
|||||||
Note: The import command currently only works when using the native Modeling App.
|
Note: The import command currently only works when using the native Modeling App.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import(filePath: String, options?: ImportFormat) -> ImportedGeometry
|
import(
|
||||||
|
filePath: String,
|
||||||
|
options?: ImportFormat,
|
||||||
|
): ImportedGeometry
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ For example, if the current project uses inches, this function will return `1`.
|
|||||||
We merely provide these functions for convenience and readability, as `10 * inch()` is more readable that your intent is "I want 10 inches" than `10 * 25.4`, if the project settings are in millimeters.
|
We merely provide these functions for convenience and readability, as `10 * inch()` is more readable that your intent is "I want 10 inches" than `10 * 25.4`, if the project settings are in millimeters.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
inch() -> number
|
inch(): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -26,7 +26,7 @@ inch() -> number
|
|||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -6,13 +6,30 @@ layout: manual
|
|||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
* [Types](kcl/types)
|
### Language
|
||||||
* [Modules](kcl/modules)
|
|
||||||
* [Known Issues](kcl/KNOWN-ISSUES)
|
* [`Types`](kcl/types)
|
||||||
* **`std`**
|
* [`Modules`](kcl/modules)
|
||||||
|
* [`Settings`](kcl/settings)
|
||||||
|
* [`Known Issues`](kcl/known-issues)
|
||||||
|
|
||||||
|
### Standard library
|
||||||
|
|
||||||
|
* **Primitive types**
|
||||||
|
* [`bool`](kcl/bool)
|
||||||
|
* [`number`](kcl/number)
|
||||||
|
* [`string`](kcl/string)
|
||||||
|
* [`tag`](kcl/tag)
|
||||||
|
* **std**
|
||||||
* [`HALF_TURN`](kcl/const_std-HALF_TURN)
|
* [`HALF_TURN`](kcl/const_std-HALF_TURN)
|
||||||
|
* [`Plane`](kcl/Plane)
|
||||||
* [`QUARTER_TURN`](kcl/const_std-QUARTER_TURN)
|
* [`QUARTER_TURN`](kcl/const_std-QUARTER_TURN)
|
||||||
|
* [`Sketch`](kcl/Sketch)
|
||||||
|
* [`Solid`](kcl/Solid)
|
||||||
* [`THREE_QUARTER_TURN`](kcl/const_std-THREE_QUARTER_TURN)
|
* [`THREE_QUARTER_TURN`](kcl/const_std-THREE_QUARTER_TURN)
|
||||||
|
* [`XY`](kcl/const_std-XY)
|
||||||
|
* [`XZ`](kcl/const_std-XZ)
|
||||||
|
* [`YZ`](kcl/const_std-YZ)
|
||||||
* [`ZERO`](kcl/const_std-ZERO)
|
* [`ZERO`](kcl/const_std-ZERO)
|
||||||
* [`abs`](kcl/abs)
|
* [`abs`](kcl/abs)
|
||||||
* [`acos`](kcl/acos)
|
* [`acos`](kcl/acos)
|
||||||
@ -90,7 +107,9 @@ layout: manual
|
|||||||
* [`reduce`](kcl/reduce)
|
* [`reduce`](kcl/reduce)
|
||||||
* [`rem`](kcl/rem)
|
* [`rem`](kcl/rem)
|
||||||
* [`revolve`](kcl/revolve)
|
* [`revolve`](kcl/revolve)
|
||||||
|
* [`rotate`](kcl/rotate)
|
||||||
* [`round`](kcl/round)
|
* [`round`](kcl/round)
|
||||||
|
* [`scale`](kcl/scale)
|
||||||
* [`segAng`](kcl/segAng)
|
* [`segAng`](kcl/segAng)
|
||||||
* [`segEnd`](kcl/segEnd)
|
* [`segEnd`](kcl/segEnd)
|
||||||
* [`segEndX`](kcl/segEndX)
|
* [`segEndX`](kcl/segEndX)
|
||||||
@ -110,12 +129,11 @@ layout: manual
|
|||||||
* [`tangentialArcToRelative`](kcl/tangentialArcToRelative)
|
* [`tangentialArcToRelative`](kcl/tangentialArcToRelative)
|
||||||
* [`toDegrees`](kcl/toDegrees)
|
* [`toDegrees`](kcl/toDegrees)
|
||||||
* [`toRadians`](kcl/toRadians)
|
* [`toRadians`](kcl/toRadians)
|
||||||
|
* [`translate`](kcl/translate)
|
||||||
* [`xLine`](kcl/xLine)
|
* [`xLine`](kcl/xLine)
|
||||||
* [`xLineTo`](kcl/xLineTo)
|
|
||||||
* [`yLine`](kcl/yLine)
|
* [`yLine`](kcl/yLine)
|
||||||
* [`yLineTo`](kcl/yLineTo)
|
|
||||||
* [`yd`](kcl/yd)
|
* [`yd`](kcl/yd)
|
||||||
* **`std::math`**
|
* **std::math**
|
||||||
* [`E`](kcl/const_std-math-E)
|
* [`E`](kcl/const_std-math-E)
|
||||||
* [`PI`](kcl/const_std-math-PI)
|
* [`PI`](kcl/const_std-math-PI)
|
||||||
* [`TAU`](kcl/const_std-math-TAU)
|
* [`TAU`](kcl/const_std-math-TAU)
|
||||||
|
@ -11,7 +11,7 @@ Convert a number to an integer.
|
|||||||
DEPRECATED use floor(), ceil(), or round().
|
DEPRECATED use floor(), ceil(), or round().
|
||||||
|
|
||||||
```js
|
```js
|
||||||
int(num: number) -> number
|
int(num: number): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -23,11 +23,11 @@ int(num: number) -> number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `num` | `number` | | Yes |
|
| `num` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
@ -37,7 +37,7 @@ n = int(ceil(5 / 2))
|
|||||||
assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3")
|
assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3")
|
||||||
// Draw n cylinders.
|
// Draw n cylinders.
|
||||||
startSketchOn('XZ')
|
startSketchOn('XZ')
|
||||||
|> circle({ center = [0, 0], radius = 2 }, %)
|
|> circle(center = [0, 0], radius = 2)
|
||||||
|> extrude(length = 5)
|
|> extrude(length = 5)
|
||||||
|> patternTransform(
|
|> patternTransform(
|
||||||
instances = n,
|
instances = n,
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
---
|
---
|
||||||
title: "lastSegX"
|
title: "lastSegX"
|
||||||
excerpt: "Extract the 'x' axis value of the last line segment in the provided 2-d"
|
excerpt: "Extract the 'x' axis value of the last line segment in the provided 2-d sketch."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Extract the 'x' axis value of the last line segment in the provided 2-d
|
Extract the 'x' axis value of the last line segment in the provided 2-d sketch.
|
||||||
|
|
||||||
|
|
||||||
sketch.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
lastSegX(sketch: Sketch) -> number
|
lastSegX(sketch: Sketch): number
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ lastSegX(sketch: Sketch) -> number
|
|||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
---
|
---
|
||||||
title: "lastSegY"
|
title: "lastSegY"
|
||||||
excerpt: "Extract the 'y' axis value of the last line segment in the provided 2-d"
|
excerpt: "Extract the 'y' axis value of the last line segment in the provided 2-d sketch."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Extract the 'y' axis value of the last line segment in the provided 2-d
|
Extract the 'y' axis value of the last line segment in the provided 2-d sketch.
|
||||||
|
|
||||||
|
|
||||||
sketch.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
lastSegY(sketch: Sketch) -> number
|
lastSegY(sketch: Sketch): number
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ lastSegY(sketch: Sketch) -> number
|
|||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -9,7 +9,10 @@ Compute the angle of the given leg for x.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
legAngX(hypotenuse: number, leg: number) -> number
|
legAngX(
|
||||||
|
hypotenuse: number,
|
||||||
|
leg: number,
|
||||||
|
): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -21,12 +24,12 @@ legAngX(hypotenuse: number, leg: number) -> number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `hypotenuse` | `number` | | Yes |
|
| `hypotenuse` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `leg` | `number` | | Yes |
|
| `leg` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -9,7 +9,10 @@ Compute the angle of the given leg for y.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
legAngY(hypotenuse: number, leg: number) -> number
|
legAngY(
|
||||||
|
hypotenuse: number,
|
||||||
|
leg: number,
|
||||||
|
): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -21,12 +24,12 @@ legAngY(hypotenuse: number, leg: number) -> number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `hypotenuse` | `number` | | Yes |
|
| `hypotenuse` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `leg` | `number` | | Yes |
|
| `leg` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -9,7 +9,10 @@ Compute the length of the given leg.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
legLen(hypotenuse: number, leg: number) -> number
|
legLen(
|
||||||
|
hypotenuse: number,
|
||||||
|
leg: number,
|
||||||
|
): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -21,12 +24,12 @@ legLen(hypotenuse: number, leg: number) -> number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `hypotenuse` | `number` | | Yes |
|
| `hypotenuse` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `leg` | `number` | | Yes |
|
| `leg` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -9,7 +9,12 @@ Extend the current sketch with a new straight line.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
line(sketch: Sketch, endAbsolute?: [number], end?: [number], tag?: TagDeclarator) -> Sketch
|
line(
|
||||||
|
sketch: Sketch,
|
||||||
|
endAbsolute?: [number],
|
||||||
|
end?: [number],
|
||||||
|
tag?: TagDeclarator,
|
||||||
|
): Sketch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -18,19 +23,19 @@ line(sketch: Sketch, endAbsolute?: [number], end?: [number], tag?: TagDeclarator
|
|||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | Which sketch should this path be added to? | Yes |
|
||||||
| `endAbsolute` | `[number]` | Which absolute point should this line go to? Incompatible with `end`. | No |
|
| `endAbsolute` | [`[number]`](/docs/kcl/types/number) | Which absolute point should this line go to? Incompatible with `end`. | No |
|
||||||
| `end` | `[number]` | How far away (along the X and Y axes) should this line go? Incompatible with `endAbsolute`. | No |
|
| `end` | [`[number]`](/docs/kcl/types/number) | How far away (along the X and Y axes) should this line go? Incompatible with `endAbsolute`. | No |
|
||||||
| `tag` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
|
| [`tag`](/docs/kcl/types/tag) | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | Create a new tag which refers to this line | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
|
[`Sketch`](/docs/kcl/types/Sketch)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
triangle = startSketchOn("XZ")
|
triangle = startSketchOn(XZ)
|
||||||
|> startProfileAt([0, 0], %)
|
|> startProfileAt([0, 0], %)
|
||||||
// The 'end' argument means it ends at exactly [10, 0].
|
// The 'end' argument means it ends at exactly [10, 0].
|
||||||
// This is an absolute measurement, it is NOT relative to
|
// This is an absolute measurement, it is NOT relative to
|
||||||
@ -41,7 +46,7 @@ triangle = startSketchOn("XZ")
|
|||||||
|> close()
|
|> close()
|
||||||
|> extrude(length = 5)
|
|> extrude(length = 5)
|
||||||
|
|
||||||
box = startSketchOn("XZ")
|
box = startSketchOn(XZ)
|
||||||
|> startProfileAt([10, 10], %)
|
|> startProfileAt([10, 10], %)
|
||||||
// The 'to' argument means move the pen this much.
|
// The 'to' argument means move the pen this much.
|
||||||
// So, [10, 0] is a relative distance away from the current point.
|
// So, [10, 0] is a relative distance away from the current point.
|
||||||
|
@ -9,7 +9,7 @@ Compute the natural logarithm of the number.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
ln(num: number) -> number
|
ln(num: number): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -21,11 +21,11 @@ ln(num: number) -> number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `num` | `number` | | Yes |
|
| `num` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -9,7 +9,13 @@ Create a 3D surface or solid by interpolating between two or more sketches.
|
|||||||
The sketches need to closed and on the same plane.
|
The sketches need to closed and on the same plane.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
loft(sketches: [Sketch], vDegree: NonZeroU32, bezApproximateRational: bool, baseCurveIndex?: integer, tolerance?: number) -> Solid
|
loft(
|
||||||
|
sketches: [Sketch],
|
||||||
|
vDegree: NonZeroU32,
|
||||||
|
bezApproximateRational: bool,
|
||||||
|
baseCurveIndex?: integer,
|
||||||
|
tolerance?: number,
|
||||||
|
): Solid
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -19,13 +25,13 @@ loft(sketches: [Sketch], vDegree: NonZeroU32, bezApproximateRational: bool, base
|
|||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `sketches` | [`[Sketch]`](/docs/kcl/types/Sketch) | Which sketches to loft. Must include at least 2 sketches. | Yes |
|
| `sketches` | [`[Sketch]`](/docs/kcl/types/Sketch) | Which sketches to loft. Must include at least 2 sketches. | Yes |
|
||||||
| `vDegree` | `NonZeroU32` | Degree of the interpolation. Must be greater than zero. For example, use 2 for quadratic, or 3 for cubic interpolation in the V direction. This defaults to 2, if not specified. | Yes |
|
| `vDegree` | `NonZeroU32` | Degree of the interpolation. Must be greater than zero. For example, use 2 for quadratic, or 3 for cubic interpolation in the V direction. This defaults to 2, if not specified. | Yes |
|
||||||
| `bezApproximateRational` | `bool` | Attempt to approximate rational curves (such as arcs) using a bezier. This will remove banding around interpolations between arcs and non-arcs. It may produce errors in other scenarios Over time, this field won't be necessary. | Yes |
|
| `bezApproximateRational` | [`bool`](/docs/kcl/types/bool) | Attempt to approximate rational curves (such as arcs) using a bezier. This will remove banding around interpolations between arcs and non-arcs. It may produce errors in other scenarios Over time, this field won't be necessary. | Yes |
|
||||||
| `baseCurveIndex` | `integer` | This can be set to override the automatically determined topological base curve, which is usually the first section encountered. | No |
|
| `baseCurveIndex` | `integer` | This can be set to override the automatically determined topological base curve, which is usually the first section encountered. | No |
|
||||||
| `tolerance` | `number` | Tolerance for the loft operation. | No |
|
| `tolerance` | [`number`](/docs/kcl/types/number) | Tolerance for the loft operation. | No |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
[`Solid`](/docs/kcl/types/Solid) - A solid is a collection of extrude surfaces.
|
[`Solid`](/docs/kcl/types/Solid)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
@ -63,10 +69,10 @@ squareSketch = startSketchOn('XY')
|
|||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))
|
circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))
|
||||||
|> circle({ center = [0, 100], radius = 50 }, %)
|
|> circle(center = [0, 100], radius = 50)
|
||||||
|
|
||||||
circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))
|
circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))
|
||||||
|> circle({ center = [0, 100], radius = 20 }, %)
|
|> circle(center = [0, 100], radius = 20)
|
||||||
|
|
||||||
loft([
|
loft([
|
||||||
squareSketch,
|
squareSketch,
|
||||||
@ -88,10 +94,10 @@ squareSketch = startSketchOn('XY')
|
|||||||
|> close()
|
|> close()
|
||||||
|
|
||||||
circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))
|
circleSketch0 = startSketchOn(offsetPlane('XY', offset = 75))
|
||||||
|> circle({ center = [0, 100], radius = 50 }, %)
|
|> circle(center = [0, 100], radius = 50)
|
||||||
|
|
||||||
circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))
|
circleSketch1 = startSketchOn(offsetPlane('XY', offset = 150))
|
||||||
|> circle({ center = [0, 100], radius = 20 }, %)
|
|> circle(center = [0, 100], radius = 20)
|
||||||
|
|
||||||
loft(
|
loft(
|
||||||
[
|
[
|
||||||
|
@ -9,7 +9,10 @@ Compute 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.
|
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.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
log(num: number, base: number) -> number
|
log(
|
||||||
|
num: number,
|
||||||
|
base: number,
|
||||||
|
): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -21,12 +24,12 @@ log(num: number, base: number) -> number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `num` | `number` | | Yes |
|
| `num` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
| `base` | `number` | | Yes |
|
| `base` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -9,7 +9,7 @@ Compute the base 10 logarithm of the number.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
log10(num: number) -> number
|
log10(num: number): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -21,11 +21,11 @@ log10(num: number) -> number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `num` | `number` | | Yes |
|
| `num` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -9,7 +9,7 @@ Compute the base 2 logarithm of the number.
|
|||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
log2(num: number) -> number
|
log2(num: number): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -21,11 +21,11 @@ log2(num: number) -> number
|
|||||||
|
|
||||||
| Name | Type | Description | Required |
|
| Name | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `num` | `number` | | Yes |
|
| `num` | [`number`](/docs/kcl/types/number) | | Yes |
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -15,7 +15,7 @@ For example, if the current project uses inches, this function will return `39.3
|
|||||||
We merely provide these functions for convenience and readability, as `10 * m()` is more readable that your intent is "I want 10 meters" than `10 * 1000`, if the project settings are in millimeters.
|
We merely provide these functions for convenience and readability, as `10 * m()` is more readable that your intent is "I want 10 meters" than `10 * 1000`, if the project settings are in millimeters.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
m() -> number
|
m(): number
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tags
|
### Tags
|
||||||
@ -26,7 +26,7 @@ m() -> number
|
|||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
`number`
|
[`number`](/docs/kcl/types/number)
|
||||||
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -9,7 +9,10 @@ Apply a function to every element of a list.
|
|||||||
Given a list like `[a, b, c]`, and a function like `f`, returns `[f(a), f(b), f(c)]`
|
Given a list like `[a, b, c]`, and a function like `f`, returns `[f(a), f(b), f(c)]`
|
||||||
|
|
||||||
```js
|
```js
|
||||||
map(array: [KclValue], mapFn: FunctionSource) -> [KclValue]
|
map(
|
||||||
|
array: [KclValue],
|
||||||
|
mapFn: FunctionSource,
|
||||||
|
): [KclValue]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +34,7 @@ map(array: [KclValue], mapFn: FunctionSource) -> [KclValue]
|
|||||||
r = 10 // radius
|
r = 10 // radius
|
||||||
fn drawCircle(id) {
|
fn drawCircle(id) {
|
||||||
return startSketchOn("XY")
|
return startSketchOn("XY")
|
||||||
|> circle({ center = [id * 2 * r, 0], radius = r }, %)
|
|> circle(center = [id * 2 * r, 0], radius = r)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call `drawCircle`, passing in each element of the array.
|
// Call `drawCircle`, passing in each element of the array.
|
||||||
@ -47,7 +50,7 @@ r = 10 // radius
|
|||||||
// Call `map`, using an anonymous function instead of a named one.
|
// Call `map`, using an anonymous function instead of a named one.
|
||||||
circles = map([1..3], fn(id) {
|
circles = map([1..3], fn(id) {
|
||||||
return startSketchOn("XY")
|
return startSketchOn("XY")
|
||||||
|> circle({ center = [id * 2 * r, 0], radius = r }, %)
|
|> circle(center = [id * 2 * r, 0], radius = r)
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user