@mylasertools/kerfscript 0.10.0 → 0.11.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 +199 -0
- package/LANGUAGE.md +90 -42
- package/dist/assembly.d.cts +20 -1
- package/dist/assembly.d.ts +20 -1
- package/dist/cli.js +2236 -375
- package/dist/colors.d.cts +4 -0
- package/dist/colors.d.ts +4 -0
- package/dist/effects.d.cts +2 -2
- package/dist/effects.d.ts +2 -2
- package/dist/evaluator.d.cts +9 -1
- package/dist/evaluator.d.ts +9 -1
- package/dist/export/mesh.d.cts +16 -3
- package/dist/export/mesh.d.ts +16 -3
- package/dist/export/model.d.cts +4 -2
- package/dist/export/model.d.ts +4 -2
- package/dist/export/pages.d.cts +23 -0
- package/dist/export/pages.d.ts +23 -0
- package/dist/geometry.d.cts +20 -0
- package/dist/geometry.d.ts +20 -0
- package/dist/hardware.d.cts +2 -0
- package/dist/hardware.d.ts +2 -0
- package/dist/highlight.cjs +1 -1
- package/dist/highlight.js +1 -1
- package/dist/index.cjs +1308 -77
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1308 -77
- package/dist/instructions.d.cts +27 -0
- package/dist/instructions.d.ts +27 -0
- package/dist/language.cjs +1281 -50
- package/dist/language.js +1281 -50
- package/dist/libraries.cjs +1262 -36
- package/dist/libraries.js +1262 -36
- package/dist/lights.d.cts +38 -0
- package/dist/lights.d.ts +38 -0
- package/dist/png.d.cts +14 -0
- package/dist/png.d.ts +14 -0
- package/dist/render.d.cts +5 -0
- package/dist/render.d.ts +5 -0
- package/dist/signatures.cjs +75 -4
- package/dist/signatures.js +75 -4
- package/dist/text.d.cts +23 -0
- package/dist/text.d.ts +23 -0
- package/dist/verify/types.d.cts +6 -0
- package/dist/verify/types.d.ts +6 -0
- package/docs/3d-files.md +29 -8
- package/docs/cli.md +12 -1
- package/docs/customizer.md +13 -0
- package/docs/javascript.md +6 -1
- package/docs/layers.md +24 -1
- package/docs/library.md +454 -16
- package/docs/parts-and-sheets.md +205 -28
- package/docs/verification.md +1 -1
- package/docs/versions.md +2 -2
- package/package.json +1 -1
package/docs/layers.md
CHANGED
|
@@ -97,7 +97,8 @@ engrave() translate([40, 20]) circle(d = 12);
|
|
|
97
97
|
|
|
98
98
|
The rectangle and circle use separate engraving layers. You can assign each
|
|
99
99
|
a different power in your laser software. Supported modes are `"cut"`,
|
|
100
|
-
`"line"`, `"fill"` and `"
|
|
100
|
+
`"line"`, `"fill"`, `"guide"` and `"paint"`. The colour is a hex colour
|
|
101
|
+
or a colour's name, as `"red"`.
|
|
101
102
|
|
|
102
103
|
## The back face
|
|
103
104
|
|
|
@@ -128,6 +129,28 @@ part("tile") {
|
|
|
128
129
|
A child given the layer `""` is left out, but still covers the ones
|
|
129
130
|
before it: a bare patch.
|
|
130
131
|
|
|
132
|
+
## Painted areas
|
|
133
|
+
|
|
134
|
+
A layer with `mode = "paint"` marks areas painted by hand after cutting.
|
|
135
|
+
They are never in the files for the laser, but the 3D view and the print
|
|
136
|
+
layout show them in the layer's colour, on the part's own sheet:
|
|
137
|
+
|
|
138
|
+
```kerf
|
|
139
|
+
layer("red", mode = "paint", color = "red");
|
|
140
|
+
layer("white", mode = "paint", color = "white");
|
|
141
|
+
part("mushroom", paint = "cream") {
|
|
142
|
+
circle(d = 60);
|
|
143
|
+
paint(["red", "white"]) {
|
|
144
|
+
translate([0, 8]) circle(d = 50);
|
|
145
|
+
for (p = [[-10, 18], [8, 22], [0, 4]]) translate(p) circle(d = 8);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Paint is clipped to the part, and a paint layer with `side = "back"`
|
|
151
|
+
paints the face underneath. `part(paint = colour)` paints the whole part;
|
|
152
|
+
see [Parts and sheets](parts-and-sheets.md).
|
|
153
|
+
|
|
131
154
|
## Printing on parts
|
|
132
155
|
|
|
133
156
|
To print on the parts and then cut them, `layer(name, mode = "fill",
|
package/docs/library.md
CHANGED
|
@@ -22,7 +22,7 @@ show each module's description when you hover over it.
|
|
|
22
22
|
| [`kerf/box`](#boxes) | Finger-jointed boxes and dividers that slide into them |
|
|
23
23
|
| [`kerf/tabs`](#tabs-and-slots) | Tabs on one panel and the slots in another that they go into |
|
|
24
24
|
| [`kerf/stand`](#stands) | A sign or photo standing in a base, upright or leaning back |
|
|
25
|
-
| [`kerf/hinge`](#living-hinges) | Living hinges that bend flat sheet,
|
|
25
|
+
| [`kerf/hinge`](#living-hinges) | Living hinges that bend flat sheet, round boxes and bent walls |
|
|
26
26
|
| [`kerf/dividers`](#dividers) | Dividers that slot into each other like an egg crate |
|
|
27
27
|
| [`kerf/hanging`](#hanging) | Keyholes, holes and loops for hanging things on a wall |
|
|
28
28
|
| [`kerf/enclosure`](#enclosures) | Boxes with a screwed-on lid, cutouts for ports and vents |
|
|
@@ -264,17 +264,123 @@ Wrap it in `place()` with the plate's placement, put the other plate
|
|
|
264
264
|
`width` away, and give both plates `slots`: they cut the slots for the
|
|
265
265
|
tabs where the strip passes through them. Segments of the path shorter
|
|
266
266
|
than `straight` are taken as curve; a sharp corner bends round radius
|
|
267
|
-
`r`, two thicknesses by default
|
|
267
|
+
`r`, two thicknesses by default, and the strip follows the rounded
|
|
268
|
+
corner: it is as long as the path with its corners rounded, and ends
|
|
269
|
+
where the path ends. A path with no curve or corner makes a straight
|
|
270
|
+
strip. Sample a curve with segments shorter than `straight`: a curve
|
|
271
|
+
sampled more coarsely is cut as straight runs with a sharp bend at each
|
|
272
|
+
point. `narrow` uses `narrow_hinge()`.
|
|
273
|
+
|
|
274
|
+
### `wall(outline, depth, name = "wall", join, max_length = 400, rim, seam = 0.3, tabs = true, straight = 10, r, spacing = 1.5, bridge = 3, narrow = false, at = [0, 0, 0], rotate = [90, 0, 0])`
|
|
275
|
+
|
|
276
|
+
A wall round a closed outline, as for a lantern, a light box or a round
|
|
277
|
+
case: a front plate, a back plate `depth` behind it, and a strip between
|
|
278
|
+
them that follows the outline, made by `flex_strip()`. The strip bends on
|
|
279
|
+
living hinges where the outline curves and has tabs where it runs
|
|
280
|
+
straight, and both plates cut the slots for them.
|
|
281
|
+
|
|
282
|
+
```kerf
|
|
283
|
+
use <kerf/hinge>
|
|
284
|
+
|
|
285
|
+
// A lantern: two straights and two round ends, the seam at the bottom
|
|
286
|
+
outline = concat(
|
|
287
|
+
[for (a = [-90:5:90]) [100, 40] + 40 * [cos(a), sin(a)]],
|
|
288
|
+
[for (a = [90:5:270]) [40, 40] + 40 * [cos(a), sin(a)]]
|
|
289
|
+
);
|
|
290
|
+
wall(outline, 50, name = "lantern", join = [70, 0], max_length = 200) {
|
|
291
|
+
difference() {
|
|
292
|
+
offset(delta = 5) polygon(outline);
|
|
293
|
+
translate([70, 40]) circle(d = 40);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
- The strip's ends meet at the point of the outline nearest `join`: put
|
|
299
|
+
the seam on a straight, or where a cap or a foot will hide it. Without
|
|
300
|
+
`join` they meet in the middle of the longest side.
|
|
301
|
+
- Sharp corners of the outline are rounded as the strip bends round
|
|
302
|
+
them, radius `r` inside: the strip follows `strip_loop(outline)`.
|
|
303
|
+
- A strip longer than `max_length` is cut into pieces no longer, so each
|
|
304
|
+
fits the bed, split on a straight where one is near. The pieces meet
|
|
305
|
+
`seam` apart, so that bent on their hinges they don't press on each
|
|
306
|
+
other.
|
|
307
|
+
- The first child is the front plate, drawn as the outline is, with the
|
|
308
|
+
windows or art you cut in it; the second is the back plate. Without
|
|
309
|
+
them, each plate is the outline grown by `rim`, half a thickness and
|
|
310
|
+
3 mm.
|
|
311
|
+
- The parts are `"<name> front"`, `"<name> back"` and `"<name> strip"`, or
|
|
312
|
+
`"<name> strip 1"`, `"<name> strip 2"` and so on for a strip in pieces.
|
|
313
|
+
`wall_pieces(outline, max_length, join, straight, r)` says how many
|
|
314
|
+
pieces there will be.
|
|
315
|
+
- It stands upright with the outline seen from the front, the back plate
|
|
316
|
+
behind it; `at` and `rotate` place it.
|
|
317
|
+
|
|
318
|
+
Sample the outline's curves with segments shorter than `straight`, as for
|
|
319
|
+
`flex_strip()`.
|
|
320
|
+
|
|
321
|
+
### `wall_path(outline, join)`
|
|
322
|
+
|
|
323
|
+
A closed outline as the path round it from the point of it nearest
|
|
324
|
+
`join` all the way round to it again; without `join`, from the middle of
|
|
325
|
+
its longest side. `wall()` follows `wall_path(strip_loop(outline), join)`.
|
|
326
|
+
|
|
327
|
+
### `path_part(path, s0, s1)`
|
|
328
|
+
|
|
329
|
+
The part of a path from `s0` to `s1` along it, its ends where those fall.
|
|
330
|
+
|
|
331
|
+
### `wall_strip_names(name, pieces)`
|
|
332
|
+
|
|
333
|
+
The names of the strip's parts for a wall named `name` in that many
|
|
334
|
+
pieces, as `slots` lists them: `wall_strip_names("lantern", 2)` is
|
|
335
|
+
`["lantern strip 1", "lantern strip 2"]`.
|
|
336
|
+
|
|
337
|
+
### `wall_splits(L, n, max_length, mids, halves)`
|
|
338
|
+
|
|
339
|
+
Where `wall()` splits a strip `L` long into `n` pieces no longer than
|
|
340
|
+
`max_length`: near even spacing, at a point of `mids` (the middles of the
|
|
341
|
+
straight runs) where one is near, else at one of `halves` (the middles of
|
|
342
|
+
the path's segments, where its bends end).
|
|
343
|
+
|
|
344
|
+
### `strip_path(path, straight = 10, r)`
|
|
345
|
+
|
|
346
|
+
The path a strip bent along `path` follows: each sharp corner, where
|
|
347
|
+
two segments at least `straight` long meet, rounded to an arc whose
|
|
348
|
+
inside radius is `r` (two thicknesses by default), the middle of the
|
|
349
|
+
sheet tangent to both segments. A corner too tight for the segments
|
|
350
|
+
beside it rounds to the radius that fits half of each. `flex_strip()` is
|
|
351
|
+
as long as this path.
|
|
352
|
+
|
|
353
|
+
### `strip_loop(outline, straight = 10, r)`
|
|
354
|
+
|
|
355
|
+
A closed outline with its sharp corners rounded as `strip_path()` rounds
|
|
356
|
+
a path's, each corner judged by its whole sides.
|
|
357
|
+
|
|
358
|
+
### `strip_corner(a, p, b, straight = 10, r)`
|
|
359
|
+
|
|
360
|
+
The points of the rounded corner at `p`, coming from `a` and going on to
|
|
361
|
+
`b`, as `strip_path()` and `strip_loop()` round it: the arc, or `[p]`
|
|
362
|
+
where the corner is not sharp.
|
|
268
363
|
|
|
269
364
|
### `strip_bends(path, straight = 10, r)`
|
|
270
365
|
|
|
271
|
-
The bends `flex_strip()` makes, as `[s0, s1, angle]` along the path
|
|
366
|
+
The bends `flex_strip()` makes, as `[s0, s1, angle]` along the path with
|
|
367
|
+
its corners rounded by `strip_path()`:
|
|
272
368
|
where each curve starts and ends and how far it turns, left positive.
|
|
273
|
-
|
|
369
|
+
A curve whose radius changes, such as a tight fillet running into a wide
|
|
370
|
+
arc, gives several bends end to end, one for each stretch of much the
|
|
371
|
+
same radius, so the bent strip follows the path. Give them to
|
|
372
|
+
`part(bend = ...)` for a strip of your own.
|
|
373
|
+
|
|
374
|
+
### `strip_join(list)`
|
|
375
|
+
|
|
376
|
+
Joins bends that touch or overlap where they turn the same way at much
|
|
377
|
+
the same rate, within a quarter of each other; `strip_bends()` uses it.
|
|
378
|
+
Two that overlap but turn differently meet halfway through the overlap.
|
|
274
379
|
|
|
275
380
|
### `strip_merge(list)`
|
|
276
381
|
|
|
277
|
-
Joins bends
|
|
382
|
+
Joins bends that touch into one, whatever their radius: the stretches
|
|
383
|
+
`flex_strip()` cuts its hinges over.
|
|
278
384
|
|
|
279
385
|
## Dividers
|
|
280
386
|
|
|
@@ -891,8 +997,9 @@ centred on the origin, `shape_centre(points)` centres them, and
|
|
|
891
997
|
|
|
892
998
|
`use <kerf/sizes>`
|
|
893
999
|
|
|
894
|
-
Paper, card and
|
|
895
|
-
and
|
|
1000
|
+
Paper, card, photo and banknote sizes in millimetres, and the sizes of
|
|
1001
|
+
bought parts and everyday things, for holders, folders, frames and boxes
|
|
1002
|
+
made to fit them.
|
|
896
1003
|
|
|
897
1004
|
### `paper_size(name)`, `card_size(name)`, `photo_size(name)`
|
|
898
1005
|
|
|
@@ -900,21 +1007,46 @@ and boxes made to fit them.
|
|
|
900
1007
|
`"B4"` to `"B6"`, `"C4"` to `"C6"`, `"DL"`, `"letter"`, `"legal"`,
|
|
901
1008
|
`"tabloid"`, `"half letter"`, `"executive"`, `"pocket"` and `"traveler"`,
|
|
902
1009
|
standing; cards `"business"`, `"us business"`, `"credit"`, `"japan"`,
|
|
903
|
-
`"playing"`, `"bridge"`, `"tarot"`, `"postcard"
|
|
1010
|
+
`"playing"`, `"bridge"`, `"tarot"`, `"postcard"`, `"us postcard"` and
|
|
1011
|
+
`"gift card"`, and
|
|
904
1012
|
photos `"4x6"`, `"5x7"`, `"8x10"`, `"10x15"`, `"13x18"` and the instant
|
|
905
1013
|
film sizes `"instant mini"`, `"instant square"`, `"instant wide"` and
|
|
906
1014
|
`"instant classic"`, lying down. An unknown name stops with the list of
|
|
907
1015
|
known ones.
|
|
908
1016
|
|
|
1017
|
+
### `note_size(name)`
|
|
1018
|
+
|
|
1019
|
+
A banknote's `[width, height]`, lying down: `"usd"` (every US note is the
|
|
1020
|
+
same size), `"cad"` (every Canadian note), `"eur 5"` to `"eur 200"`,
|
|
1021
|
+
`"gbp 5"` to `"gbp 50"` and `"aud 5"` to `"aud 100"`. For a wallet or a
|
|
1022
|
+
money gift holder, fit the largest note it is for.
|
|
1023
|
+
|
|
909
1024
|
### `part_size(name)`
|
|
910
1025
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
1026
|
+
The sizes of a bought part or an everyday thing as a record: `body =
|
|
1027
|
+
[width, depth, height]`; for a round one its `diameter` and `height` (an
|
|
1028
|
+
egg's `length`); for one with a shaft its diameter `shaft`, the
|
|
1029
|
+
`shaft_length` it stands out of the body; and the `hole` to cut for it,
|
|
1030
|
+
where there is one.
|
|
1031
|
+
|
|
1032
|
+
| Name | What it is |
|
|
1033
|
+
| ------------------------------------------------ | -------------------------------------------------------------------------------- |
|
|
1034
|
+
| `"music-18"` | an 18-note wind-up music box movement; its shaft is the winding key's |
|
|
1035
|
+
| `"quartz-clock"` | a 56 mm quartz clock movement with the 16.5 mm shaft, for dials up to `dial = 8` |
|
|
1036
|
+
| `"tealight"`, `"maxi tealight"` | 39 × 16 and 59 × 24, with a `hole` to stand one in |
|
|
1037
|
+
| `"led tealight"`, `"led puck"` | battery lights, 38 × 36 with the flame and 70 × 25 |
|
|
1038
|
+
| `"fairy lights"` | the battery box of a string of them, and its `wire` |
|
|
1039
|
+
| `"hen egg"`, `"chocolate egg"` | 44 and 40 across, 57 and 60 long |
|
|
1040
|
+
| `"wine bottle"` | 76 across and 300 high, its `neck` 30 across |
|
|
1041
|
+
| `"magnet 6x2"`, `"magnet 10x3"`, `"magnet 12x3"` | disc magnets, with a `hole` to press one into |
|
|
1042
|
+
| `"key ring 25"` | a 25 mm split key ring |
|
|
1043
|
+
| `"battery box 2aa"`, `"battery box 3aa"` | closed battery boxes with a switch |
|
|
1044
|
+
| `"coin cell holder"` | a holder for a CR2032 cell |
|
|
1045
|
+
| `"key fob"` | a car key fob |
|
|
1046
|
+
| `"tissue box"`, `"tissue cube"` | tissue boxes, long and cube |
|
|
1047
|
+
| `"marble-16"`, `"marble-25"` | marbles |
|
|
1048
|
+
|
|
1049
|
+
These are common retail sizes, which vary: measure yours.
|
|
918
1050
|
|
|
919
1051
|
```kerf
|
|
920
1052
|
use <kerf/sizes>
|
|
@@ -923,6 +1055,19 @@ m = part_size("quartz-clock");
|
|
|
923
1055
|
part("dial") difference() { circle(d = 160); circle(d = m.hole); }
|
|
924
1056
|
```
|
|
925
1057
|
|
|
1058
|
+
```kerf
|
|
1059
|
+
use <kerf/sizes>
|
|
1060
|
+
|
|
1061
|
+
egg = part_size("hen egg");
|
|
1062
|
+
// A ring an egg sits in, a little over half its width
|
|
1063
|
+
part("egg cup") difference() { circle(d = egg.diameter + 16); circle(d = egg.diameter * 0.75); }
|
|
1064
|
+
```
|
|
1065
|
+
|
|
1066
|
+
### `size_list(kind)`
|
|
1067
|
+
|
|
1068
|
+
The names in one table, as a list, for a customizer menu: `"paper"`,
|
|
1069
|
+
`"card"`, `"photo"`, `"note"` or `"part"`, as `// [size_list("note")]`.
|
|
1070
|
+
|
|
926
1071
|
### `landscape(size)`, `portrait(size)`
|
|
927
1072
|
|
|
928
1073
|
A size turned to lie wider than tall, or to stand taller than wide.
|
|
@@ -932,6 +1077,294 @@ A size turned to lie wider than tall, or to stand taller than wide.
|
|
|
932
1077
|
The size of a name in a table of `[name, size]`, the names in it, and the
|
|
933
1078
|
name an older name stands for in a table of `[old, new]`.
|
|
934
1079
|
|
|
1080
|
+
## Drawers
|
|
1081
|
+
|
|
1082
|
+
`use <kerf/drawers>`
|
|
1083
|
+
|
|
1084
|
+
A carcass of small numbered drawers in a grid, as for an advent calendar,
|
|
1085
|
+
behind a façade of any shape: a finger-jointed box open at the front,
|
|
1086
|
+
shelves and walls halved into each other inside it, and a drawer in each
|
|
1087
|
+
cell with its number engraved on the front.
|
|
1088
|
+
|
|
1089
|
+
```kerf
|
|
1090
|
+
use <kerf/drawers>
|
|
1091
|
+
|
|
1092
|
+
$thickness = 3;
|
|
1093
|
+
// 24 drawers, numbered in a shuffled order, behind a house front
|
|
1094
|
+
drawers(4, 6, [40, 30], 60, shuffle = 7) {
|
|
1095
|
+
polygon([[-10, -5], [185, -5], [185, 200], [87.5, 260], [-10, 200]]);
|
|
1096
|
+
}
|
|
1097
|
+
```
|
|
1098
|
+
|
|
1099
|
+
### `drawers(cols = 4, rows = 6, cell = [40, 30], depth = 60, numbers, shuffle, pull = "notch", ease = 0.8, clearance = 0.15, open = 0, font_size, label = "")`
|
|
1100
|
+
|
|
1101
|
+
`cols` by `rows` drawers, each cell `[w, h]` inside and the carcass `depth`
|
|
1102
|
+
deep, its front left bottom corner at the origin and the drawers facing
|
|
1103
|
+
-y. Drawers run on the shelves `ease` mm clear all round, and pull out
|
|
1104
|
+
`open` of their depth in the assembled view. `pull` is `"notch"` (a dip in
|
|
1105
|
+
the front's top edge), `"hole"` (a finger hole) or `"none"`. The numbers
|
|
1106
|
+
go row by row from the top left: 1 up, a list of your own in `numbers`
|
|
1107
|
+
(text works too), shuffled by a seed in `shuffle`, or none with `numbers
|
|
1108
|
+
= false`. Children are a façade, drawn on the carcass's front from its
|
|
1109
|
+
bottom left corner: the drawers' openings are cut through it, and it goes
|
|
1110
|
+
on in a step of its own. The parts are named after `label`, and the
|
|
1111
|
+
assembly is in steps: the carcass, the shelves and walls, the façade, the
|
|
1112
|
+
drawers.
|
|
1113
|
+
|
|
1114
|
+
### `drawers_size(cols, rows, cell, depth)`, `drawers_numbers(n, numbers, shuffle)`
|
|
1115
|
+
|
|
1116
|
+
The carcass's outer `[width, height, depth]`, for drawing a façade round
|
|
1117
|
+
it, and the numbers on the drawers.
|
|
1118
|
+
|
|
1119
|
+
## Figures
|
|
1120
|
+
|
|
1121
|
+
`use <kerf/figures>`
|
|
1122
|
+
|
|
1123
|
+
Layered characters for ornaments, standees, scenes and cards, drawn for
|
|
1124
|
+
this library:
|
|
1125
|
+
|
|
1126
|
+
| Cast | Figures |
|
|
1127
|
+
| ------------- | ------------------------------------------------------------------------------------------------ |
|
|
1128
|
+
| `"christmas"` | `santa`, `elf`, `gnome`, `angel`, `reindeer`, `gingerbread`, `snowman` |
|
|
1129
|
+
| `"easter"` | `bunny`, `chick`, `lamb` |
|
|
1130
|
+
| `"halloween"` | `ghost`, `witch`, `pumpkin`, `bat`, `skeleton` |
|
|
1131
|
+
| `"nativity"` | `mary`, `joseph`, `baby`, `shepherd`, `caspar`, `melchior`, `balthasar`, `ox`, `donkey`, `sheep` |
|
|
1132
|
+
| `"animals"` | `bear`, `fox`, `cat`, `dog`, `owl`, `deer` |
|
|
1133
|
+
|
|
1134
|
+
A figure is built in layers, as layered wood art is. The **outline** is a
|
|
1135
|
+
backer of its whole silhouette, standing `border` mm proud of the rest.
|
|
1136
|
+
On it lie the coloured pieces of its **clothes** (an animal's coat) and its
|
|
1137
|
+
**face** (skin, bellies, beaks, ears) side by side, `gap` mm apart, so the
|
|
1138
|
+
backer shows between them as lines. On those lie the **details**: eyes,
|
|
1139
|
+
noses, buttons. Each layer comes in one or more colours.
|
|
1140
|
+
|
|
1141
|
+
```kerf
|
|
1142
|
+
use <kerf/figures>
|
|
1143
|
+
|
|
1144
|
+
$thickness = 3;
|
|
1145
|
+
figure_parts("bunny", 80, at = [0, 0, 0], rotate = [90, 0, 0]);
|
|
1146
|
+
figure_parts("chick", 80, at = [70, 0, 0], rotate = [90, 0, 0]);
|
|
1147
|
+
```
|
|
1148
|
+
|
|
1149
|
+
### `figure_parts(name, height = 100, at = [0, 0, 0], rotate = [0, 0, 0], label, border = 2, gap = 0.6, qty = 1)`
|
|
1150
|
+
|
|
1151
|
+
The figure as layered parts, its outline `height` mm tall: the outline
|
|
1152
|
+
placed at `at` and turned by `rotate` (`[90, 0, 0]` stands it up), the
|
|
1153
|
+
clothes and face glued on it and the details on those. Each colour of each
|
|
1154
|
+
layer is a part of its own, painted that colour, so the 3D view and the
|
|
1155
|
+
print layout show the figure in colour and the sheets keep one wood. The
|
|
1156
|
+
parts are named after `label`, the figure's name unless given: `"bunny
|
|
1157
|
+
outline"`, `"bunny face pink"`, `"bunny details black"`. A detail too small to cut at that height, under `min_width` of
|
|
1158
|
+
`figure_layer()`, is left out.
|
|
1159
|
+
|
|
1160
|
+
### `figure(name, height = 100, border = 2, gap = 0.6)`
|
|
1161
|
+
|
|
1162
|
+
The figure from one sheet: its outline cut, the lines between its coloured
|
|
1163
|
+
pieces scored, and its details engraved. Put it inside a `part()`.
|
|
1164
|
+
|
|
1165
|
+
### `figure_layer(name, layer, height = 100, color, border = 2, gap = 0.6, min_width = 1.6)`
|
|
1166
|
+
|
|
1167
|
+
One layer of the figure as shapes: `"outline"`, `"clothes"`, `"face"` or
|
|
1168
|
+
`"details"`, every colour of it or only `color`. The outline is `height` mm
|
|
1169
|
+
tall, standing on y = 0 and centred on x = 0. Each piece loses what the
|
|
1170
|
+
pieces after it cover, `gap` wider, and any sliver narrower than
|
|
1171
|
+
`min_width`; details stay on the clothes and face.
|
|
1172
|
+
|
|
1173
|
+
### `figure_names(cast)`, `figure_casts()`, `figure_layers(name)`
|
|
1174
|
+
|
|
1175
|
+
The names of the figures, all or those of one cast; the casts; and the
|
|
1176
|
+
parts a figure is built of, as `[layer, colour]` from the outline up, as
|
|
1177
|
+
`figure_parts()` makes them.
|
|
1178
|
+
|
|
1179
|
+
### `figure_details(name, height, base, qty = 1, border = 2, gap = 0.6, k = 0)`
|
|
1180
|
+
|
|
1181
|
+
The figure's details as painted parts named after `base`, glued on the
|
|
1182
|
+
first of its clothes and face parts that is big enough to cut at that
|
|
1183
|
+
height, as `figure_parts()` and `scene_figure()` make them.
|
|
1184
|
+
|
|
1185
|
+
### `figure_entry(name)`, `figure_shapes(shapes)`, `figure_unique(list)`
|
|
1186
|
+
|
|
1187
|
+
A figure's entry, `[name, cast, outline colour, pieces]`; the shapes of one
|
|
1188
|
+
of its pieces drawn, in the figure's own units; and a list without its
|
|
1189
|
+
repeats. Each figure is drawn 100 units tall as a list of pieces in
|
|
1190
|
+
painter's order, each `[layer, colour, shapes]`, the shapes circles,
|
|
1191
|
+
ellipses, round-ended strokes, rounded rectangles, polygons and smooth
|
|
1192
|
+
closed curves, as the library's comments describe.
|
|
1193
|
+
|
|
1194
|
+
## Inlays
|
|
1195
|
+
|
|
1196
|
+
`use <kerf/inlay>`
|
|
1197
|
+
|
|
1198
|
+
Inlays of another wood, stock or colour: shapes cut out of one part, or
|
|
1199
|
+
engraved into it as pockets, and cut again as inserts that press into
|
|
1200
|
+
them. KerfScript takes the kerf off every cut, so a hole and an insert of
|
|
1201
|
+
one shape come out the same size; each insert is `press` mm bigger all
|
|
1202
|
+
round so it holds.
|
|
1203
|
+
|
|
1204
|
+
```kerf
|
|
1205
|
+
use <kerf/inlay>
|
|
1206
|
+
use <kerf/shapes>
|
|
1207
|
+
|
|
1208
|
+
$thickness = 3;
|
|
1209
|
+
// A walnut heart in a plywood plaque
|
|
1210
|
+
inlaid("plaque", materials = ["walnut"]) {
|
|
1211
|
+
rect([80, 60], r = 5);
|
|
1212
|
+
translate([40, 30]) heart(30);
|
|
1213
|
+
}
|
|
1214
|
+
```
|
|
1215
|
+
|
|
1216
|
+
### `inlaid(name, depth, press = 0.05, materials, paints, at = [0, 0, 0], rotate = [0, 0, 0])`
|
|
1217
|
+
|
|
1218
|
+
A part with inlays: its first child is the part's shape, and each child
|
|
1219
|
+
after it an inlay's shape. The inlays are cut through the part, or with
|
|
1220
|
+
`depth` engraved that deep on the layer `"pocket"` (set its power for the
|
|
1221
|
+
depth). Each inlay is an insert of its own, `"name inlay 1"` up, `press`
|
|
1222
|
+
mm bigger all round, of `materials[i]` (on a sheet of its own) or painted
|
|
1223
|
+
`paints[i]`; a pocket's insert is `depth` thick. In the assembled view a
|
|
1224
|
+
through insert sits in its hole and a pocket's on the surface over it.
|
|
1225
|
+
|
|
1226
|
+
## Layered art
|
|
1227
|
+
|
|
1228
|
+
`use <kerf/layered>`
|
|
1229
|
+
|
|
1230
|
+
Multilayer pieces from one drawing, as layered ornaments, mandalas, wreaths
|
|
1231
|
+
and signs are made. The children are the art's layers, back to front; each
|
|
1232
|
+
becomes a part of its own, glued on the one behind it and painted its
|
|
1233
|
+
colour, so the 3D view and the print layout show it built up.
|
|
1234
|
+
|
|
1235
|
+
```kerf
|
|
1236
|
+
use <kerf/layered>
|
|
1237
|
+
|
|
1238
|
+
$thickness = 3;
|
|
1239
|
+
layered("tree", colors = ["dark green", "green", "light green", "gold"], shadow = 2, hole = [0, 52, 4]) {
|
|
1240
|
+
regular_polygon(3, 40);
|
|
1241
|
+
translate([0, 8]) regular_polygon(3, 28);
|
|
1242
|
+
translate([0, 16]) regular_polygon(3, 16);
|
|
1243
|
+
translate([0, 40]) star(5, 7, 3);
|
|
1244
|
+
}
|
|
1245
|
+
```
|
|
1246
|
+
|
|
1247
|
+
### `layered(name = "layered", colors, border = 2, shadow = 0, shadow_color = "dark grey", hole, at = [0, 0, 0], rotate = [0, 0, 0])`
|
|
1248
|
+
|
|
1249
|
+
One part a layer, named `"name layer 1"` up from the back. Each layer is
|
|
1250
|
+
its own drawing joined with everything in front of it grown by `border`
|
|
1251
|
+
mm, so every layer is held up by the one behind and shows as a rim round
|
|
1252
|
+
it. `colors` gives each layer's paint, back to front; without it they go
|
|
1253
|
+
from dark brown at the back to white at the front. `shadow` adds a layer
|
|
1254
|
+
at the back that much wider again, in `shadow_color`. `hole = [x, y, d]`
|
|
1255
|
+
cuts a hole `d` across through every layer, to hang it by. The back layer
|
|
1256
|
+
goes at `at`, turned by `rotate`; a layer may be several pieces.
|
|
1257
|
+
|
|
1258
|
+
### `layered_color(colors, k, n)`
|
|
1259
|
+
|
|
1260
|
+
The colour of layer `k` of `n`: `colors[k]`, else the palette from dark at
|
|
1261
|
+
the back to light at the front.
|
|
1262
|
+
|
|
1263
|
+
## Balls and domes
|
|
1264
|
+
|
|
1265
|
+
`use <kerf/sphere>`
|
|
1266
|
+
|
|
1267
|
+
Slot-together balls and domes, as 3D baubles, globes and lantern domes:
|
|
1268
|
+
half-disc fins standing round an upright axis, like the segments of an
|
|
1269
|
+
orange, held by flat rings slotted onto them with halving joints. The fins
|
|
1270
|
+
stop short of the axis, so they never meet.
|
|
1271
|
+
|
|
1272
|
+
```kerf
|
|
1273
|
+
use <kerf/sphere>
|
|
1274
|
+
use <kerf/scene>
|
|
1275
|
+
|
|
1276
|
+
$thickness = 3;
|
|
1277
|
+
// A bauble with a snowman standing inside it
|
|
1278
|
+
ball(140, fins = 6, hollow = 50, floor = true, at = [0, 0, 70]);
|
|
1279
|
+
scene_figure("snowman", 34, at = [0, 0, 71.5]);
|
|
1280
|
+
```
|
|
1281
|
+
|
|
1282
|
+
### `ball(d = 80, fins = 6, rings = 1, width = 8, hollow = 0, floor = false, dome = false, loop = 4, at = [0, 0, 0], label = "ball", clearance = 0.1)`
|
|
1283
|
+
|
|
1284
|
+
A ball `d` across, its centre at `at`: `fins` fins and `rings` rings
|
|
1285
|
+
`width` wide, the equator alone or spread from 60 degrees south to north.
|
|
1286
|
+
`dome = true` makes the top half, standing on its lowest ring. `hollow`
|
|
1287
|
+
cuts the fins away within that radius, to make room for a scene inside,
|
|
1288
|
+
and `floor = true` makes the lowest ring a whole disc for it to stand on,
|
|
1289
|
+
with a rail across the hollow for a standee's feet. `loop` puts a hole of
|
|
1290
|
+
that diameter near the top of each fin for a ribbon to hang it by. The
|
|
1291
|
+
parts are `"ball fin"` and `"ball ring 1"` up, named after `label`.
|
|
1292
|
+
|
|
1293
|
+
### `ball_rings(d, rings = 1, dome = false)`
|
|
1294
|
+
|
|
1295
|
+
The heights of a ball's rings above its centre.
|
|
1296
|
+
|
|
1297
|
+
## Scenes
|
|
1298
|
+
|
|
1299
|
+
`use <kerf/scene>`
|
|
1300
|
+
|
|
1301
|
+
Scene boxes and dioramas. A floor (or a shelf) has **rails**: slots running
|
|
1302
|
+
across it, in rows from front to back. Every **standee** has 8 mm feet that
|
|
1303
|
+
go into any rail, so a scene changes by taking standees out and putting
|
|
1304
|
+
others in. A standee is drawn standing on y = 0, centred on x = 0.
|
|
1305
|
+
|
|
1306
|
+
```kerf
|
|
1307
|
+
use <kerf/scene>
|
|
1308
|
+
|
|
1309
|
+
$thickness = 3;
|
|
1310
|
+
rows = scene_rows(90);
|
|
1311
|
+
part("floor", at = [-100, 0, 0]) scene_floor(200, 90);
|
|
1312
|
+
scene_figure("snowman", 70, at = [-50, rows[1], 3]);
|
|
1313
|
+
scene_figure("gnome", 26, at = [40, rows[0], 3]);
|
|
1314
|
+
part("trees", at = [0, rows[5] + 1.5, 3], rotate = [90, 0, 0]) standee(full = true) {
|
|
1315
|
+
translate([-90, 0]) rect([180, 14]);
|
|
1316
|
+
for (x = [-80:20:80]) translate([x, 14]) regular_polygon(3, 22);
|
|
1317
|
+
}
|
|
1318
|
+
```
|
|
1319
|
+
|
|
1320
|
+
### `scene_rows(depth, rows = 6)`
|
|
1321
|
+
|
|
1322
|
+
Where the rails of a floor `depth` mm deep run, as y from its front edge:
|
|
1323
|
+
`rows` of them, the first 8 mm from the front and the last 7 mm from the
|
|
1324
|
+
back. Six rails on a 90 mm floor are at 8, 23, 38, 53, 68 and 83.
|
|
1325
|
+
|
|
1326
|
+
### `scene_floor(width, depth, rows = 6, clearance = 0.1, margin = 6, r = 0)`, `scene_rails(width, depth, rows = 6, clearance = 0.1, margin = 6)`
|
|
1327
|
+
|
|
1328
|
+
A floor `width` by `depth` with its rails cut, its front edge on y = 0; or
|
|
1329
|
+
only the rails, as slots to cut from a floor or shelf of your own. Each
|
|
1330
|
+
rail is `$thickness + clearance` wide and stops `margin` short of each
|
|
1331
|
+
side.
|
|
1332
|
+
|
|
1333
|
+
### `standee(mound, full = false, tab = 8, floor, clip)`
|
|
1334
|
+
|
|
1335
|
+
Its children, a drawing, as a standee: `tab` mm feet below y = 0 that go
|
|
1336
|
+
`floor` mm (`$thickness` unless given) into a rail. The feet spread over
|
|
1337
|
+
the width the drawing stands on: one under 28 mm, two a quarter of the
|
|
1338
|
+
width either side of the middle otherwise, three across a `full` width
|
|
1339
|
+
backdrop. A narrow standee stands on a mound 4.5 mm high, which `mound`
|
|
1340
|
+
sets; without one, a ground line 2 mm high joins legs that meet the floor
|
|
1341
|
+
apart. With `clip`, a polygon's points, the drawing is clipped to it and
|
|
1342
|
+
the feet left whole, as for a standee inside a round case.
|
|
1343
|
+
|
|
1344
|
+
### `standee_feet(width, full = false)`, `standee_mound(width)`
|
|
1345
|
+
|
|
1346
|
+
Where the feet go across a standee `width` wide, from its middle, and the
|
|
1347
|
+
mound under it.
|
|
1348
|
+
|
|
1349
|
+
### `scene_figure(name, height = 60, at = [0, 0, 0], turn = 0, label, mound, floor, border = 2, gap = 0.6)`
|
|
1350
|
+
|
|
1351
|
+
A layered figure from [`kerf/figures`](#figures) standing in a rail: its
|
|
1352
|
+
backer a standee, the other layers glued on its front, each colour a
|
|
1353
|
+
painted part. `at` is where its feet go, `[x, the rail's y, the floor's
|
|
1354
|
+
top z]`, and `turn` turns it about them.
|
|
1355
|
+
|
|
1356
|
+
### `figure_base(name, height = 80, base = [60, 20], at = [0, 0, 0], label, clearance = 0.1, r = 3)`
|
|
1357
|
+
|
|
1358
|
+
A layered figure on a base of its own, to stand on a shelf: a base plate
|
|
1359
|
+
with one rail, centred on `at`, the figure's feet in it.
|
|
1360
|
+
|
|
1361
|
+
### `drip_edge(width, height = 6, depth = 8, n, seed = 1)`, `wave_edge(width, height = 6, depth = 4, n)`
|
|
1362
|
+
|
|
1363
|
+
Edges for snow, icing, water and frills: a strip `width` wide and `height`
|
|
1364
|
+
tall above y = 0, with `n` round drips hanging below it up to `depth` mm,
|
|
1365
|
+
their lengths varied by `seed`; or with `n` waves `depth` mm deep along
|
|
1366
|
+
its bottom.
|
|
1367
|
+
|
|
935
1368
|
## Symbols
|
|
936
1369
|
|
|
937
1370
|
`use <kerf/symbols>`
|
|
@@ -950,7 +1383,7 @@ part("tag") {
|
|
|
950
1383
|
}
|
|
951
1384
|
```
|
|
952
1385
|
|
|
953
|
-
### `symbol(name, size = 10, center = true, fill = "nonzero", box = "drawn", solid = false, close, bridge)`
|
|
1386
|
+
### `symbol(name, size = 10, center = true, fill = "nonzero", box = "drawn", solid = false, close, bridge, min_width)`
|
|
954
1387
|
|
|
955
1388
|
The symbol `size` mm across the longer side of what it draws, centred on
|
|
956
1389
|
the origin, or with its bottom left corner there. With `box = "grid"`,
|
|
@@ -964,6 +1397,11 @@ closed and holes filled, and the drawing's own detail engraved on it.
|
|
|
964
1397
|
`bridge = w` also joins pieces too far apart to close, such as a moon
|
|
965
1398
|
beside a mountain, with strips `w` wide.
|
|
966
1399
|
|
|
1400
|
+
A symbol drawn small has lines too thin to cut: a bird's legs, a bee's
|
|
1401
|
+
feelers. `min_width = 1.6` grows every line narrower than 1.6 mm to that
|
|
1402
|
+
width, so it can be cut and holds together; gaps narrower than it close
|
|
1403
|
+
up as the lines either side grow.
|
|
1404
|
+
|
|
967
1405
|
### `symbol_names(category)`, `symbol_size(name, size = 10, box = "drawn")`, `symbol_source(name)`, `symbol_entry(name)`
|
|
968
1406
|
|
|
969
1407
|
The names of every symbol, or of one category; the `[width, height]` a
|