@mylasertools/kerfscript 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/CLA.md +8 -5
- package/COMMERCIAL-LICENSE.md +23 -28
- package/LANGUAGE.md +149 -46
- package/README.md +68 -29
- package/THIRD-PARTY-NOTICES.md +55 -0
- package/TRADEMARKS.md +16 -10
- package/dist/cli.js +273 -83
- package/dist/evaluator.d.cts +23 -0
- package/dist/evaluator.d.ts +23 -0
- package/dist/export/svg.d.cts +2 -0
- package/dist/export/svg.d.ts +2 -0
- package/dist/index.cjs +14 -14
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -14
- package/dist/render.d.cts +2 -1
- package/dist/render.d.ts +2 -1
- package/docs/cli.md +43 -28
- package/docs/compatibility.md +40 -65
- package/docs/customizer.md +40 -28
- package/docs/getting-started.md +48 -31
- package/docs/javascript.md +106 -51
- package/docs/kerf.md +36 -39
- package/docs/layers.md +71 -37
- package/docs/openscad.md +52 -48
- package/docs/parts-and-sheets.md +45 -31
- package/docs/versions.md +20 -30
- package/package.json +5 -4
package/docs/parts-and-sheets.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# Parts and sheets
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Use parts to name the pieces in a design, set quantities and assign
|
|
4
|
+
materials. KerfScript lays them out on sheets, grouping parts that use the
|
|
5
|
+
same material and thickness.
|
|
5
6
|
|
|
6
7
|
## Parts
|
|
7
8
|
|
|
@@ -10,16 +11,27 @@ part("side", qty = 2) rect([100, 60]);
|
|
|
10
11
|
part("base") rect([100, 100]);
|
|
11
12
|
```
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
This creates two side panels and one base. Each `part()` has its own layers
|
|
15
|
+
and appears in the parts list with dimensions and cut length. The default
|
|
16
|
+
quantity is one.
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
Shapes outside a `part()` are collected into a part named `part`.
|
|
19
|
+
|
|
20
|
+
Transforms and operations such as `translate()`, `difference()` and
|
|
21
|
+
`offset()` can wrap a part and change all of it. Layer wrappers such as
|
|
22
|
+
`score()` and `engrave()` go inside the part instead, since a whole part on
|
|
23
|
+
the score layer would have nothing to cut:
|
|
24
|
+
|
|
25
|
+
```kerf
|
|
26
|
+
part("tag") {
|
|
27
|
+
rect([60, 30], r = 3);
|
|
28
|
+
score() translate([5, 5]) rect([50, 20]);
|
|
29
|
+
}
|
|
30
|
+
```
|
|
18
31
|
|
|
19
32
|
## Materials
|
|
20
33
|
|
|
21
|
-
|
|
22
|
-
`material()` sets all three for the parts inside it:
|
|
34
|
+
`material()` sets the thickness, kerf and material name for its parts:
|
|
23
35
|
|
|
24
36
|
```kerf
|
|
25
37
|
material(thickness = 3, kerf = 0.15, name = "plywood") {
|
|
@@ -31,38 +43,40 @@ material(thickness = 2, kerf = 0.1, name = "acrylic") {
|
|
|
31
43
|
}
|
|
32
44
|
```
|
|
33
45
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
46
|
+
The two plywood panels share a sheet. The acrylic window goes on a separate
|
|
47
|
+
sheet. Each part records the `$thickness`, `$kerf` and `$material` values in
|
|
48
|
+
effect where it is defined.
|
|
37
49
|
|
|
38
|
-
|
|
39
|
-
2. copies each part `qty` times,
|
|
40
|
-
3. turns a part 90° when that makes it fit,
|
|
41
|
-
4. packs them in rows onto sheets of `$sheet` (600 by 400 mm by default),
|
|
42
|
-
with `$gap` millimetres between parts and around the edge.
|
|
50
|
+
## Sheets
|
|
43
51
|
|
|
44
|
-
|
|
45
|
-
stay where your program put them.
|
|
52
|
+
Set the available sheet size and spacing in millimetres:
|
|
46
53
|
|
|
47
54
|
```kerf
|
|
48
55
|
$sheet = [300, 200];
|
|
49
56
|
$gap = 4;
|
|
50
57
|
```
|
|
51
58
|
|
|
52
|
-
|
|
59
|
+
With the default `$layout = "pack"`, KerfScript arranges copies of each part
|
|
60
|
+
in rows, leaving the specified gap. It rotates a part 90° if that lets it
|
|
61
|
+
fit the sheet. The default sheet is 600 × 400 mm, with a 3 mm gap between
|
|
62
|
+
parts and at the sheet edges.
|
|
53
63
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
A part larger than the sheet produces a warning. Set `$layout = "none"`
|
|
65
|
+
to keep the positions from your code instead of packing the parts.
|
|
66
|
+
|
|
67
|
+
The CLI `--margin` option and API `margin` option let you set the edge
|
|
68
|
+
spacing separately from the gap between parts.
|
|
69
|
+
|
|
70
|
+
## One file per sheet
|
|
58
71
|
|
|
59
|
-
|
|
72
|
+
A combined SVG stacks all sheets in one preview. For the material example
|
|
73
|
+
above, export the plywood and acrylic sheets separately and cut each with
|
|
74
|
+
the matching material settings.
|
|
60
75
|
|
|
61
|
-
- On the command line, `--split`
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
|
|
76
|
+
- On the command line, add `--split` to write `design-1.svg`,
|
|
77
|
+
`design-2.svg` and so on. `kerf check` lists each sheet's material and
|
|
78
|
+
thickness.
|
|
79
|
+
- In JavaScript, `result.sheets` provides the SVG, DXF, material and
|
|
80
|
+
thickness for each sheet.
|
|
66
81
|
|
|
67
|
-
|
|
68
|
-
sheet in your machine.
|
|
82
|
+
DXF exports contain one sheet per file.
|
package/docs/versions.md
CHANGED
|
@@ -1,43 +1,33 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
-
KerfScript
|
|
3
|
+
KerfScript 0.2.0 implements language version 0.1. The package version tracks
|
|
4
|
+
the software release; the language version tracks the syntax and behavior
|
|
5
|
+
of `.kerf` programs.
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
version.
|
|
9
|
-
- The **package version** (now 0.2.0) is the version of the interpreter, the
|
|
10
|
-
`kerf` command and the JavaScript API. It changes more often: bug fixes,
|
|
11
|
-
new output options and API additions do not change the language.
|
|
12
|
-
|
|
13
|
-
The site footer, `kerf --version` and the `VERSION` and `LANGUAGE_VERSION`
|
|
14
|
-
exports show both.
|
|
7
|
+
Package updates can include bug fixes, export options and JavaScript API
|
|
8
|
+
changes without changing the language version. Use `kerf --version` to see
|
|
9
|
+
both numbers, or read the `VERSION` and `LANGUAGE_VERSION` exports in JavaScript.
|
|
15
10
|
|
|
16
11
|
## Before 1.0
|
|
17
12
|
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
The language may change before 1.0. Release notes identify changes that
|
|
14
|
+
affect existing programs or their output, including geometry and text layout
|
|
15
|
+
fixes. Removing or renaming a language feature requires a new language version.
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
produces is listed in the changelog under the version that made it.
|
|
23
|
-
- **Files keep running where we can manage it.** A program that worked keeps
|
|
24
|
-
working, or stops with an error that says what to change. It does not
|
|
25
|
-
silently start cutting something different.
|
|
26
|
-
- **Geometry changes are called out.** If the same file starts producing
|
|
27
|
-
different geometry, for example after a packing or text layout fix, the
|
|
28
|
-
changelog says which designs are affected.
|
|
29
|
-
- **Breaking changes raise the language version.** Package releases within
|
|
30
|
-
one language version do not remove or rename anything in the language.
|
|
17
|
+
Check the changelog when upgrading a tool that renders saved designs.
|
|
31
18
|
|
|
32
19
|
## From 1.0
|
|
33
20
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
21
|
+
The compatibility policy for language version 1.x is to keep existing
|
|
22
|
+
programs working throughout that series. New features will be added without
|
|
23
|
+
changing existing syntax. Bug fixes that affect output will be listed in
|
|
24
|
+
the changelog; other breaking changes will require language version 2.0.
|
|
38
25
|
|
|
39
26
|
## Pinning a version
|
|
40
27
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
For repeatable exports, record the interpreter version, settings and font
|
|
29
|
+
files used with a design. Applications that store designs should retain
|
|
30
|
+
that information and compare the output before upgrading the interpreter.
|
|
31
|
+
|
|
32
|
+
Pin the npm package to an exact version when your application needs a fixed
|
|
33
|
+
renderer, for example `@mylasertools/kerfscript@0.2.0`.
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mylasertools/kerfscript",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "KerfScript: a programming language for laser cutting. Write parametric 2D parts with cut, score and engrave layers, kerf compensation and joinery, and export SVG or DXF.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
7
7
|
"author": "MyLaserTools",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/mylasertools
|
|
10
|
+
"url": "git+https://github.com/mylasertools/kerfscript.git"
|
|
11
11
|
},
|
|
12
|
-
"bugs": "https://github.com/mylasertools
|
|
12
|
+
"bugs": "https://github.com/mylasertools/kerfscript/issues",
|
|
13
13
|
"keywords": [
|
|
14
14
|
"kerfscript",
|
|
15
15
|
"laser-cutting",
|
|
@@ -72,7 +72,8 @@
|
|
|
72
72
|
"prepack": "npm run check",
|
|
73
73
|
"format": "prettier --write .",
|
|
74
74
|
"format:check": "prettier --check .",
|
|
75
|
-
"compat": "node scripts/compat.mjs"
|
|
75
|
+
"compat": "node scripts/compat.mjs",
|
|
76
|
+
"readme-images": "npm run build && cd site && node ../scripts/readme-images.mjs"
|
|
76
77
|
},
|
|
77
78
|
"devDependencies": {
|
|
78
79
|
"@types/node": "20.19.43",
|