@mylasertools/kerfscript 0.7.0 → 0.8.0

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 CHANGED
@@ -1,5 +1,39 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.0 (2026-11-08)
4
+
5
+ Language version 0.3, as in 0.7.0: programs run as before.
6
+
7
+ - `hardware(shape = "ball")` (or `sides = 0`) is a ball of diameter `size`
8
+ midway between `from` and `to`, which it may leave out: a bulb, a marble
9
+ or a bead. The 3D view draws it, and verification gives it an envelope.
10
+ New hardware kinds: `bulb`, `ball`, `tube`, `lens`, `mirror` and
11
+ `movement`.
12
+ - `measure()` also sets `$area` and `$centroid`, the area of the material
13
+ its first child cuts and its balance point.
14
+ - `offset_path(points, d, closed)` moves a path sideways with mitred
15
+ corners: the two edges of a strip along a curve.
16
+ - `train_for(ratio, stages, pinion, wheel)` gives tooth counts for a gear
17
+ train of 1 to 3 stages nearest a ratio.
18
+ - `kerf/linkage`: `circle_meet()`, `slider_crank()`, `slider_stroke()`,
19
+ `four_bar()`, `four_bar_turns()` and `link_angle()` give where a
20
+ linkage's joints are at a crank angle.
21
+ - `kerf/cones`: `cone_flat()` cuts a cone or cut-off cone flat, with a
22
+ scored glue tab, and `cone_pattern()` gives its sector.
23
+ - `kerf/sizes`: `part_size()` gives the sizes of bought parts: a music box
24
+ movement, a quartz clock movement and marbles.
25
+ - `kerf/gears`: `cam()` draws a cam from a lift curve for a knife or
26
+ roller follower, with `cam_rise()` for dwells, rises and falls,
27
+ `cam_follower()` to place the follower and `cam_pressure()` to check it
28
+ won't jam. `geneva_wheel()`, `geneva_lock()`, `geneva_crank()` and
29
+ `geneva_turn()` make a Geneva drive; `ratchet()` and `pawl()` a wheel
30
+ that turns one way only.
31
+ - `kerf/sizes`: the instant film photo sizes are now `"instant mini"`,
32
+ `"instant square"`, `"instant wide"` and `"instant classic"`. The old
33
+ names still work.
34
+ - `part(material = "red acrylic")` names a part's material without a
35
+ `material()` round it.
36
+
3
37
  ## 0.7.0 (2026-11-03)
4
38
 
5
39
  Language version 0.3. Programs for 0.2 run as before, except that a
package/LANGUAGE.md CHANGED
@@ -191,6 +191,8 @@ module hang_hole(d = 5) {
191
191
  | `$label_parts` | `false` | engrave each part's number on its back face, as in the parts list and steps |
192
192
  | `$min_width` | `1.5` | warn where a part's material is narrower than this; `0` turns it off |
193
193
  | `$bounds` | | set by `measure()` for the children after the one it measures |
194
+ | `$area` | | set by `measure()`: the area of material the measured child cuts |
195
+ | `$centroid` | | set by `measure()`: the measured child's balance point `[x, y]` |
194
196
 
195
197
  ## Layers
196
198
 
@@ -262,6 +264,8 @@ material(thickness = 4, kerf = 0.12, name = "birch") {
262
264
  `rotate = orient(x, z)` turns the part's own x and z axes onto two
263
265
  directions; `euler(rotation(a) * rotation(b))` turns by `b`, then by `a`.
264
266
  - More about a part, all named:
267
+ - `material = "red acrylic"`: the part's material, as `material(name =
268
+ ...)` would set `$material` round it.
265
269
  - `stack = n`: n layers glued at each placement, one thickness apart
266
270
  along the part's z. The parts list says how many make a stack.
267
271
  - `mirror = true`: the part is cut mirrored left to right (x becomes
@@ -296,12 +300,15 @@ material(thickness = 4, kerf = 0.12, name = "birch") {
296
300
  text as `steps` and each placed part's `step`. The 3D view shows the
297
301
  model built up a step at a time. A step inside a step is a sub-step,
298
302
  `"outer: inner"`; `step(text, substeps = false)` takes inner steps in.
299
- - `hardware(kind, from, to, size = 6, up, sides = 24, label)` lists
300
- hardware the assembly needs, from one point to another: a dowel, a screw,
301
- a magnet, paper. `size` is a diameter, or `[w, h]` for a flat section
302
- whose `h` points along `up` (by default up, or along y for something
303
- standing upright). A round one is drawn with `sides` sides, 3 to 128.
304
- `render()` returns it as `hardware`, and `kerf check` lists it.
303
+ - `hardware(kind, from, to, size = 6, up, sides = 24, shape = "rod", label)`
304
+ lists hardware the assembly needs, from one point to another: a dowel, a
305
+ screw, a magnet, paper. `size` is a diameter, or `[w, h]` for a flat
306
+ section whose `h` points along `up` (by default up, or along y for
307
+ something standing upright). A round one is drawn with `sides` sides, 3
308
+ to 128. `shape = "ball"` (or `sides = 0`) is a ball of diameter `size`
309
+ midway between `from` and `to`; `to` may be left out. It comes back with
310
+ `sides = 0` and `from` and `to` both at its centre. `render()` returns it
311
+ as `hardware`, and `kerf check` lists it.
305
312
  - Shapes outside any part form one part named `part`.
306
313
  - `material(thickness, kerf, name) { ... }` sets those special variables for
307
314
  its children.
@@ -366,7 +373,7 @@ playground, the command line and `kerfscript.wasm` have `Atkinson`
366
373
  | `pattern(spacing, stagger = 0)` | repeats its first child over the area of the others, clipped at the edge |
367
374
  | `hatch(angle = 45, pitch = 5, width)` | parallel lines across the children's area, or stripes `width` wide |
368
375
  | `paint(layers)` | each child loses the area of every later one; child i goes on `layers[i]`. A child wholly on an area of its own layer warns |
369
- | `measure(draw = false)` | `$bounds` = `[x0, y0, x1, y1]` of the first child, for the children after |
376
+ | `measure(draw = false)` | `$bounds` = `[x0, y0, x1, y1]`, `$area` and `$centroid` = `[x, y]` of the first child, for the children after |
370
377
  | `hull()` | convex hull; each named part inside gets its own hull |
371
378
  | `offset(r)` / `offset(delta, chamfer = false)` | grow (positive) or shrink areas; `r` rounds corners |
372
379
  | `stroke(width)` | turns lines into areas of that width, for cutting single line art |
@@ -411,6 +418,7 @@ arguments.
411
418
  | `min(values)`, `max(values)` | Minimum or maximum of a list; also accept separate values |
412
419
  | `clamp(x, low, high)` | Limit x to the given interval |
413
420
  | `lerp(a, b, t)` | Interpolate between numbers or vectors; t = 0 gives a, t = 1 gives b |
421
+ | `train_for(ratio, stages = 2, pinion, wheel)` | Tooth counts for a gear train nearest `ratio`; see kerf/gears |
414
422
  | `norm(v)` | Length of a vector |
415
423
  | `cross(a, b)` | Cross product; a scalar for 2D vectors or a vector for 3D vectors |
416
424
 
@@ -423,6 +431,7 @@ A path is a list of `[x, y]` points.
423
431
  | `path_length(points)` | Length along the path |
424
432
  | `point_at(points, s)` | The point `s` along the path; past either end it carries on straight |
425
433
  | `heading_at(points, s)` | The path's direction `s` along it, in degrees from +x |
434
+ | `offset_path(points, d, closed = false)` | The path moved `d` to its left (right for `d < 0`), corners mitred |
426
435
  | `path_points(d, tolerance)` | The points of SVG path data, a list of points for each subpath |
427
436
  | `rotation(angles)` | The 3 × 3 matrix of `[x, y, z]` degrees as `part()` turns; use `*` |
428
437
  | `euler(matrix)` | The `[x, y, z]` angles of a rotation matrix, for `rotate` |