@mylasertools/kerfscript 0.9.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 +287 -0
- package/LANGUAGE.md +100 -44
- package/README.md +2 -1
- package/dist/assembly.d.cts +22 -1
- package/dist/assembly.d.ts +22 -1
- package/dist/bores.d.cts +10 -0
- package/dist/bores.d.ts +10 -0
- package/dist/cli.js +9977 -6847
- package/dist/colors.d.cts +4 -0
- package/dist/colors.d.ts +4 -0
- package/dist/customizer.d.cts +3 -0
- package/dist/customizer.d.ts +3 -0
- package/dist/effects.d.cts +31 -0
- package/dist/effects.d.ts +31 -0
- package/dist/evaluator.d.cts +10 -1
- package/dist/evaluator.d.ts +10 -1
- package/dist/export/mesh.d.cts +66 -0
- package/dist/export/mesh.d.ts +66 -0
- package/dist/export/model.d.cts +14 -0
- package/dist/export/model.d.ts +14 -0
- package/dist/export/pages.d.cts +23 -0
- package/dist/export/pages.d.ts +23 -0
- package/dist/export/triangulate.d.cts +5 -0
- package/dist/export/triangulate.d.ts +5 -0
- package/dist/export/zip.d.cts +5 -0
- package/dist/export/zip.d.ts +5 -0
- package/dist/geometry.d.cts +21 -0
- package/dist/geometry.d.ts +21 -0
- package/dist/hardware.d.cts +2 -0
- package/dist/hardware.d.ts +2 -0
- package/dist/highlight.cjs +2 -2
- package/dist/highlight.js +2 -2
- package/dist/import/dbg.d.cts +1 -0
- package/dist/import/dbg.d.ts +1 -0
- package/dist/index.cjs +1693 -75
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +1693 -75
- package/dist/instructions.d.cts +27 -0
- package/dist/instructions.d.ts +27 -0
- package/dist/language.cjs +1664 -53
- package/dist/language.js +1664 -53
- package/dist/libraries.cjs +1641 -36
- package/dist/libraries.js +1641 -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 +8 -0
- package/dist/render.d.ts +8 -0
- package/dist/signatures.cjs +98 -9
- package/dist/signatures.js +98 -9
- package/dist/text.d.cts +29 -0
- package/dist/text.d.ts +29 -0
- package/dist/verify/types.d.cts +6 -0
- package/dist/verify/types.d.ts +6 -0
- package/docs/3d-files.md +93 -0
- package/docs/cli.md +38 -22
- package/docs/customizer.md +69 -0
- package/docs/javascript.md +51 -0
- package/docs/layers.md +24 -1
- package/docs/library.md +574 -16
- package/docs/openscad.md +15 -13
- package/docs/parts-and-sheets.md +207 -29
- package/docs/verification.md +1 -1
- package/docs/versions.md +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { HardwareItem } from './evaluator.cjs';
|
|
2
|
+
type Vec3 = [number, number, number];
|
|
3
|
+
export interface Light {
|
|
4
|
+
/** A point light at from, or light all along a strip from `from` to `to` */
|
|
5
|
+
from: Vec3;
|
|
6
|
+
to: Vec3;
|
|
7
|
+
/** #rrggbb */
|
|
8
|
+
color: string;
|
|
9
|
+
/** Light given off in all, in lumens (a tealight is about 12) */
|
|
10
|
+
lumens: number;
|
|
11
|
+
/** A flame: it flickers in the 3D view */
|
|
12
|
+
flicker: boolean;
|
|
13
|
+
/** What gives it off: "tealight", "led", "bulb", or "light" for light() */
|
|
14
|
+
source: string;
|
|
15
|
+
/** The assembly step that adds it, 0 for none */
|
|
16
|
+
step: number;
|
|
17
|
+
label?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Colours a light may be named by, besides the paint colours */
|
|
20
|
+
export declare const LIGHT_COLORS: Record<string, string>;
|
|
21
|
+
/** A light's colour as #rrggbb, from a name or a hex colour */
|
|
22
|
+
export declare function lightColor(v: string): string | undefined;
|
|
23
|
+
/** A tealight: a cup 39 mm across and 16 mm high, its flame 10 mm above */
|
|
24
|
+
export declare const TEALIGHT: {
|
|
25
|
+
diameter: number;
|
|
26
|
+
height: number;
|
|
27
|
+
flame: number;
|
|
28
|
+
};
|
|
29
|
+
/** The light a piece of hardware gives off: a tealight's flame, an LED or
|
|
30
|
+
* a strip of them, a bulb */
|
|
31
|
+
export declare function hardwareLights(h: HardwareItem): Light[];
|
|
32
|
+
/** Points that stand for a light: the point itself, or up to `max` evenly
|
|
33
|
+
* along a strip, sharing its lumens */
|
|
34
|
+
export declare function lightPoints(light: Light, max?: number): {
|
|
35
|
+
at: Vec3;
|
|
36
|
+
lumens: number;
|
|
37
|
+
}[];
|
|
38
|
+
export {};
|
package/dist/lights.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { HardwareItem } from './evaluator.js';
|
|
2
|
+
type Vec3 = [number, number, number];
|
|
3
|
+
export interface Light {
|
|
4
|
+
/** A point light at from, or light all along a strip from `from` to `to` */
|
|
5
|
+
from: Vec3;
|
|
6
|
+
to: Vec3;
|
|
7
|
+
/** #rrggbb */
|
|
8
|
+
color: string;
|
|
9
|
+
/** Light given off in all, in lumens (a tealight is about 12) */
|
|
10
|
+
lumens: number;
|
|
11
|
+
/** A flame: it flickers in the 3D view */
|
|
12
|
+
flicker: boolean;
|
|
13
|
+
/** What gives it off: "tealight", "led", "bulb", or "light" for light() */
|
|
14
|
+
source: string;
|
|
15
|
+
/** The assembly step that adds it, 0 for none */
|
|
16
|
+
step: number;
|
|
17
|
+
label?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Colours a light may be named by, besides the paint colours */
|
|
20
|
+
export declare const LIGHT_COLORS: Record<string, string>;
|
|
21
|
+
/** A light's colour as #rrggbb, from a name or a hex colour */
|
|
22
|
+
export declare function lightColor(v: string): string | undefined;
|
|
23
|
+
/** A tealight: a cup 39 mm across and 16 mm high, its flame 10 mm above */
|
|
24
|
+
export declare const TEALIGHT: {
|
|
25
|
+
diameter: number;
|
|
26
|
+
height: number;
|
|
27
|
+
flame: number;
|
|
28
|
+
};
|
|
29
|
+
/** The light a piece of hardware gives off: a tealight's flame, an LED or
|
|
30
|
+
* a strip of them, a bulb */
|
|
31
|
+
export declare function hardwareLights(h: HardwareItem): Light[];
|
|
32
|
+
/** Points that stand for a light: the point itself, or up to `max` evenly
|
|
33
|
+
* along a strip, sharing its lumens */
|
|
34
|
+
export declare function lightPoints(light: Light, max?: number): {
|
|
35
|
+
at: Vec3;
|
|
36
|
+
lumens: number;
|
|
37
|
+
}[];
|
|
38
|
+
export {};
|
package/dist/png.d.cts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import type { LayerDef } from './evaluator.cjs';
|
|
2
2
|
import type { Sheet } from './render.cjs';
|
|
3
|
+
type Poly = [number, number][];
|
|
4
|
+
type RGB = [number, number, number];
|
|
5
|
+
export declare class Canvas {
|
|
6
|
+
readonly w: number;
|
|
7
|
+
readonly h: number;
|
|
8
|
+
readonly data: Uint8ClampedArray;
|
|
9
|
+
constructor(w: number, h: number);
|
|
10
|
+
blend(i: number, c: RGB, a: number): void;
|
|
11
|
+
fill(polys: Poly[], c: RGB, alpha: number): void;
|
|
12
|
+
line(p: Poly, c: RGB, width: number): void;
|
|
13
|
+
}
|
|
14
|
+
/** A picture `w` by `h` pixels, white, drawn on by `draw`, as a PNG */
|
|
15
|
+
export declare function pngOf(w: number, h: number, draw: (cv: Canvas) => void): Uint8Array;
|
|
3
16
|
/** The most pixels a picture of a sheet has, and on each side */
|
|
4
17
|
export declare const MAX_PIXELS = 16000000;
|
|
5
18
|
export declare const MAX_SIDE = 16384;
|
|
@@ -7,3 +20,4 @@ export declare const MAX_SIDE = 16384;
|
|
|
7
20
|
* MAX_PIXELS or MAX_SIDE): fills in their layer colours,
|
|
8
21
|
* then line and cut layers on top. `side` "back" draws the back job. */
|
|
9
22
|
export declare function sheetPng(sheet: Sheet, layers: LayerDef[], width?: number): Uint8Array;
|
|
23
|
+
export {};
|
package/dist/png.d.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import type { LayerDef } from './evaluator.js';
|
|
2
2
|
import type { Sheet } from './render.js';
|
|
3
|
+
type Poly = [number, number][];
|
|
4
|
+
type RGB = [number, number, number];
|
|
5
|
+
export declare class Canvas {
|
|
6
|
+
readonly w: number;
|
|
7
|
+
readonly h: number;
|
|
8
|
+
readonly data: Uint8ClampedArray;
|
|
9
|
+
constructor(w: number, h: number);
|
|
10
|
+
blend(i: number, c: RGB, a: number): void;
|
|
11
|
+
fill(polys: Poly[], c: RGB, alpha: number): void;
|
|
12
|
+
line(p: Poly, c: RGB, width: number): void;
|
|
13
|
+
}
|
|
14
|
+
/** A picture `w` by `h` pixels, white, drawn on by `draw`, as a PNG */
|
|
15
|
+
export declare function pngOf(w: number, h: number, draw: (cv: Canvas) => void): Uint8Array;
|
|
3
16
|
/** The most pixels a picture of a sheet has, and on each side */
|
|
4
17
|
export declare const MAX_PIXELS = 16000000;
|
|
5
18
|
export declare const MAX_SIDE = 16384;
|
|
@@ -7,3 +20,4 @@ export declare const MAX_SIDE = 16384;
|
|
|
7
20
|
* MAX_PIXELS or MAX_SIDE): fills in their layer colours,
|
|
8
21
|
* then line and cut layers on top. `side` "back" draws the back job. */
|
|
9
22
|
export declare function sheetPng(sheet: Sheet, layers: LayerDef[], width?: number): Uint8Array;
|
|
23
|
+
export {};
|
package/dist/render.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type AssemblyPart } from './assembly.cjs';
|
|
2
2
|
import type { RenderAnalysis } from './analysis.cjs';
|
|
3
|
+
import type { Light } from './lights.cjs';
|
|
3
4
|
import { type HardwareItem, type LayerDef, type Limits } from './evaluator.cjs';
|
|
4
5
|
import { type LayerPath } from './export/svg.cjs';
|
|
5
6
|
import { type Layer } from './geometry.cjs';
|
|
@@ -33,10 +34,13 @@ export interface PartInfo {
|
|
|
33
34
|
thickness: number;
|
|
34
35
|
kerf: number;
|
|
35
36
|
material: string;
|
|
37
|
+
paint?: string;
|
|
36
38
|
stack?: number;
|
|
37
39
|
glued?: string;
|
|
38
40
|
label?: number;
|
|
39
41
|
mirrored?: boolean;
|
|
42
|
+
copies?: number[];
|
|
43
|
+
joins?: string[];
|
|
40
44
|
}
|
|
41
45
|
export interface Placed {
|
|
42
46
|
part: string;
|
|
@@ -72,10 +76,14 @@ export interface RenderResult {
|
|
|
72
76
|
svg: string;
|
|
73
77
|
parts: PartInfo[];
|
|
74
78
|
assembly: AssemblyPart[];
|
|
79
|
+
/** Every copy of every part, flat at its own origin, placed or not: for
|
|
80
|
+
* laying the parts out, or exporting them flat */
|
|
81
|
+
flat: AssemblyPart[];
|
|
75
82
|
layers: LayerDef[];
|
|
76
83
|
warnings: string[];
|
|
77
84
|
echoes: string[];
|
|
78
85
|
hardware: HardwareItem[];
|
|
86
|
+
lights: Light[];
|
|
79
87
|
steps: string[];
|
|
80
88
|
}
|
|
81
89
|
export declare function render(source: string, options?: RenderOptions): RenderResult;
|
package/dist/render.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type AssemblyPart } from './assembly.js';
|
|
2
2
|
import type { RenderAnalysis } from './analysis.js';
|
|
3
|
+
import type { Light } from './lights.js';
|
|
3
4
|
import { type HardwareItem, type LayerDef, type Limits } from './evaluator.js';
|
|
4
5
|
import { type LayerPath } from './export/svg.js';
|
|
5
6
|
import { type Layer } from './geometry.js';
|
|
@@ -33,10 +34,13 @@ export interface PartInfo {
|
|
|
33
34
|
thickness: number;
|
|
34
35
|
kerf: number;
|
|
35
36
|
material: string;
|
|
37
|
+
paint?: string;
|
|
36
38
|
stack?: number;
|
|
37
39
|
glued?: string;
|
|
38
40
|
label?: number;
|
|
39
41
|
mirrored?: boolean;
|
|
42
|
+
copies?: number[];
|
|
43
|
+
joins?: string[];
|
|
40
44
|
}
|
|
41
45
|
export interface Placed {
|
|
42
46
|
part: string;
|
|
@@ -72,10 +76,14 @@ export interface RenderResult {
|
|
|
72
76
|
svg: string;
|
|
73
77
|
parts: PartInfo[];
|
|
74
78
|
assembly: AssemblyPart[];
|
|
79
|
+
/** Every copy of every part, flat at its own origin, placed or not: for
|
|
80
|
+
* laying the parts out, or exporting them flat */
|
|
81
|
+
flat: AssemblyPart[];
|
|
75
82
|
layers: LayerDef[];
|
|
76
83
|
warnings: string[];
|
|
77
84
|
echoes: string[];
|
|
78
85
|
hardware: HardwareItem[];
|
|
86
|
+
lights: Light[];
|
|
79
87
|
steps: string[];
|
|
80
88
|
}
|
|
81
89
|
export declare function render(source: string, options?: RenderOptions): RenderResult;
|
package/dist/signatures.cjs
CHANGED
|
@@ -60,9 +60,13 @@ var text = (name, doc) => ({
|
|
|
60
60
|
p("size", "Font size in millimetres", "10"),
|
|
61
61
|
p("font", "Font name", "$font"),
|
|
62
62
|
named("halign", "left, center or right", '"left"'),
|
|
63
|
-
named(
|
|
63
|
+
named(
|
|
64
|
+
"valign",
|
|
65
|
+
"baseline, top, center, bottom, or cap (capitals centred on y = 0)",
|
|
66
|
+
'"baseline"'
|
|
67
|
+
),
|
|
64
68
|
named("spacing", "Letter spacing factor", "1"),
|
|
65
|
-
named("fit", "Measure at the size that fits this width")
|
|
69
|
+
named("fit", "Measure at the size that fits this width, or [width, cap height]")
|
|
66
70
|
],
|
|
67
71
|
section: "Text measurements",
|
|
68
72
|
doc
|
|
@@ -101,7 +105,10 @@ var SIGNATURES = [
|
|
|
101
105
|
{
|
|
102
106
|
name: "ellipse",
|
|
103
107
|
kind: "module",
|
|
104
|
-
params: [
|
|
108
|
+
params: [
|
|
109
|
+
p("r", "[rx, ry], or one radius for both", "1"),
|
|
110
|
+
named("d", "[width, height], or one diameter for both, instead of r")
|
|
111
|
+
],
|
|
105
112
|
section: "Shapes",
|
|
106
113
|
doc: "An ellipse centred on the origin"
|
|
107
114
|
},
|
|
@@ -152,9 +159,16 @@ var SIGNATURES = [
|
|
|
152
159
|
p("size", "Font size in millimetres", "10"),
|
|
153
160
|
p("font", "Font name", "$font"),
|
|
154
161
|
named("halign", "left, center or right", '"left"'),
|
|
155
|
-
named(
|
|
162
|
+
named(
|
|
163
|
+
"valign",
|
|
164
|
+
"baseline, top, center, bottom, or cap (capitals centred on y = 0)",
|
|
165
|
+
'"baseline"'
|
|
166
|
+
),
|
|
156
167
|
named("spacing", "Letter spacing factor", "1"),
|
|
157
|
-
named(
|
|
168
|
+
named(
|
|
169
|
+
"fit",
|
|
170
|
+
"Shrink the size so the text is no wider than this, or fits [width, cap height]"
|
|
171
|
+
),
|
|
158
172
|
named(
|
|
159
173
|
"weight",
|
|
160
174
|
'"bold" thickens the strokes by 3.5% of the size, or a number of mm (less than 0 thins them)',
|
|
@@ -163,6 +177,26 @@ var SIGNATURES = [
|
|
|
163
177
|
named(
|
|
164
178
|
"bridge",
|
|
165
179
|
"Join every island (an i's dot, an accent, a stencil's counter) to the rest with a strip this wide"
|
|
180
|
+
),
|
|
181
|
+
named(
|
|
182
|
+
"weld",
|
|
183
|
+
"Slide each word's letters together into one piece, as a script name is cut; a number is how far each overlaps the one before, in mm",
|
|
184
|
+
"false"
|
|
185
|
+
),
|
|
186
|
+
named("underline", "With weld: a bar this high under the baseline, joining the words"),
|
|
187
|
+
named(
|
|
188
|
+
"lines",
|
|
189
|
+
"Break the text at spaces into up to this many lines; with fit, as many as let it be biggest",
|
|
190
|
+
"1"
|
|
191
|
+
),
|
|
192
|
+
named("line_spacing", "The distance between lines, as a share of the usual", "1"),
|
|
193
|
+
named(
|
|
194
|
+
"path",
|
|
195
|
+
"Lay the text along these [x, y] points, each letter turned to the path, centred on it"
|
|
196
|
+
),
|
|
197
|
+
named(
|
|
198
|
+
"arc",
|
|
199
|
+
"Lay the text round a circle of this radius about the origin: over the top, or along the bottom when less than 0"
|
|
166
200
|
)
|
|
167
201
|
],
|
|
168
202
|
section: "Shapes",
|
|
@@ -500,8 +534,8 @@ var SIGNATURES = [
|
|
|
500
534
|
kind: "module",
|
|
501
535
|
params: [
|
|
502
536
|
p("name", "Layer name"),
|
|
503
|
-
p("mode", '"cut", "line", "fill" or "
|
|
504
|
-
p("color", 'Colour in the output, as "#00aa00"'),
|
|
537
|
+
p("mode", '"cut", "line", "fill", "guide" or "paint" (shown in 3D, not cut)'),
|
|
538
|
+
p("color", 'Colour in the output, as "#00aa00" or a name, as "red"'),
|
|
505
539
|
named("order", "Where it goes among the custom layers in the files, lowest first", "0"),
|
|
506
540
|
named("bleed", "How far past the part's edge it may print", "0"),
|
|
507
541
|
named(
|
|
@@ -525,7 +559,30 @@ var SIGNATURES = [
|
|
|
525
559
|
named("stack", "Layers glued in a stack at each placement, one thickness apart", "1"),
|
|
526
560
|
named("mirror", "Cut the part mirrored left to right, its text still reading", "false"),
|
|
527
561
|
named("material", "The material it is cut from, as material(name = ...) sets it"),
|
|
562
|
+
named(
|
|
563
|
+
"pieces",
|
|
564
|
+
'How many separate pieces it cuts into, as a pair of eyes, or "any": no warning that it is in pieces',
|
|
565
|
+
"1"
|
|
566
|
+
),
|
|
567
|
+
named(
|
|
568
|
+
"paint",
|
|
569
|
+
'Its colour in the 3D view and the print layout, as "red" or "#c8372d"; the part stays on the sheet of its material'
|
|
570
|
+
),
|
|
528
571
|
named("bend", "Living hinge bends in the assembled view: [x0, x1, angle] or a list"),
|
|
572
|
+
named(
|
|
573
|
+
"fold",
|
|
574
|
+
"Folds along any line in the assembled view, as for card: [from, to, angle] or a list; more than 0 folds towards the top face"
|
|
575
|
+
),
|
|
576
|
+
named("fold_open", "How far the folds are folded: 0 lies flat, 1 as their angles say", "1"),
|
|
577
|
+
named(
|
|
578
|
+
"hang",
|
|
579
|
+
"The point [x, y] on the part it hangs from, at `at`: it swings in its own plane until its weight is below"
|
|
580
|
+
),
|
|
581
|
+
named("cord", "The cord it hangs on, in mm; 0 for a ring or pin", "0"),
|
|
582
|
+
named(
|
|
583
|
+
"split",
|
|
584
|
+
"Cut a part too big for the bed into pieces joined by jigsaw knobs: true for the sheet, or [width, height]"
|
|
585
|
+
),
|
|
529
586
|
named("on", "The name of a bent part this one is glued to, to move with it"),
|
|
530
587
|
named("slots", "Names of parts whose tabs pass through this one: their slots are cut"),
|
|
531
588
|
named("clearance", "Added to the slots, in total across each", "0.1"),
|
|
@@ -550,7 +607,12 @@ var SIGNATURES = [
|
|
|
550
607
|
"glue",
|
|
551
608
|
"The name of a part this one is glued flat onto; at and rotate are then on its face"
|
|
552
609
|
),
|
|
553
|
-
named("face", 'The face of the glue part it goes on: "top" or "bottom"', '"top"')
|
|
610
|
+
named("face", 'The face of the glue part it goes on: "top" or "bottom"', '"top"'),
|
|
611
|
+
named(
|
|
612
|
+
"press_fit",
|
|
613
|
+
"Pressed into the glue part, as an inlay: they overlap on purpose, so they are not checked against each other",
|
|
614
|
+
"false"
|
|
615
|
+
)
|
|
554
616
|
],
|
|
555
617
|
children: true,
|
|
556
618
|
section: "Parts and sheets",
|
|
@@ -598,12 +660,35 @@ var SIGNATURES = [
|
|
|
598
660
|
named("up", "The direction a [width, height] section's height points"),
|
|
599
661
|
named("sides", "Sides of a round section in the 3D view; 0 makes a ball", "24"),
|
|
600
662
|
named("shape", '"rod", or "ball" for a bulb, a marble or a bead', '"rod"'),
|
|
601
|
-
named("label", "The name in the hardware list")
|
|
663
|
+
named("label", "The name in the hardware list"),
|
|
664
|
+
named(
|
|
665
|
+
"mass",
|
|
666
|
+
"Its weight in grams, for the check that the model stands, as an egg in a holder"
|
|
667
|
+
)
|
|
602
668
|
],
|
|
603
669
|
children: true,
|
|
604
670
|
section: "Parts and sheets",
|
|
605
671
|
doc: "Hardware the assembly needs, in the parts list and the 3D view"
|
|
606
672
|
},
|
|
673
|
+
{
|
|
674
|
+
name: "light",
|
|
675
|
+
kind: "module",
|
|
676
|
+
params: [
|
|
677
|
+
p("at", "Where the light is, [x, y, z]", "[0, 0, 0]"),
|
|
678
|
+
p(
|
|
679
|
+
"color",
|
|
680
|
+
`Its colour: "warm white", "white", "cool white", "warm", "flame", a colour's name or "#ffd9a0"`,
|
|
681
|
+
'"warm white"'
|
|
682
|
+
),
|
|
683
|
+
p("lumens", "How much light it gives off: a tealight is about 12", "20"),
|
|
684
|
+
named("to", "The other end of a strip of light, [x, y, z]: it lights all along"),
|
|
685
|
+
named("flicker", "A flame: it flickers in the 3D view", "false"),
|
|
686
|
+
named("label", "Its name in 3D files")
|
|
687
|
+
],
|
|
688
|
+
children: true,
|
|
689
|
+
section: "Parts and sheets",
|
|
690
|
+
doc: "A light source in the 3D view and GLB files, with nothing to show for it"
|
|
691
|
+
},
|
|
607
692
|
{
|
|
608
693
|
name: "material",
|
|
609
694
|
kind: "module",
|
|
@@ -1073,6 +1158,10 @@ var SIGNATURES = [
|
|
|
1073
1158
|
// Text and joints
|
|
1074
1159
|
text("text_width", "The advance width of the text, including spacing"),
|
|
1075
1160
|
text("text_metrics", "The text as [advance, [[x0, y0], [x1, y1]], ascent, descent]"),
|
|
1161
|
+
text(
|
|
1162
|
+
"text_size",
|
|
1163
|
+
"The text as a record: width (advance), height, bounds, cap (capital height), ascent, descent and size"
|
|
1164
|
+
),
|
|
1076
1165
|
{
|
|
1077
1166
|
name: "finger_count",
|
|
1078
1167
|
kind: "function",
|
package/dist/signatures.js
CHANGED
|
@@ -35,9 +35,13 @@ var text = (name, doc) => ({
|
|
|
35
35
|
p("size", "Font size in millimetres", "10"),
|
|
36
36
|
p("font", "Font name", "$font"),
|
|
37
37
|
named("halign", "left, center or right", '"left"'),
|
|
38
|
-
named(
|
|
38
|
+
named(
|
|
39
|
+
"valign",
|
|
40
|
+
"baseline, top, center, bottom, or cap (capitals centred on y = 0)",
|
|
41
|
+
'"baseline"'
|
|
42
|
+
),
|
|
39
43
|
named("spacing", "Letter spacing factor", "1"),
|
|
40
|
-
named("fit", "Measure at the size that fits this width")
|
|
44
|
+
named("fit", "Measure at the size that fits this width, or [width, cap height]")
|
|
41
45
|
],
|
|
42
46
|
section: "Text measurements",
|
|
43
47
|
doc
|
|
@@ -76,7 +80,10 @@ var SIGNATURES = [
|
|
|
76
80
|
{
|
|
77
81
|
name: "ellipse",
|
|
78
82
|
kind: "module",
|
|
79
|
-
params: [
|
|
83
|
+
params: [
|
|
84
|
+
p("r", "[rx, ry], or one radius for both", "1"),
|
|
85
|
+
named("d", "[width, height], or one diameter for both, instead of r")
|
|
86
|
+
],
|
|
80
87
|
section: "Shapes",
|
|
81
88
|
doc: "An ellipse centred on the origin"
|
|
82
89
|
},
|
|
@@ -127,9 +134,16 @@ var SIGNATURES = [
|
|
|
127
134
|
p("size", "Font size in millimetres", "10"),
|
|
128
135
|
p("font", "Font name", "$font"),
|
|
129
136
|
named("halign", "left, center or right", '"left"'),
|
|
130
|
-
named(
|
|
137
|
+
named(
|
|
138
|
+
"valign",
|
|
139
|
+
"baseline, top, center, bottom, or cap (capitals centred on y = 0)",
|
|
140
|
+
'"baseline"'
|
|
141
|
+
),
|
|
131
142
|
named("spacing", "Letter spacing factor", "1"),
|
|
132
|
-
named(
|
|
143
|
+
named(
|
|
144
|
+
"fit",
|
|
145
|
+
"Shrink the size so the text is no wider than this, or fits [width, cap height]"
|
|
146
|
+
),
|
|
133
147
|
named(
|
|
134
148
|
"weight",
|
|
135
149
|
'"bold" thickens the strokes by 3.5% of the size, or a number of mm (less than 0 thins them)',
|
|
@@ -138,6 +152,26 @@ var SIGNATURES = [
|
|
|
138
152
|
named(
|
|
139
153
|
"bridge",
|
|
140
154
|
"Join every island (an i's dot, an accent, a stencil's counter) to the rest with a strip this wide"
|
|
155
|
+
),
|
|
156
|
+
named(
|
|
157
|
+
"weld",
|
|
158
|
+
"Slide each word's letters together into one piece, as a script name is cut; a number is how far each overlaps the one before, in mm",
|
|
159
|
+
"false"
|
|
160
|
+
),
|
|
161
|
+
named("underline", "With weld: a bar this high under the baseline, joining the words"),
|
|
162
|
+
named(
|
|
163
|
+
"lines",
|
|
164
|
+
"Break the text at spaces into up to this many lines; with fit, as many as let it be biggest",
|
|
165
|
+
"1"
|
|
166
|
+
),
|
|
167
|
+
named("line_spacing", "The distance between lines, as a share of the usual", "1"),
|
|
168
|
+
named(
|
|
169
|
+
"path",
|
|
170
|
+
"Lay the text along these [x, y] points, each letter turned to the path, centred on it"
|
|
171
|
+
),
|
|
172
|
+
named(
|
|
173
|
+
"arc",
|
|
174
|
+
"Lay the text round a circle of this radius about the origin: over the top, or along the bottom when less than 0"
|
|
141
175
|
)
|
|
142
176
|
],
|
|
143
177
|
section: "Shapes",
|
|
@@ -475,8 +509,8 @@ var SIGNATURES = [
|
|
|
475
509
|
kind: "module",
|
|
476
510
|
params: [
|
|
477
511
|
p("name", "Layer name"),
|
|
478
|
-
p("mode", '"cut", "line", "fill" or "
|
|
479
|
-
p("color", 'Colour in the output, as "#00aa00"'),
|
|
512
|
+
p("mode", '"cut", "line", "fill", "guide" or "paint" (shown in 3D, not cut)'),
|
|
513
|
+
p("color", 'Colour in the output, as "#00aa00" or a name, as "red"'),
|
|
480
514
|
named("order", "Where it goes among the custom layers in the files, lowest first", "0"),
|
|
481
515
|
named("bleed", "How far past the part's edge it may print", "0"),
|
|
482
516
|
named(
|
|
@@ -500,7 +534,30 @@ var SIGNATURES = [
|
|
|
500
534
|
named("stack", "Layers glued in a stack at each placement, one thickness apart", "1"),
|
|
501
535
|
named("mirror", "Cut the part mirrored left to right, its text still reading", "false"),
|
|
502
536
|
named("material", "The material it is cut from, as material(name = ...) sets it"),
|
|
537
|
+
named(
|
|
538
|
+
"pieces",
|
|
539
|
+
'How many separate pieces it cuts into, as a pair of eyes, or "any": no warning that it is in pieces',
|
|
540
|
+
"1"
|
|
541
|
+
),
|
|
542
|
+
named(
|
|
543
|
+
"paint",
|
|
544
|
+
'Its colour in the 3D view and the print layout, as "red" or "#c8372d"; the part stays on the sheet of its material'
|
|
545
|
+
),
|
|
503
546
|
named("bend", "Living hinge bends in the assembled view: [x0, x1, angle] or a list"),
|
|
547
|
+
named(
|
|
548
|
+
"fold",
|
|
549
|
+
"Folds along any line in the assembled view, as for card: [from, to, angle] or a list; more than 0 folds towards the top face"
|
|
550
|
+
),
|
|
551
|
+
named("fold_open", "How far the folds are folded: 0 lies flat, 1 as their angles say", "1"),
|
|
552
|
+
named(
|
|
553
|
+
"hang",
|
|
554
|
+
"The point [x, y] on the part it hangs from, at `at`: it swings in its own plane until its weight is below"
|
|
555
|
+
),
|
|
556
|
+
named("cord", "The cord it hangs on, in mm; 0 for a ring or pin", "0"),
|
|
557
|
+
named(
|
|
558
|
+
"split",
|
|
559
|
+
"Cut a part too big for the bed into pieces joined by jigsaw knobs: true for the sheet, or [width, height]"
|
|
560
|
+
),
|
|
504
561
|
named("on", "The name of a bent part this one is glued to, to move with it"),
|
|
505
562
|
named("slots", "Names of parts whose tabs pass through this one: their slots are cut"),
|
|
506
563
|
named("clearance", "Added to the slots, in total across each", "0.1"),
|
|
@@ -525,7 +582,12 @@ var SIGNATURES = [
|
|
|
525
582
|
"glue",
|
|
526
583
|
"The name of a part this one is glued flat onto; at and rotate are then on its face"
|
|
527
584
|
),
|
|
528
|
-
named("face", 'The face of the glue part it goes on: "top" or "bottom"', '"top"')
|
|
585
|
+
named("face", 'The face of the glue part it goes on: "top" or "bottom"', '"top"'),
|
|
586
|
+
named(
|
|
587
|
+
"press_fit",
|
|
588
|
+
"Pressed into the glue part, as an inlay: they overlap on purpose, so they are not checked against each other",
|
|
589
|
+
"false"
|
|
590
|
+
)
|
|
529
591
|
],
|
|
530
592
|
children: true,
|
|
531
593
|
section: "Parts and sheets",
|
|
@@ -573,12 +635,35 @@ var SIGNATURES = [
|
|
|
573
635
|
named("up", "The direction a [width, height] section's height points"),
|
|
574
636
|
named("sides", "Sides of a round section in the 3D view; 0 makes a ball", "24"),
|
|
575
637
|
named("shape", '"rod", or "ball" for a bulb, a marble or a bead', '"rod"'),
|
|
576
|
-
named("label", "The name in the hardware list")
|
|
638
|
+
named("label", "The name in the hardware list"),
|
|
639
|
+
named(
|
|
640
|
+
"mass",
|
|
641
|
+
"Its weight in grams, for the check that the model stands, as an egg in a holder"
|
|
642
|
+
)
|
|
577
643
|
],
|
|
578
644
|
children: true,
|
|
579
645
|
section: "Parts and sheets",
|
|
580
646
|
doc: "Hardware the assembly needs, in the parts list and the 3D view"
|
|
581
647
|
},
|
|
648
|
+
{
|
|
649
|
+
name: "light",
|
|
650
|
+
kind: "module",
|
|
651
|
+
params: [
|
|
652
|
+
p("at", "Where the light is, [x, y, z]", "[0, 0, 0]"),
|
|
653
|
+
p(
|
|
654
|
+
"color",
|
|
655
|
+
`Its colour: "warm white", "white", "cool white", "warm", "flame", a colour's name or "#ffd9a0"`,
|
|
656
|
+
'"warm white"'
|
|
657
|
+
),
|
|
658
|
+
p("lumens", "How much light it gives off: a tealight is about 12", "20"),
|
|
659
|
+
named("to", "The other end of a strip of light, [x, y, z]: it lights all along"),
|
|
660
|
+
named("flicker", "A flame: it flickers in the 3D view", "false"),
|
|
661
|
+
named("label", "Its name in 3D files")
|
|
662
|
+
],
|
|
663
|
+
children: true,
|
|
664
|
+
section: "Parts and sheets",
|
|
665
|
+
doc: "A light source in the 3D view and GLB files, with nothing to show for it"
|
|
666
|
+
},
|
|
582
667
|
{
|
|
583
668
|
name: "material",
|
|
584
669
|
kind: "module",
|
|
@@ -1048,6 +1133,10 @@ var SIGNATURES = [
|
|
|
1048
1133
|
// Text and joints
|
|
1049
1134
|
text("text_width", "The advance width of the text, including spacing"),
|
|
1050
1135
|
text("text_metrics", "The text as [advance, [[x0, y0], [x1, y1]], ascent, descent]"),
|
|
1136
|
+
text(
|
|
1137
|
+
"text_size",
|
|
1138
|
+
"The text as a record: width (advance), height, bounds, cap (capital height), ascent, descent and size"
|
|
1139
|
+
),
|
|
1051
1140
|
{
|
|
1052
1141
|
name: "finger_count",
|
|
1053
1142
|
kind: "function",
|
package/dist/text.d.cts
CHANGED
|
@@ -9,6 +9,11 @@ interface OtFont {
|
|
|
9
9
|
ascender: number;
|
|
10
10
|
descender: number;
|
|
11
11
|
unitsPerEm: number;
|
|
12
|
+
tables?: {
|
|
13
|
+
os2?: {
|
|
14
|
+
sCapHeight?: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
12
17
|
}
|
|
13
18
|
export declare class FontBook {
|
|
14
19
|
private sources;
|
|
@@ -32,5 +37,29 @@ export declare function textMetrics(book: FontBook, text: string, o: TextOptions
|
|
|
32
37
|
bounds: number[][];
|
|
33
38
|
ascent: number;
|
|
34
39
|
descent: number;
|
|
40
|
+
cap: number;
|
|
41
|
+
};
|
|
42
|
+
/** The text laid along a path: each letter where its middle falls along
|
|
43
|
+
* the path, turned to the path's direction there, its baseline on the
|
|
44
|
+
* path. halign puts the text's start, middle or end at the path's.
|
|
45
|
+
* `over` is how far the text runs past the path's ends, 0 when it fits. */
|
|
46
|
+
export declare function textAlong(book: FontBook, text: string, o: TextOptions, points: [number, number][]): {
|
|
47
|
+
polys: Poly[];
|
|
48
|
+
over: number;
|
|
49
|
+
};
|
|
50
|
+
/** A circle of radius |r| round the origin as a path for text: r > 0
|
|
51
|
+
* goes clockwise, its middle at the top, for text on the outside reading
|
|
52
|
+
* round; r < 0 goes anticlockwise, its middle at the bottom, for text
|
|
53
|
+
* along the bottom reading left to right */
|
|
54
|
+
export declare function arcPath(r: number): [number, number][];
|
|
55
|
+
/** Text with its letters welded into one piece, as script names are cut:
|
|
56
|
+
* within each word a letter that does not touch the one before slides
|
|
57
|
+
* back until it overlaps it by `overlap` mm (a tenth of the size, and
|
|
58
|
+
* at least 1.5, by default); `underline` (a height) adds a bar
|
|
59
|
+
* under the baseline joining the words. `loose` lists the letters left
|
|
60
|
+
* as pieces of their own, as an i's dot. */
|
|
61
|
+
export declare function textWeld(book: FontBook, text: string, o: TextOptions, underline?: number, overlap?: number): {
|
|
62
|
+
polys: Poly[];
|
|
63
|
+
loose: string[];
|
|
35
64
|
};
|
|
36
65
|
export {};
|
package/dist/text.d.ts
CHANGED
|
@@ -9,6 +9,11 @@ interface OtFont {
|
|
|
9
9
|
ascender: number;
|
|
10
10
|
descender: number;
|
|
11
11
|
unitsPerEm: number;
|
|
12
|
+
tables?: {
|
|
13
|
+
os2?: {
|
|
14
|
+
sCapHeight?: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
12
17
|
}
|
|
13
18
|
export declare class FontBook {
|
|
14
19
|
private sources;
|
|
@@ -32,5 +37,29 @@ export declare function textMetrics(book: FontBook, text: string, o: TextOptions
|
|
|
32
37
|
bounds: number[][];
|
|
33
38
|
ascent: number;
|
|
34
39
|
descent: number;
|
|
40
|
+
cap: number;
|
|
41
|
+
};
|
|
42
|
+
/** The text laid along a path: each letter where its middle falls along
|
|
43
|
+
* the path, turned to the path's direction there, its baseline on the
|
|
44
|
+
* path. halign puts the text's start, middle or end at the path's.
|
|
45
|
+
* `over` is how far the text runs past the path's ends, 0 when it fits. */
|
|
46
|
+
export declare function textAlong(book: FontBook, text: string, o: TextOptions, points: [number, number][]): {
|
|
47
|
+
polys: Poly[];
|
|
48
|
+
over: number;
|
|
49
|
+
};
|
|
50
|
+
/** A circle of radius |r| round the origin as a path for text: r > 0
|
|
51
|
+
* goes clockwise, its middle at the top, for text on the outside reading
|
|
52
|
+
* round; r < 0 goes anticlockwise, its middle at the bottom, for text
|
|
53
|
+
* along the bottom reading left to right */
|
|
54
|
+
export declare function arcPath(r: number): [number, number][];
|
|
55
|
+
/** Text with its letters welded into one piece, as script names are cut:
|
|
56
|
+
* within each word a letter that does not touch the one before slides
|
|
57
|
+
* back until it overlaps it by `overlap` mm (a tenth of the size, and
|
|
58
|
+
* at least 1.5, by default); `underline` (a height) adds a bar
|
|
59
|
+
* under the baseline joining the words. `loose` lists the letters left
|
|
60
|
+
* as pieces of their own, as an i's dot. */
|
|
61
|
+
export declare function textWeld(book: FontBook, text: string, o: TextOptions, underline?: number, overlap?: number): {
|
|
62
|
+
polys: Poly[];
|
|
63
|
+
loose: string[];
|
|
35
64
|
};
|
|
36
65
|
export {};
|
package/dist/verify/types.d.cts
CHANGED
|
@@ -36,6 +36,12 @@ export interface SnapshotPart {
|
|
|
36
36
|
/** null means unavailable; [] means known to have no open cutting lines. */
|
|
37
37
|
cutLines: Poly[] | null;
|
|
38
38
|
bends: Bend[];
|
|
39
|
+
/** Fold lines of card or paper; a folded part is not rigid */
|
|
40
|
+
folds?: {
|
|
41
|
+
from: [number, number];
|
|
42
|
+
to: [number, number];
|
|
43
|
+
angle: number;
|
|
44
|
+
}[];
|
|
39
45
|
stack?: number;
|
|
40
46
|
glue?: PartRef;
|
|
41
47
|
glueFace?: 'top' | 'bottom';
|
package/dist/verify/types.d.ts
CHANGED
|
@@ -36,6 +36,12 @@ export interface SnapshotPart {
|
|
|
36
36
|
/** null means unavailable; [] means known to have no open cutting lines. */
|
|
37
37
|
cutLines: Poly[] | null;
|
|
38
38
|
bends: Bend[];
|
|
39
|
+
/** Fold lines of card or paper; a folded part is not rigid */
|
|
40
|
+
folds?: {
|
|
41
|
+
from: [number, number];
|
|
42
|
+
to: [number, number];
|
|
43
|
+
angle: number;
|
|
44
|
+
}[];
|
|
39
45
|
stack?: number;
|
|
40
46
|
glue?: PartRef;
|
|
41
47
|
glueFace?: 'top' | 'bottom';
|