@mylasertools/kerfscript 0.8.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.
- package/CHANGELOG.md +69 -0
- package/LANGUAGE.md +189 -81
- package/README.md +2 -2
- package/dist/assembly.d.cts +2 -1
- package/dist/assembly.d.ts +2 -1
- package/dist/ast.d.cts +6 -0
- package/dist/ast.d.ts +6 -0
- package/dist/bores.d.cts +5 -0
- package/dist/bores.d.ts +5 -0
- package/dist/cli.js +1900 -274
- package/dist/customizer.d.cts +1 -0
- package/dist/customizer.d.ts +1 -0
- package/dist/evaluator.d.cts +9 -0
- package/dist/evaluator.d.ts +9 -0
- package/dist/functions.d.cts +2 -0
- package/dist/functions.d.ts +2 -0
- package/dist/geometry.d.cts +6 -0
- package/dist/geometry.d.ts +6 -0
- package/dist/halving.d.cts +8 -0
- package/dist/halving.d.ts +8 -0
- package/dist/highlight.cjs +2 -1
- package/dist/highlight.js +2 -1
- package/dist/index.cjs +131 -52
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +131 -52
- package/dist/language.cjs +111 -32
- package/dist/language.js +111 -32
- package/dist/libraries.cjs +93 -14
- package/dist/libraries.js +93 -14
- package/dist/plot.d.cts +16 -0
- package/dist/plot.d.ts +16 -0
- package/dist/signatures.cjs +160 -1
- package/dist/signatures.js +160 -1
- package/docs/cli.md +1 -0
- package/docs/compatibility.md +0 -8
- package/docs/customizer.md +18 -0
- package/docs/library.md +42 -1
- package/docs/parts-and-sheets.md +55 -0
- package/docs/versions.md +2 -2
- package/package.json +1 -1
package/dist/signatures.cjs
CHANGED
|
@@ -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",
|
|
@@ -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",
|
|
@@ -450,6 +529,23 @@ var SIGNATURES = [
|
|
|
450
529
|
named("on", "The name of a bent part this one is glued to, to move with it"),
|
|
451
530
|
named("slots", "Names of parts whose tabs pass through this one: their slots are cut"),
|
|
452
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
|
+
),
|
|
453
549
|
named(
|
|
454
550
|
"glue",
|
|
455
551
|
"The name of a part this one is glued flat onto; at and rotate are then on its face"
|
|
@@ -703,6 +799,24 @@ var SIGNATURES = [
|
|
|
703
799
|
section: "Paths and rotations",
|
|
704
800
|
doc: "The path moved sideways, each corner mitred: the two edges of a strip along a curve"
|
|
705
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
|
+
},
|
|
706
820
|
{
|
|
707
821
|
name: "point_at",
|
|
708
822
|
kind: "function",
|
|
@@ -799,6 +913,38 @@ var SIGNATURES = [
|
|
|
799
913
|
section: "Lists and strings",
|
|
800
914
|
doc: "A list or string in reverse order"
|
|
801
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
|
+
},
|
|
802
948
|
{
|
|
803
949
|
name: "sum",
|
|
804
950
|
kind: "function",
|
|
@@ -904,6 +1050,19 @@ var SIGNATURES = [
|
|
|
904
1050
|
section: "Types",
|
|
905
1051
|
doc: "The type name: number, string, boolean, undef, list, range, function or record"
|
|
906
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
|
+
},
|
|
907
1066
|
{
|
|
908
1067
|
name: "rands",
|
|
909
1068
|
kind: "function",
|
package/dist/signatures.js
CHANGED
|
@@ -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",
|
|
@@ -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",
|
|
@@ -425,6 +504,23 @@ var SIGNATURES = [
|
|
|
425
504
|
named("on", "The name of a bent part this one is glued to, to move with it"),
|
|
426
505
|
named("slots", "Names of parts whose tabs pass through this one: their slots are cut"),
|
|
427
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
|
+
),
|
|
428
524
|
named(
|
|
429
525
|
"glue",
|
|
430
526
|
"The name of a part this one is glued flat onto; at and rotate are then on its face"
|
|
@@ -678,6 +774,24 @@ var SIGNATURES = [
|
|
|
678
774
|
section: "Paths and rotations",
|
|
679
775
|
doc: "The path moved sideways, each corner mitred: the two edges of a strip along a curve"
|
|
680
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
|
+
},
|
|
681
795
|
{
|
|
682
796
|
name: "point_at",
|
|
683
797
|
kind: "function",
|
|
@@ -774,6 +888,38 @@ var SIGNATURES = [
|
|
|
774
888
|
section: "Lists and strings",
|
|
775
889
|
doc: "A list or string in reverse order"
|
|
776
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
|
+
},
|
|
777
923
|
{
|
|
778
924
|
name: "sum",
|
|
779
925
|
kind: "function",
|
|
@@ -879,6 +1025,19 @@ var SIGNATURES = [
|
|
|
879
1025
|
section: "Types",
|
|
880
1026
|
doc: "The type name: number, string, boolean, undef, list, range, function or record"
|
|
881
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
|
+
},
|
|
882
1041
|
{
|
|
883
1042
|
name: "rands",
|
|
884
1043
|
kind: "function",
|
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 |
|
package/docs/compatibility.md
CHANGED
|
@@ -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
|
|
package/docs/customizer.md
CHANGED
|
@@ -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`:
|
package/docs/library.md
CHANGED
|
@@ -32,6 +32,7 @@ show each module's description when you hover over it.
|
|
|
32
32
|
| [`kerf/lock`](#lock) | A lock with a key, three layers deep |
|
|
33
33
|
| [`kerf/rings`](#rings) | Round things of stacked rings on a crossed core |
|
|
34
34
|
| [`kerf/joints`](#joints) | Two profiles halved into each other: crosses, fonts, domes |
|
|
35
|
+
| [`kerf/fit`](#fit-and-align) | Drawings scaled to a size and placed by a point of their box |
|
|
35
36
|
| [`kerf/sizes`](#sizes) | Paper, card and photo sizes |
|
|
36
37
|
| [`kerf/symbols`](#symbols) | 867 pictograms by name |
|
|
37
38
|
| [`kerf/geo`](#maps) | The world's land, for maps and globes |
|
|
@@ -732,6 +733,40 @@ floor on the front, x positions (3 mm wide) or `[x, width]` pairs, and
|
|
|
732
733
|
naming both parts. The strips beside both slots must keep `$min_width`,
|
|
733
734
|
and a foot may not run into the front's slot: either stops with where.
|
|
734
735
|
|
|
736
|
+
## Fit and align
|
|
737
|
+
|
|
738
|
+
`use <kerf/fit>`
|
|
739
|
+
|
|
740
|
+
For a drawing whose size you don't know beforehand, such as an imported
|
|
741
|
+
SVG path, a silhouette or a symbol, these measure their children and
|
|
742
|
+
scale or move them, keeping every layer together. They are for drawings,
|
|
743
|
+
not parts: scaling a part would scale its joints but not its thickness.
|
|
744
|
+
|
|
745
|
+
```kerf
|
|
746
|
+
use <kerf/fit>
|
|
747
|
+
|
|
748
|
+
part("tag") {
|
|
749
|
+
rect([60, 40], r = 4);
|
|
750
|
+
engrave() translate([30, 20]) fit([44, 24], anchor = "center")
|
|
751
|
+
path("M0 0 L40 0 L50 30 L20 45 Z");
|
|
752
|
+
}
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
### `fit(size, mode = "contain", anchor = "bottom-left")`
|
|
756
|
+
|
|
757
|
+
The children scaled to `size` (`[w, h]`, or one number for a square).
|
|
758
|
+
`mode = "contain"` keeps their proportions and fits them inside;
|
|
759
|
+
`"stretch"` fills the size exactly. A drawing with no width or no height,
|
|
760
|
+
a straight line, is scaled by its other side. The result is placed by
|
|
761
|
+
`anchor`, as `align()` does.
|
|
762
|
+
|
|
763
|
+
### `align(anchor = "center")`, `anchor_point(anchor)`
|
|
764
|
+
|
|
765
|
+
The children moved so the point of their box that `anchor` names is at
|
|
766
|
+
the origin: `"center"`, `"left"`, `"right"`, `"top"`, `"bottom"`,
|
|
767
|
+
`"top-left"`, `"top-right"`, `"bottom-left"`, `"bottom-right"`, or
|
|
768
|
+
`[fx, fy]` as fractions of the box. `anchor_point()` gives those fractions.
|
|
769
|
+
|
|
735
770
|
## Sizes
|
|
736
771
|
|
|
737
772
|
`use <kerf/sizes>`
|
|
@@ -795,7 +830,7 @@ part("tag") {
|
|
|
795
830
|
}
|
|
796
831
|
```
|
|
797
832
|
|
|
798
|
-
### `symbol(name, size = 10, center = true, fill = "nonzero", box = "drawn")`
|
|
833
|
+
### `symbol(name, size = 10, center = true, fill = "nonzero", box = "drawn", solid = false, close, bridge)`
|
|
799
834
|
|
|
800
835
|
The symbol `size` mm across the longer side of what it draws, centred on
|
|
801
836
|
the origin, or with its bottom left corner there. With `box = "grid"`,
|
|
@@ -803,6 +838,12 @@ the origin, or with its bottom left corner there. With `box = "grid"`,
|
|
|
803
838
|
Material Design Icons), so icons from one set keep their sizes and places
|
|
804
839
|
relative to each other: paw prints in a trail, an icon swapped for another.
|
|
805
840
|
|
|
841
|
+
To cut a pictogram out rather than engrave it, `solid = true` gives one
|
|
842
|
+
silhouette, with gaps narrower than `2 * close` (default `size / 30`)
|
|
843
|
+
closed and holes filled, and the drawing's own detail engraved on it.
|
|
844
|
+
`bridge = w` also joins pieces too far apart to close, such as a moon
|
|
845
|
+
beside a mountain, with strips `w` wide.
|
|
846
|
+
|
|
806
847
|
### `symbol_names(category)`, `symbol_size(name, size = 10, box = "drawn")`, `symbol_source(name)`, `symbol_entry(name)`
|
|
807
848
|
|
|
808
849
|
The names of every symbol, or of one category; the `[width, height]` a
|
package/docs/parts-and-sheets.md
CHANGED
|
@@ -140,6 +140,55 @@ part("back", at = [0, 55, 3], rotate = [75, 0, 0]) {
|
|
|
140
140
|
Parts that only touch cut nothing: a wall standing on a shelf without tabs
|
|
141
141
|
leaves it whole.
|
|
142
142
|
|
|
143
|
+
When tabs of two parts land in the same place in a third, as walls of two
|
|
144
|
+
storeys lining up over a floor, the check names both and where they meet,
|
|
145
|
+
so one can move its tabs along the edge.
|
|
146
|
+
|
|
147
|
+
A hook that goes in through its slot and then drops, as on a pegboard,
|
|
148
|
+
needs a slot taller than its tab: `slot_extra = [0, 6]` sweeps each slot
|
|
149
|
+
6 mm further along the receiving part's own y.
|
|
150
|
+
|
|
151
|
+
### Halving joints
|
|
152
|
+
|
|
153
|
+
Two plates that cross, as the dividers of an egg crate or the ribs and
|
|
154
|
+
rings of a lamp, each take a slot halfway through from opposite sides.
|
|
155
|
+
Give one of them `halving = ["Rib*"]` and both are cut: where they cross,
|
|
156
|
+
each gets a strip as wide as the other plate's section (wider when they
|
|
157
|
+
meet at an angle), `clearance` more, from the middle of the crossing out
|
|
158
|
+
through its own edge. The slots run the way that leaves both parts
|
|
159
|
+
soonest, so a ring is slotted from its inner rim and a rib notched from
|
|
160
|
+
its outer edge, and a slot stops at the first edge it meets, never across
|
|
161
|
+
a hole to the far side.
|
|
162
|
+
|
|
163
|
+
```kerf
|
|
164
|
+
part("Ring", at = [0, 0, 30], halving = ["Rib"])
|
|
165
|
+
difference() { circle(r = 55); circle(r = 45); }
|
|
166
|
+
part("Rib", qty = 4, at = [for (a = [0:90:270]) [-1.5 * sin(a), 1.5 * cos(a), 0]],
|
|
167
|
+
rotate = [for (a = [0:90:270]) [90, 0, a]]) translate([10, 0]) rect([50, 60]);
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Bores for axles and dowels
|
|
171
|
+
|
|
172
|
+
A mechanism's axles pass through several parts: the frame they turn in, and
|
|
173
|
+
the wheels, cams and cranks fixed on them. Declare the axle once as
|
|
174
|
+
hardware and let each part cut its own hole: `bores = ["Crank axle"]` cuts,
|
|
175
|
+
through this part, the section of the hardware labelled so (or of that
|
|
176
|
+
kind) wherever it passes through in the assembly. An axle at an angle cuts
|
|
177
|
+
the longer hole it needs, and a square or hexagonal rod its own shape.
|
|
178
|
+
|
|
179
|
+
The fit sets the room round the rod: `fit = "turn"` (the default, 0.3 mm on
|
|
180
|
+
the diameter) for a part that turns on it, `fit = "press"` (0.1 mm under)
|
|
181
|
+
for one held fast, or a number of millimetres. Measure your laser's kerf
|
|
182
|
+
and your dowels with `kerf/calibration`, and adjust.
|
|
183
|
+
|
|
184
|
+
```kerf
|
|
185
|
+
hardware("dowel", [30, -5, 20], [30, 40, 20], 6, label = "Crank axle");
|
|
186
|
+
part("Side", qty = 2, at = [[0, 3, 0], [0, 33, 0]], rotate = [90, 0, 0],
|
|
187
|
+
bores = ["Crank axle"]) rect([60, 40]);
|
|
188
|
+
part("Cam", at = [30, 18, 20], rotate = [90, 0, 0], bores = ["Crank axle"],
|
|
189
|
+
fit = "press") circle(d = 30);
|
|
190
|
+
```
|
|
191
|
+
|
|
143
192
|
### Bends
|
|
144
193
|
|
|
145
194
|
A living hinge bends a part, and the assembled view can show it bent.
|
|
@@ -279,6 +328,12 @@ ones before the rows are packed: the rings of a stacked vase or globe each
|
|
|
279
328
|
inside the next, washers inside a wheel. A part goes into a hole only
|
|
280
329
|
where its outline, `$gap` all round, fits.
|
|
281
330
|
|
|
331
|
+
Copies of a curved part are packed in rows, every other one turned 180
|
|
332
|
+
degrees and slid up against the one before, `$gap` clear, when that takes
|
|
333
|
+
much less room than their boxes side by side: S-shaped ribs, crescents and
|
|
334
|
+
L brackets nest into each other, so 24 lamp ribs that took four sheets fit
|
|
335
|
+
on one. Rectangles and other parts that don't nest are packed as before.
|
|
336
|
+
|
|
282
337
|
## One file per sheet
|
|
283
338
|
|
|
284
339
|
A combined SVG stacks all sheets in one preview. For the material example
|
package/docs/versions.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
-
KerfScript 0.
|
|
3
|
+
KerfScript 0.9.0 implements language version 0.3. The package version tracks
|
|
4
4
|
the software release; the language version tracks the syntax and behavior
|
|
5
5
|
of `.kerf` programs.
|
|
6
6
|
|
|
@@ -30,4 +30,4 @@ files used with a design. Applications that store designs should retain
|
|
|
30
30
|
that information and compare the output before upgrading the interpreter.
|
|
31
31
|
|
|
32
32
|
Pin the npm package to an exact version when your application needs a fixed
|
|
33
|
-
renderer, for example `@mylasertools/kerfscript@0.
|
|
33
|
+
renderer, for example `@mylasertools/kerfscript@0.9.0`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mylasertools/kerfscript",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "KerfScript: a programming language and library for laser-cutting generators. Write parametric 2D parts with cut, score and engrave layers, kerf compensation and joinery, then turn settings into SVG or DXF cut files from Node.js, the browser, the command line or WebAssembly.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "AGPL-3.0-only",
|