@mylasertools/kerfscript 0.7.0 → 0.9.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/LANGUAGE.md +201 -84
  3. package/README.md +2 -2
  4. package/dist/assembly.d.cts +2 -1
  5. package/dist/assembly.d.ts +2 -1
  6. package/dist/ast.d.cts +6 -0
  7. package/dist/ast.d.ts +6 -0
  8. package/dist/bores.d.cts +5 -0
  9. package/dist/bores.d.ts +5 -0
  10. package/dist/cli.js +2098 -285
  11. package/dist/customizer.d.cts +1 -0
  12. package/dist/customizer.d.ts +1 -0
  13. package/dist/evaluator.d.cts +9 -0
  14. package/dist/evaluator.d.ts +9 -0
  15. package/dist/functions.d.cts +2 -0
  16. package/dist/functions.d.ts +2 -0
  17. package/dist/geometry.d.cts +11 -0
  18. package/dist/geometry.d.ts +11 -0
  19. package/dist/halving.d.cts +8 -0
  20. package/dist/halving.d.ts +8 -0
  21. package/dist/highlight.cjs +2 -1
  22. package/dist/highlight.js +2 -1
  23. package/dist/index.cjs +474 -58
  24. package/dist/index.d.cts +1 -1
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.js +474 -58
  27. package/dist/language.cjs +462 -46
  28. package/dist/language.js +462 -46
  29. package/dist/libraries.cjs +435 -19
  30. package/dist/libraries.js +435 -19
  31. package/dist/plot.d.cts +16 -0
  32. package/dist/plot.d.ts +16 -0
  33. package/dist/signatures.cjs +189 -5
  34. package/dist/signatures.js +189 -5
  35. package/dist/verify/solids.d.cts +2 -1
  36. package/dist/verify/solids.d.ts +2 -1
  37. package/dist/verify/types.d.cts +2 -0
  38. package/dist/verify/types.d.ts +2 -0
  39. package/docs/cli.md +1 -0
  40. package/docs/compatibility.md +0 -8
  41. package/docs/customizer.md +18 -0
  42. package/docs/library.md +248 -5
  43. package/docs/parts-and-sheets.md +86 -18
  44. package/docs/versions.md +2 -2
  45. package/package.json +1 -1
@@ -0,0 +1,16 @@
1
+ import type { Poly, Pt } from './geometry.cjs';
2
+ export interface FlowOptions {
3
+ spacing: number;
4
+ step: number;
5
+ minLength: number;
6
+ seed: number;
7
+ box: [number, number, number, number];
8
+ inside: (p: Pt) => boolean;
9
+ dir: (p: Pt) => Pt | null;
10
+ tick: () => void;
11
+ maxPoints: number;
12
+ }
13
+ export declare function streamlines(o: FlowOptions): Poly[];
14
+ export declare function contourLines(v: Float64Array, nx: number, ny: number, x0: number, y0: number, cell: number, level: number): Poly[];
15
+ export declare function joinLines(lines: Poly[], tol?: number): Poly[];
16
+ export declare function insideTest(regions: Poly[]): (p: Pt) => boolean;
package/dist/plot.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import type { Poly, Pt } from './geometry.js';
2
+ export interface FlowOptions {
3
+ spacing: number;
4
+ step: number;
5
+ minLength: number;
6
+ seed: number;
7
+ box: [number, number, number, number];
8
+ inside: (p: Pt) => boolean;
9
+ dir: (p: Pt) => Pt | null;
10
+ tick: () => void;
11
+ maxPoints: number;
12
+ }
13
+ export declare function streamlines(o: FlowOptions): Poly[];
14
+ export declare function contourLines(v: Float64Array, nx: number, ny: number, x0: number, y0: number, cell: number, level: number): Poly[];
15
+ export declare function joinLines(lines: Poly[], tol?: number): Poly[];
16
+ export declare function insideTest(regions: Poly[]): (p: Pt) => boolean;
@@ -154,7 +154,16 @@ var SIGNATURES = [
154
154
  named("halign", "left, center or right", '"left"'),
155
155
  named("valign", "baseline, top, center or bottom", '"baseline"'),
156
156
  named("spacing", "Letter spacing factor", "1"),
157
- named("fit", "Shrink the size so the text is no wider than this")
157
+ named("fit", "Shrink the size so the text is no wider than this"),
158
+ named(
159
+ "weight",
160
+ '"bold" thickens the strokes by 3.5% of the size, or a number of mm (less than 0 thins them)',
161
+ '"regular"'
162
+ ),
163
+ named(
164
+ "bridge",
165
+ "Join every island (an i's dot, an accent, a stencil's counter) to the rest with a strip this wide"
166
+ )
158
167
  ],
159
168
  section: "Shapes",
160
169
  doc: "Text as shapes; the font must be available to the renderer"
@@ -323,6 +332,60 @@ var SIGNATURES = [
323
332
  section: "Combining",
324
333
  doc: "Parallel lines or stripes across the area of the children"
325
334
  },
335
+ {
336
+ name: "flow",
337
+ kind: "module",
338
+ params: [
339
+ p(
340
+ "field",
341
+ "The direction at a point: function(p) giving degrees, a vector [x, y], or undef where lines stop; or one angle"
342
+ ),
343
+ p("spacing", "Distance between neighbouring lines", "2"),
344
+ p(
345
+ "step",
346
+ "Length of each step along a line: smaller follows the field more closely",
347
+ "min(0.5, spacing / 4)"
348
+ ),
349
+ named("min_length", "Lines shorter than this are left out", "spacing * 2"),
350
+ named("seed", "Where the first lines start; another seed gives another arrangement", "1")
351
+ ],
352
+ children: true,
353
+ section: "Combining",
354
+ doc: "Evenly spaced lines that follow a direction field across the area of the children, never closer than half the spacing"
355
+ },
356
+ {
357
+ name: "contours",
358
+ kind: "module",
359
+ params: [
360
+ p("field", "The height at a point: function(p) giving a number, or undef for none"),
361
+ p(
362
+ "levels",
363
+ "How many levels, spread evenly between the lowest and highest, or a list of heights",
364
+ "10"
365
+ ),
366
+ named("interval", "Instead of levels: every multiple of this height"),
367
+ named("cell", "Distance between the points sampled: smaller is finer and slower", "1")
368
+ ],
369
+ children: true,
370
+ section: "Combining",
371
+ doc: "Contour lines where a height field crosses each level, across the area of the children"
372
+ },
373
+ {
374
+ name: "occlude",
375
+ kind: "module",
376
+ params: [],
377
+ children: true,
378
+ section: "Combining",
379
+ doc: "Children back to front, each opaque: lines and outlines hide behind the areas of later children, and fills lose that area. Each iteration of a for loop is a child of its own"
380
+ },
381
+ {
382
+ name: "hide",
383
+ kind: "module",
384
+ params: [],
385
+ children: true,
386
+ section: "Combining",
387
+ doc: "Inside occlude(): an area that hides what is behind it but is not drawn"
388
+ },
326
389
  {
327
390
  name: "paint",
328
391
  kind: "module",
@@ -337,7 +400,7 @@ var SIGNATURES = [
337
400
  params: [p("draw", "Draw the first child too", "false")],
338
401
  children: true,
339
402
  section: "Combining",
340
- doc: "Set $bounds = [x0, y0, x1, y1] of the first child for the children after it"
403
+ doc: "Set $bounds = [x0, y0, x1, y1], $area and $centroid = [x, y] of the first child for the children after it"
341
404
  },
342
405
  {
343
406
  name: "fill_holes",
@@ -347,6 +410,22 @@ var SIGNATURES = [
347
410
  section: "Combining",
348
411
  doc: "Fill the holes in the areas of the children"
349
412
  },
413
+ {
414
+ name: "join_islands",
415
+ kind: "module",
416
+ params: [p("width", "How wide each joining strip is", "1")],
417
+ children: true,
418
+ section: "Combining",
419
+ doc: "Join every separate piece of the material to the nearest other piece with a strip, until it is one piece"
420
+ },
421
+ {
422
+ name: "largest",
423
+ kind: "module",
424
+ params: [p("n", "How many pieces to keep", "1")],
425
+ children: true,
426
+ section: "Combining",
427
+ doc: "Keep the n biggest connected pieces of the material, dropping crumbs; marks stay as drawn"
428
+ },
350
429
  {
351
430
  name: "close",
352
431
  kind: "module",
@@ -445,10 +524,28 @@ var SIGNATURES = [
445
524
  named("rotate", "How the part is turned in the assembled view, [x, y, z] in degrees"),
446
525
  named("stack", "Layers glued in a stack at each placement, one thickness apart", "1"),
447
526
  named("mirror", "Cut the part mirrored left to right, its text still reading", "false"),
527
+ named("material", "The material it is cut from, as material(name = ...) sets it"),
448
528
  named("bend", "Living hinge bends in the assembled view: [x0, x1, angle] or a list"),
449
529
  named("on", "The name of a bent part this one is glued to, to move with it"),
450
530
  named("slots", "Names of parts whose tabs pass through this one: their slots are cut"),
451
531
  named("clearance", "Added to the slots, in total across each", "0.1"),
532
+ named(
533
+ "slot_extra",
534
+ "Each slot swept [dx, dy] further in this part, for a hook that goes in and drops"
535
+ ),
536
+ named(
537
+ "halving",
538
+ "Names of parts this one crosses: both take a slot from opposite sides, meeting halfway"
539
+ ),
540
+ named(
541
+ "bores",
542
+ "Labels or kinds of hardware rods passing through this one: holes are cut where they cross it"
543
+ ),
544
+ named(
545
+ "fit",
546
+ 'Room in the bores: "turn" (0.3 mm on the diameter) for a part that turns on its axle, "press" (-0.1 mm) for one held fast, or a number of mm',
547
+ '"turn"'
548
+ ),
452
549
  named(
453
550
  "glue",
454
551
  "The name of a part this one is glued flat onto; at and rotate are then on its face"
@@ -495,11 +592,12 @@ var SIGNATURES = [
495
592
  kind: "module",
496
593
  params: [
497
594
  p("kind", 'What it is, as "dowel", "screw", "magnet", "elastic" or "paper"', '"dowel"'),
498
- p("from", "One end, [x, y, z]"),
499
- p("to", "The other end, [x, y, z]"),
595
+ p("from", "One end, [x, y, z]; a ball sits midway between from and to"),
596
+ p("to", "The other end, [x, y, z]; a ball may leave it out"),
500
597
  p("size", "Diameter, or [width, height] for a flat section", "6"),
501
598
  named("up", "The direction a [width, height] section's height points"),
502
- named("sides", "Sides of a round section in the 3D view", "24"),
599
+ named("sides", "Sides of a round section in the 3D view; 0 makes a ball", "24"),
600
+ named("shape", '"rod", or "ball" for a bulb, a marble or a bead', '"rod"'),
503
601
  named("label", "The name in the hardware list")
504
602
  ],
505
603
  children: true,
@@ -656,6 +754,18 @@ var SIGNATURES = [
656
754
  section: "Numbers and vectors",
657
755
  doc: "Interpolate between numbers or vectors"
658
756
  },
757
+ {
758
+ name: "train_for",
759
+ kind: "function",
760
+ params: [
761
+ p("ratio", "Turns in for one turn out; under 1 speeds up"),
762
+ p("stages", "Pairs of gears, 1 to 3", "2"),
763
+ p("pinion", "Fewest and most teeth of the small gears", "[10, 20]"),
764
+ p("wheel", "Fewest and most teeth of the big gears", "[20, 80]")
765
+ ],
766
+ section: "Numbers and vectors",
767
+ doc: "Tooth counts for a gear train nearest a ratio: {stages = [[driver, driven], ...], ratio, error}"
768
+ },
659
769
  {
660
770
  name: "norm",
661
771
  kind: "function",
@@ -678,6 +788,35 @@ var SIGNATURES = [
678
788
  section: "Paths and rotations",
679
789
  doc: "The length of the lines through a list of points"
680
790
  },
791
+ {
792
+ name: "offset_path",
793
+ kind: "function",
794
+ params: [
795
+ p("points", "A list of [x, y] points"),
796
+ p("d", "How far to move it: to the left going along it, or the right when less than 0"),
797
+ p("closed", "The path goes round, its last point joined to its first", "false")
798
+ ],
799
+ section: "Paths and rotations",
800
+ doc: "The path moved sideways, each corner mitred: the two edges of a strip along a curve"
801
+ },
802
+ {
803
+ name: "bounds",
804
+ kind: "function",
805
+ params: [p("points", "A list of [x, y] points, or of outlines")],
806
+ section: "Paths and rotations",
807
+ doc: "[x0, y0, x1, y1] round the points; undef for none"
808
+ },
809
+ {
810
+ name: "crossings",
811
+ kind: "function",
812
+ params: [
813
+ p("points", "A closed outline of [x, y] points, or a list of outlines"),
814
+ p("x", "The vertical line x = this"),
815
+ p("y", "Or the horizontal line y = this")
816
+ ],
817
+ section: "Paths and rotations",
818
+ doc: "Where the line crosses the outline: the y (or x) values, smallest first, entering and leaving in turn"
819
+ },
681
820
  {
682
821
  name: "point_at",
683
822
  kind: "function",
@@ -774,6 +913,38 @@ var SIGNATURES = [
774
913
  section: "Lists and strings",
775
914
  doc: "A list or string in reverse order"
776
915
  },
916
+ {
917
+ name: "sort",
918
+ kind: "function",
919
+ params: [
920
+ p("values", "A list of numbers, strings or lists of them"),
921
+ p("key", "A function giving the value to order each item by")
922
+ ],
923
+ section: "Lists and strings",
924
+ doc: "The list in order, smallest first; items with equal keys keep their order"
925
+ },
926
+ {
927
+ name: "fold",
928
+ kind: "function",
929
+ params: [
930
+ p("values", "A list"),
931
+ p("initial", "The value to start from"),
932
+ p("fn", "A function(acc, item) giving the next value")
933
+ ],
934
+ section: "Lists and strings",
935
+ doc: "The value after fn(acc, item) for each item in turn, from initial: initial for an empty list"
936
+ },
937
+ {
938
+ name: "scan",
939
+ kind: "function",
940
+ params: [
941
+ p("values", "A list"),
942
+ p("initial", "The value to start from"),
943
+ p("fn", "A function(acc, item) giving the next value")
944
+ ],
945
+ section: "Lists and strings",
946
+ doc: "The value after each item as fold() goes: running totals, one per item"
947
+ },
777
948
  {
778
949
  name: "sum",
779
950
  kind: "function",
@@ -879,6 +1050,19 @@ var SIGNATURES = [
879
1050
  section: "Types",
880
1051
  doc: "The type name: number, string, boolean, undef, list, range, function or record"
881
1052
  },
1053
+ {
1054
+ name: "noise",
1055
+ kind: "function",
1056
+ params: [
1057
+ p("x", "Where to read the noise: a number, or a point [x, y] or [x, y, z]"),
1058
+ p("y", void 0, "0"),
1059
+ p("z", "A third axis: step it to get a related but different pattern", "0"),
1060
+ named("seed", "A different seed gives a different pattern", "1"),
1061
+ named("octaves", "Layers of finer detail, 1 to 8", "1")
1062
+ ],
1063
+ section: "Random values",
1064
+ doc: "Smooth noise between about -1 and 1 that changes gradually from point to point: 0 at whole numbers, so scale the point down (x / 30) for broad shapes"
1065
+ },
882
1066
  {
883
1067
  name: "rands",
884
1068
  kind: "function",
@@ -129,7 +129,16 @@ var SIGNATURES = [
129
129
  named("halign", "left, center or right", '"left"'),
130
130
  named("valign", "baseline, top, center or bottom", '"baseline"'),
131
131
  named("spacing", "Letter spacing factor", "1"),
132
- named("fit", "Shrink the size so the text is no wider than this")
132
+ named("fit", "Shrink the size so the text is no wider than this"),
133
+ named(
134
+ "weight",
135
+ '"bold" thickens the strokes by 3.5% of the size, or a number of mm (less than 0 thins them)',
136
+ '"regular"'
137
+ ),
138
+ named(
139
+ "bridge",
140
+ "Join every island (an i's dot, an accent, a stencil's counter) to the rest with a strip this wide"
141
+ )
133
142
  ],
134
143
  section: "Shapes",
135
144
  doc: "Text as shapes; the font must be available to the renderer"
@@ -298,6 +307,60 @@ var SIGNATURES = [
298
307
  section: "Combining",
299
308
  doc: "Parallel lines or stripes across the area of the children"
300
309
  },
310
+ {
311
+ name: "flow",
312
+ kind: "module",
313
+ params: [
314
+ p(
315
+ "field",
316
+ "The direction at a point: function(p) giving degrees, a vector [x, y], or undef where lines stop; or one angle"
317
+ ),
318
+ p("spacing", "Distance between neighbouring lines", "2"),
319
+ p(
320
+ "step",
321
+ "Length of each step along a line: smaller follows the field more closely",
322
+ "min(0.5, spacing / 4)"
323
+ ),
324
+ named("min_length", "Lines shorter than this are left out", "spacing * 2"),
325
+ named("seed", "Where the first lines start; another seed gives another arrangement", "1")
326
+ ],
327
+ children: true,
328
+ section: "Combining",
329
+ doc: "Evenly spaced lines that follow a direction field across the area of the children, never closer than half the spacing"
330
+ },
331
+ {
332
+ name: "contours",
333
+ kind: "module",
334
+ params: [
335
+ p("field", "The height at a point: function(p) giving a number, or undef for none"),
336
+ p(
337
+ "levels",
338
+ "How many levels, spread evenly between the lowest and highest, or a list of heights",
339
+ "10"
340
+ ),
341
+ named("interval", "Instead of levels: every multiple of this height"),
342
+ named("cell", "Distance between the points sampled: smaller is finer and slower", "1")
343
+ ],
344
+ children: true,
345
+ section: "Combining",
346
+ doc: "Contour lines where a height field crosses each level, across the area of the children"
347
+ },
348
+ {
349
+ name: "occlude",
350
+ kind: "module",
351
+ params: [],
352
+ children: true,
353
+ section: "Combining",
354
+ doc: "Children back to front, each opaque: lines and outlines hide behind the areas of later children, and fills lose that area. Each iteration of a for loop is a child of its own"
355
+ },
356
+ {
357
+ name: "hide",
358
+ kind: "module",
359
+ params: [],
360
+ children: true,
361
+ section: "Combining",
362
+ doc: "Inside occlude(): an area that hides what is behind it but is not drawn"
363
+ },
301
364
  {
302
365
  name: "paint",
303
366
  kind: "module",
@@ -312,7 +375,7 @@ var SIGNATURES = [
312
375
  params: [p("draw", "Draw the first child too", "false")],
313
376
  children: true,
314
377
  section: "Combining",
315
- doc: "Set $bounds = [x0, y0, x1, y1] of the first child for the children after it"
378
+ doc: "Set $bounds = [x0, y0, x1, y1], $area and $centroid = [x, y] of the first child for the children after it"
316
379
  },
317
380
  {
318
381
  name: "fill_holes",
@@ -322,6 +385,22 @@ var SIGNATURES = [
322
385
  section: "Combining",
323
386
  doc: "Fill the holes in the areas of the children"
324
387
  },
388
+ {
389
+ name: "join_islands",
390
+ kind: "module",
391
+ params: [p("width", "How wide each joining strip is", "1")],
392
+ children: true,
393
+ section: "Combining",
394
+ doc: "Join every separate piece of the material to the nearest other piece with a strip, until it is one piece"
395
+ },
396
+ {
397
+ name: "largest",
398
+ kind: "module",
399
+ params: [p("n", "How many pieces to keep", "1")],
400
+ children: true,
401
+ section: "Combining",
402
+ doc: "Keep the n biggest connected pieces of the material, dropping crumbs; marks stay as drawn"
403
+ },
325
404
  {
326
405
  name: "close",
327
406
  kind: "module",
@@ -420,10 +499,28 @@ var SIGNATURES = [
420
499
  named("rotate", "How the part is turned in the assembled view, [x, y, z] in degrees"),
421
500
  named("stack", "Layers glued in a stack at each placement, one thickness apart", "1"),
422
501
  named("mirror", "Cut the part mirrored left to right, its text still reading", "false"),
502
+ named("material", "The material it is cut from, as material(name = ...) sets it"),
423
503
  named("bend", "Living hinge bends in the assembled view: [x0, x1, angle] or a list"),
424
504
  named("on", "The name of a bent part this one is glued to, to move with it"),
425
505
  named("slots", "Names of parts whose tabs pass through this one: their slots are cut"),
426
506
  named("clearance", "Added to the slots, in total across each", "0.1"),
507
+ named(
508
+ "slot_extra",
509
+ "Each slot swept [dx, dy] further in this part, for a hook that goes in and drops"
510
+ ),
511
+ named(
512
+ "halving",
513
+ "Names of parts this one crosses: both take a slot from opposite sides, meeting halfway"
514
+ ),
515
+ named(
516
+ "bores",
517
+ "Labels or kinds of hardware rods passing through this one: holes are cut where they cross it"
518
+ ),
519
+ named(
520
+ "fit",
521
+ 'Room in the bores: "turn" (0.3 mm on the diameter) for a part that turns on its axle, "press" (-0.1 mm) for one held fast, or a number of mm',
522
+ '"turn"'
523
+ ),
427
524
  named(
428
525
  "glue",
429
526
  "The name of a part this one is glued flat onto; at and rotate are then on its face"
@@ -470,11 +567,12 @@ var SIGNATURES = [
470
567
  kind: "module",
471
568
  params: [
472
569
  p("kind", 'What it is, as "dowel", "screw", "magnet", "elastic" or "paper"', '"dowel"'),
473
- p("from", "One end, [x, y, z]"),
474
- p("to", "The other end, [x, y, z]"),
570
+ p("from", "One end, [x, y, z]; a ball sits midway between from and to"),
571
+ p("to", "The other end, [x, y, z]; a ball may leave it out"),
475
572
  p("size", "Diameter, or [width, height] for a flat section", "6"),
476
573
  named("up", "The direction a [width, height] section's height points"),
477
- named("sides", "Sides of a round section in the 3D view", "24"),
574
+ named("sides", "Sides of a round section in the 3D view; 0 makes a ball", "24"),
575
+ named("shape", '"rod", or "ball" for a bulb, a marble or a bead', '"rod"'),
478
576
  named("label", "The name in the hardware list")
479
577
  ],
480
578
  children: true,
@@ -631,6 +729,18 @@ var SIGNATURES = [
631
729
  section: "Numbers and vectors",
632
730
  doc: "Interpolate between numbers or vectors"
633
731
  },
732
+ {
733
+ name: "train_for",
734
+ kind: "function",
735
+ params: [
736
+ p("ratio", "Turns in for one turn out; under 1 speeds up"),
737
+ p("stages", "Pairs of gears, 1 to 3", "2"),
738
+ p("pinion", "Fewest and most teeth of the small gears", "[10, 20]"),
739
+ p("wheel", "Fewest and most teeth of the big gears", "[20, 80]")
740
+ ],
741
+ section: "Numbers and vectors",
742
+ doc: "Tooth counts for a gear train nearest a ratio: {stages = [[driver, driven], ...], ratio, error}"
743
+ },
634
744
  {
635
745
  name: "norm",
636
746
  kind: "function",
@@ -653,6 +763,35 @@ var SIGNATURES = [
653
763
  section: "Paths and rotations",
654
764
  doc: "The length of the lines through a list of points"
655
765
  },
766
+ {
767
+ name: "offset_path",
768
+ kind: "function",
769
+ params: [
770
+ p("points", "A list of [x, y] points"),
771
+ p("d", "How far to move it: to the left going along it, or the right when less than 0"),
772
+ p("closed", "The path goes round, its last point joined to its first", "false")
773
+ ],
774
+ section: "Paths and rotations",
775
+ doc: "The path moved sideways, each corner mitred: the two edges of a strip along a curve"
776
+ },
777
+ {
778
+ name: "bounds",
779
+ kind: "function",
780
+ params: [p("points", "A list of [x, y] points, or of outlines")],
781
+ section: "Paths and rotations",
782
+ doc: "[x0, y0, x1, y1] round the points; undef for none"
783
+ },
784
+ {
785
+ name: "crossings",
786
+ kind: "function",
787
+ params: [
788
+ p("points", "A closed outline of [x, y] points, or a list of outlines"),
789
+ p("x", "The vertical line x = this"),
790
+ p("y", "Or the horizontal line y = this")
791
+ ],
792
+ section: "Paths and rotations",
793
+ doc: "Where the line crosses the outline: the y (or x) values, smallest first, entering and leaving in turn"
794
+ },
656
795
  {
657
796
  name: "point_at",
658
797
  kind: "function",
@@ -749,6 +888,38 @@ var SIGNATURES = [
749
888
  section: "Lists and strings",
750
889
  doc: "A list or string in reverse order"
751
890
  },
891
+ {
892
+ name: "sort",
893
+ kind: "function",
894
+ params: [
895
+ p("values", "A list of numbers, strings or lists of them"),
896
+ p("key", "A function giving the value to order each item by")
897
+ ],
898
+ section: "Lists and strings",
899
+ doc: "The list in order, smallest first; items with equal keys keep their order"
900
+ },
901
+ {
902
+ name: "fold",
903
+ kind: "function",
904
+ params: [
905
+ p("values", "A list"),
906
+ p("initial", "The value to start from"),
907
+ p("fn", "A function(acc, item) giving the next value")
908
+ ],
909
+ section: "Lists and strings",
910
+ doc: "The value after fn(acc, item) for each item in turn, from initial: initial for an empty list"
911
+ },
912
+ {
913
+ name: "scan",
914
+ kind: "function",
915
+ params: [
916
+ p("values", "A list"),
917
+ p("initial", "The value to start from"),
918
+ p("fn", "A function(acc, item) giving the next value")
919
+ ],
920
+ section: "Lists and strings",
921
+ doc: "The value after each item as fold() goes: running totals, one per item"
922
+ },
752
923
  {
753
924
  name: "sum",
754
925
  kind: "function",
@@ -854,6 +1025,19 @@ var SIGNATURES = [
854
1025
  section: "Types",
855
1026
  doc: "The type name: number, string, boolean, undef, list, range, function or record"
856
1027
  },
1028
+ {
1029
+ name: "noise",
1030
+ kind: "function",
1031
+ params: [
1032
+ p("x", "Where to read the noise: a number, or a point [x, y] or [x, y, z]"),
1033
+ p("y", void 0, "0"),
1034
+ p("z", "A third axis: step it to get a related but different pattern", "0"),
1035
+ named("seed", "A different seed gives a different pattern", "1"),
1036
+ named("octaves", "Layers of finer detail, 1 to 8", "1")
1037
+ ],
1038
+ section: "Random values",
1039
+ doc: "Smooth noise between about -1 and 1 that changes gradually from point to point: 0 at whole numbers, so scale the point down (x / 30) for broad shapes"
1040
+ },
857
1041
  {
858
1042
  name: "rands",
859
1043
  kind: "function",
@@ -1,5 +1,5 @@
1
1
  import { type Vec3 } from '../assembly.cjs';
2
- import type { BodyRef, Trajectory, VerificationSnapshot } from './types.cjs';
2
+ import type { BodyRef, SnapshotHardware, Trajectory, VerificationSnapshot } from './types.cjs';
3
3
  export declare class WorkBudget {
4
4
  remaining: number;
5
5
  constructor(remaining?: number);
@@ -23,6 +23,7 @@ export interface Solid {
23
23
  inner: Cell[];
24
24
  }
25
25
  export declare function allBodies(s: VerificationSnapshot): BodyRef[];
26
+ export declare function hardwareEnds(h: SnapshotHardware): [Vec3, Vec3];
26
27
  export declare function bodyMatrix(s: VerificationSnapshot, r: BodyRef): number[];
27
28
  export declare function makeSolid(s: VerificationSnapshot, ref: BodyRef, budget: WorkBudget): Solid;
28
29
  export declare function transformSolid(s: Solid, m: number[]): Solid;
@@ -1,5 +1,5 @@
1
1
  import { type Vec3 } from '../assembly.js';
2
- import type { BodyRef, Trajectory, VerificationSnapshot } from './types.js';
2
+ import type { BodyRef, SnapshotHardware, Trajectory, VerificationSnapshot } from './types.js';
3
3
  export declare class WorkBudget {
4
4
  remaining: number;
5
5
  constructor(remaining?: number);
@@ -23,6 +23,7 @@ export interface Solid {
23
23
  inner: Cell[];
24
24
  }
25
25
  export declare function allBodies(s: VerificationSnapshot): BodyRef[];
26
+ export declare function hardwareEnds(h: SnapshotHardware): [Vec3, Vec3];
26
27
  export declare function bodyMatrix(s: VerificationSnapshot, r: BodyRef): number[];
27
28
  export declare function makeSolid(s: VerificationSnapshot, ref: BodyRef, budget: WorkBudget): Solid;
28
29
  export declare function transformSolid(s: Solid, m: number[]): Solid;
@@ -48,6 +48,8 @@ export interface SnapshotHardware {
48
48
  to: Vec3;
49
49
  size: number | [number, number];
50
50
  up: Vec3;
51
+ /** A ball of diameter size centred at from (from and to are the same point) */
52
+ shape?: 'ball';
51
53
  }
52
54
  export interface VerificationSnapshot {
53
55
  schemaVersion: 1;
@@ -48,6 +48,8 @@ export interface SnapshotHardware {
48
48
  to: Vec3;
49
49
  size: number | [number, number];
50
50
  up: Vec3;
51
+ /** A ball of diameter size centred at from (from and to are the same point) */
52
+ shape?: 'ball';
51
53
  }
52
54
  export interface VerificationSnapshot {
53
55
  schemaVersion: 1;
package/docs/cli.md CHANGED
@@ -120,6 +120,7 @@ installed libraries by themselves.
120
120
  | `--nest` | Pack small parts into the holes of bigger ones |
121
121
  | `--stats` | With `check`: points in the files, by part and layer |
122
122
  | `--sweep name=a:s:b` | With `check`: try every value from a to b in steps of s, or `name=a,b,c` |
123
+ | `--drive` | With `check`: try every value of the setting marked `drive` (see the customizer) |
123
124
  | `-o out.png`, `--px n` | A picture of each sheet, `n` pixels wide (1200), to look at rather than cut |
124
125
  | `--call 'm(1, 2)'` | Run one call of the file's modules instead of its program; `-D` sets variables first |
125
126
  | `--params-list file` | With `check`: try each set of settings in a JSON list of objects |
@@ -28,14 +28,6 @@ and operation order.
28
28
 
29
29
  Six reference models passed these import checks on 28 October 2026.
30
30
  Drawing dimensions matched within 0.02 mm, including kerf compensation.
31
- These results cover file imports; they do not establish a fit for a
32
- particular machine or material.
33
-
34
- ## Not checked yet
35
-
36
- LightBurn, xTool Studio, xTool Creative Space, RDWorks and LaserGRBL have
37
- not yet been verified with the reference models. Import handling can differ
38
- between programs, especially for units, layer colours and fills.
39
31
 
40
32
  ## Checklist for a new program
41
33
 
@@ -55,6 +55,24 @@ A `//` comment immediately above a variable supplies its caption. Keep the
55
55
  file's introductory comment separate with a blank line so it does not
56
56
  become the first setting's caption.
57
57
 
58
+ ## The setting that moves the model
59
+
60
+ A model with moving parts usually has one number that drives them: a crank
61
+ angle, a lid's opening, the time of day. Mark it with `drive` after its
62
+ range:
63
+
64
+ ```kerf
65
+ crank = 0; // [0:5:360] drive
66
+
67
+ part("Wheel", at = [0, 0, 0]) circle(d = 60);
68
+ part("Crank", at = [0, 0, 3], rotate = [0, 0, crank]) rect([30, 8], center = true);
69
+ ```
70
+
71
+ The playground gives it a Play button that steps it round its range, and
72
+ `kerf check model.kerf --drive` builds the model at every step and reports
73
+ any position that warns (parts colliding, a slot that misses), as
74
+ `--sweep crank=0:5:360` would. `kerf params` lists it with `"drive": true`.
75
+
58
76
  ## Changing settings without editing the file
59
77
 
60
78
  The CLI accepts values with `-D` or a JSON file with `--params`: