@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/dist/colors.d.ts
ADDED
package/dist/effects.d.cts
CHANGED
|
@@ -5,8 +5,8 @@ export interface SettingEffect {
|
|
|
5
5
|
/** The values tried, in order */
|
|
6
6
|
tried: Value[];
|
|
7
7
|
/** "files": what is cut changes (the files, the sheets' material and
|
|
8
|
-
* thickness, or the parts list); "view": only the assembled view
|
|
9
|
-
* steps or the hardware; "nothing": neither; "failed": the program stops
|
|
8
|
+
* thickness, or the parts list); "view": only the assembled view (its
|
|
9
|
+
* paint, folds and lights too), the steps or the hardware; "nothing": neither; "failed": the program stops
|
|
10
10
|
* at all values but one, or all of them; "skipped": not tried */
|
|
11
11
|
effect: 'files' | 'view' | 'nothing' | 'failed' | 'skipped';
|
|
12
12
|
/** Values tried that give the same files and view: for a range, each
|
package/dist/effects.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export interface SettingEffect {
|
|
|
5
5
|
/** The values tried, in order */
|
|
6
6
|
tried: Value[];
|
|
7
7
|
/** "files": what is cut changes (the files, the sheets' material and
|
|
8
|
-
* thickness, or the parts list); "view": only the assembled view
|
|
9
|
-
* steps or the hardware; "nothing": neither; "failed": the program stops
|
|
8
|
+
* thickness, or the parts list); "view": only the assembled view (its
|
|
9
|
+
* paint, folds and lights too), the steps or the hardware; "nothing": neither; "failed": the program stops
|
|
10
10
|
* at all values but one, or all of them; "skipped": not tried */
|
|
11
11
|
effect: 'files' | 'view' | 'nothing' | 'failed' | 'skipped';
|
|
12
12
|
/** Values tried that give the same files and view: for a range, each
|
package/dist/evaluator.d.cts
CHANGED
|
@@ -2,12 +2,13 @@ import type { Expr, Param, Program, Stmt } from './ast.cjs';
|
|
|
2
2
|
import { type Shape } from './geometry.cjs';
|
|
3
3
|
import { type Vec3 } from './assembly.cjs';
|
|
4
4
|
import { type Pos } from './lexer.cjs';
|
|
5
|
+
import { type Light } from './lights.cjs';
|
|
5
6
|
import { type FontBook } from './text.cjs';
|
|
6
7
|
import { type Closure, type Value } from './values.cjs';
|
|
7
8
|
export declare const MAX_HARDWARE_SIDES = 128;
|
|
8
9
|
export interface LayerDef {
|
|
9
10
|
name: string;
|
|
10
|
-
mode: 'cut' | 'line' | 'fill' | 'guide';
|
|
11
|
+
mode: 'cut' | 'line' | 'fill' | 'guide' | 'paint';
|
|
11
12
|
color: string;
|
|
12
13
|
side?: 'back';
|
|
13
14
|
order?: number;
|
|
@@ -22,6 +23,7 @@ export interface HardwareItem {
|
|
|
22
23
|
sides: number;
|
|
23
24
|
step: number;
|
|
24
25
|
label?: string;
|
|
26
|
+
mass?: number;
|
|
25
27
|
}
|
|
26
28
|
export declare const DEFAULT_LAYERS: LayerDef[];
|
|
27
29
|
export interface EvalOptions {
|
|
@@ -96,6 +98,7 @@ export interface EvalResult {
|
|
|
96
98
|
echoes: string[];
|
|
97
99
|
warnings: string[];
|
|
98
100
|
hardware: HardwareItem[];
|
|
101
|
+
lights: Light[];
|
|
99
102
|
steps: string[];
|
|
100
103
|
}
|
|
101
104
|
export declare const STDLIB: Record<string, string>;
|
|
@@ -116,6 +119,7 @@ export declare class Evaluator {
|
|
|
116
119
|
readonly stepNames: string[];
|
|
117
120
|
private stepFolded;
|
|
118
121
|
readonly hardware: HardwareItem[];
|
|
122
|
+
readonly lights: Light[];
|
|
119
123
|
readonly echoes: string[];
|
|
120
124
|
readonly warnings: string[];
|
|
121
125
|
readonly layers: Map<string, LayerDef>;
|
|
@@ -129,6 +133,7 @@ export declare class Evaluator {
|
|
|
129
133
|
private clashed;
|
|
130
134
|
private clash;
|
|
131
135
|
private childCache;
|
|
136
|
+
private copyReads;
|
|
132
137
|
private childKey;
|
|
133
138
|
private effects;
|
|
134
139
|
private unscaled?;
|
|
@@ -180,11 +185,14 @@ export declare class Evaluator {
|
|
|
180
185
|
private checkSize;
|
|
181
186
|
private segs;
|
|
182
187
|
private thickness;
|
|
188
|
+
private kerf;
|
|
183
189
|
private fingerWidth;
|
|
184
190
|
private measure;
|
|
185
191
|
private textOpts;
|
|
192
|
+
private textBlock;
|
|
186
193
|
private edges;
|
|
187
194
|
private backLayer;
|
|
195
|
+
private folds;
|
|
188
196
|
private bends;
|
|
189
197
|
private makeBuiltins;
|
|
190
198
|
}
|
package/dist/evaluator.d.ts
CHANGED
|
@@ -2,12 +2,13 @@ import type { Expr, Param, Program, Stmt } from './ast.js';
|
|
|
2
2
|
import { type Shape } from './geometry.js';
|
|
3
3
|
import { type Vec3 } from './assembly.js';
|
|
4
4
|
import { type Pos } from './lexer.js';
|
|
5
|
+
import { type Light } from './lights.js';
|
|
5
6
|
import { type FontBook } from './text.js';
|
|
6
7
|
import { type Closure, type Value } from './values.js';
|
|
7
8
|
export declare const MAX_HARDWARE_SIDES = 128;
|
|
8
9
|
export interface LayerDef {
|
|
9
10
|
name: string;
|
|
10
|
-
mode: 'cut' | 'line' | 'fill' | 'guide';
|
|
11
|
+
mode: 'cut' | 'line' | 'fill' | 'guide' | 'paint';
|
|
11
12
|
color: string;
|
|
12
13
|
side?: 'back';
|
|
13
14
|
order?: number;
|
|
@@ -22,6 +23,7 @@ export interface HardwareItem {
|
|
|
22
23
|
sides: number;
|
|
23
24
|
step: number;
|
|
24
25
|
label?: string;
|
|
26
|
+
mass?: number;
|
|
25
27
|
}
|
|
26
28
|
export declare const DEFAULT_LAYERS: LayerDef[];
|
|
27
29
|
export interface EvalOptions {
|
|
@@ -96,6 +98,7 @@ export interface EvalResult {
|
|
|
96
98
|
echoes: string[];
|
|
97
99
|
warnings: string[];
|
|
98
100
|
hardware: HardwareItem[];
|
|
101
|
+
lights: Light[];
|
|
99
102
|
steps: string[];
|
|
100
103
|
}
|
|
101
104
|
export declare const STDLIB: Record<string, string>;
|
|
@@ -116,6 +119,7 @@ export declare class Evaluator {
|
|
|
116
119
|
readonly stepNames: string[];
|
|
117
120
|
private stepFolded;
|
|
118
121
|
readonly hardware: HardwareItem[];
|
|
122
|
+
readonly lights: Light[];
|
|
119
123
|
readonly echoes: string[];
|
|
120
124
|
readonly warnings: string[];
|
|
121
125
|
readonly layers: Map<string, LayerDef>;
|
|
@@ -129,6 +133,7 @@ export declare class Evaluator {
|
|
|
129
133
|
private clashed;
|
|
130
134
|
private clash;
|
|
131
135
|
private childCache;
|
|
136
|
+
private copyReads;
|
|
132
137
|
private childKey;
|
|
133
138
|
private effects;
|
|
134
139
|
private unscaled?;
|
|
@@ -180,11 +185,14 @@ export declare class Evaluator {
|
|
|
180
185
|
private checkSize;
|
|
181
186
|
private segs;
|
|
182
187
|
private thickness;
|
|
188
|
+
private kerf;
|
|
183
189
|
private fingerWidth;
|
|
184
190
|
private measure;
|
|
185
191
|
private textOpts;
|
|
192
|
+
private textBlock;
|
|
186
193
|
private edges;
|
|
187
194
|
private backLayer;
|
|
195
|
+
private folds;
|
|
188
196
|
private bends;
|
|
189
197
|
private makeBuiltins;
|
|
190
198
|
}
|
package/dist/export/mesh.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type AssemblyPart } from '../assembly.cjs';
|
|
2
2
|
import type { HardwareItem } from '../evaluator.cjs';
|
|
3
|
+
import type { Light } from '../lights.cjs';
|
|
3
4
|
export interface Body {
|
|
4
5
|
/** "Lid", "Lid engrave", "dowel" */
|
|
5
6
|
name: string;
|
|
@@ -15,6 +16,10 @@ export interface Body {
|
|
|
15
16
|
color: string;
|
|
16
17
|
metal?: boolean;
|
|
17
18
|
clear?: boolean;
|
|
19
|
+
/** Lets light through without being clear, as vellum or frosted acrylic */
|
|
20
|
+
translucent?: boolean;
|
|
21
|
+
/** Gives off light, as an LED or a flame */
|
|
22
|
+
glow?: boolean;
|
|
18
23
|
/** x, y, z of each vertex, in millimetres, z up */
|
|
19
24
|
positions: number[];
|
|
20
25
|
/** Three vertex indices per triangle, counter-clockwise seen from outside */
|
|
@@ -22,8 +27,10 @@ export interface Body {
|
|
|
22
27
|
}
|
|
23
28
|
export interface MeshOptions {
|
|
24
29
|
/** "assembled" puts each part where the program places it; "flat" lays
|
|
25
|
-
* them side by side on the bed, front face up
|
|
26
|
-
|
|
30
|
+
* them side by side on the bed, front face up; "print" lays them out
|
|
31
|
+
* as "flat" does, but each part with everything glued on it as one
|
|
32
|
+
* object, its layers where the assembly has them */
|
|
33
|
+
layout?: 'assembled' | 'flat' | 'print';
|
|
27
34
|
/** How far engraving and scoring stand off the face, in mm; 0 leaves
|
|
28
35
|
* them out */
|
|
29
36
|
markHeight?: number;
|
|
@@ -41,13 +48,19 @@ export interface MeshSource {
|
|
|
41
48
|
/** Every part flat, for the flat layout and for a model nothing places */
|
|
42
49
|
flat?: AssemblyPart[];
|
|
43
50
|
hardware?: HardwareItem[];
|
|
51
|
+
/** Light sources, from tealights, LEDs, bulbs and light() */
|
|
52
|
+
lights?: Light[];
|
|
44
53
|
/** The layers, to tell cuts inside a part from marks on it */
|
|
45
54
|
layers?: {
|
|
46
55
|
name: string;
|
|
47
56
|
mode: string;
|
|
48
57
|
}[];
|
|
49
58
|
}
|
|
50
|
-
/** The colour a 3D view gives a sheet material
|
|
59
|
+
/** The colour a 3D view gives a sheet material: a #rrggbb in its name,
|
|
60
|
+
* else one for a wood, sheet or colour named in it, else a light wood */
|
|
51
61
|
export declare function materialColor(material: string): string;
|
|
62
|
+
/** Whether a sheet material lets light through without being clear:
|
|
63
|
+
* vellum, tracing paper, parchment, rice paper, frosted acrylic, paper */
|
|
64
|
+
export declare const isTranslucent: (material: string) => boolean;
|
|
52
65
|
/** The model as solid bodies, for the 3D file writers */
|
|
53
66
|
export declare function meshBodies(source: MeshSource, options?: MeshOptions): Body[];
|
package/dist/export/mesh.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type AssemblyPart } from '../assembly.js';
|
|
2
2
|
import type { HardwareItem } from '../evaluator.js';
|
|
3
|
+
import type { Light } from '../lights.js';
|
|
3
4
|
export interface Body {
|
|
4
5
|
/** "Lid", "Lid engrave", "dowel" */
|
|
5
6
|
name: string;
|
|
@@ -15,6 +16,10 @@ export interface Body {
|
|
|
15
16
|
color: string;
|
|
16
17
|
metal?: boolean;
|
|
17
18
|
clear?: boolean;
|
|
19
|
+
/** Lets light through without being clear, as vellum or frosted acrylic */
|
|
20
|
+
translucent?: boolean;
|
|
21
|
+
/** Gives off light, as an LED or a flame */
|
|
22
|
+
glow?: boolean;
|
|
18
23
|
/** x, y, z of each vertex, in millimetres, z up */
|
|
19
24
|
positions: number[];
|
|
20
25
|
/** Three vertex indices per triangle, counter-clockwise seen from outside */
|
|
@@ -22,8 +27,10 @@ export interface Body {
|
|
|
22
27
|
}
|
|
23
28
|
export interface MeshOptions {
|
|
24
29
|
/** "assembled" puts each part where the program places it; "flat" lays
|
|
25
|
-
* them side by side on the bed, front face up
|
|
26
|
-
|
|
30
|
+
* them side by side on the bed, front face up; "print" lays them out
|
|
31
|
+
* as "flat" does, but each part with everything glued on it as one
|
|
32
|
+
* object, its layers where the assembly has them */
|
|
33
|
+
layout?: 'assembled' | 'flat' | 'print';
|
|
27
34
|
/** How far engraving and scoring stand off the face, in mm; 0 leaves
|
|
28
35
|
* them out */
|
|
29
36
|
markHeight?: number;
|
|
@@ -41,13 +48,19 @@ export interface MeshSource {
|
|
|
41
48
|
/** Every part flat, for the flat layout and for a model nothing places */
|
|
42
49
|
flat?: AssemblyPart[];
|
|
43
50
|
hardware?: HardwareItem[];
|
|
51
|
+
/** Light sources, from tealights, LEDs, bulbs and light() */
|
|
52
|
+
lights?: Light[];
|
|
44
53
|
/** The layers, to tell cuts inside a part from marks on it */
|
|
45
54
|
layers?: {
|
|
46
55
|
name: string;
|
|
47
56
|
mode: string;
|
|
48
57
|
}[];
|
|
49
58
|
}
|
|
50
|
-
/** The colour a 3D view gives a sheet material
|
|
59
|
+
/** The colour a 3D view gives a sheet material: a #rrggbb in its name,
|
|
60
|
+
* else one for a wood, sheet or colour named in it, else a light wood */
|
|
51
61
|
export declare function materialColor(material: string): string;
|
|
62
|
+
/** Whether a sheet material lets light through without being clear:
|
|
63
|
+
* vellum, tracing paper, parchment, rice paper, frosted acrylic, paper */
|
|
64
|
+
export declare const isTranslucent: (material: string) => boolean;
|
|
52
65
|
/** The model as solid bodies, for the 3D file writers */
|
|
53
66
|
export declare function meshBodies(source: MeshSource, options?: MeshOptions): Body[];
|
package/dist/export/model.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Body, type MeshOptions, type MeshSource } from './mesh.cjs';
|
|
2
|
+
import { type Light } from '../lights.cjs';
|
|
2
3
|
export type ModelFormat = 'glb' | '3mf' | 'stl';
|
|
3
4
|
/** Binary STL of all the bodies as one mesh, in millimetres */
|
|
4
5
|
export declare function toStl(bodies: Body[]): Uint8Array;
|
|
@@ -6,7 +7,8 @@ export declare function toStl(bodies: Body[]): Uint8Array;
|
|
|
6
7
|
* scoring coloured parts of it, so a slicer prints them in their colours */
|
|
7
8
|
export declare function to3mf(bodies: Body[]): Uint8Array;
|
|
8
9
|
/** GLB (binary glTF 2.0): a node and a mesh for each body, in metres with
|
|
9
|
-
* y up as glTF has it; each node's extras give its kind, part and copy
|
|
10
|
-
|
|
10
|
+
* y up as glTF has it; each node's extras give its kind, part and copy.
|
|
11
|
+
* Lights become point lights (KHR_lights_punctual), a strip several. */
|
|
12
|
+
export declare function toGlb(bodies: Body[], lights?: Light[]): Uint8Array;
|
|
11
13
|
/** The model as a 3D file: "glb", "3mf" or "stl" */
|
|
12
14
|
export declare function toModel(source: MeshSource, format: ModelFormat, options?: MeshOptions): Uint8Array;
|
package/dist/export/model.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Body, type MeshOptions, type MeshSource } from './mesh.js';
|
|
2
|
+
import { type Light } from '../lights.js';
|
|
2
3
|
export type ModelFormat = 'glb' | '3mf' | 'stl';
|
|
3
4
|
/** Binary STL of all the bodies as one mesh, in millimetres */
|
|
4
5
|
export declare function toStl(bodies: Body[]): Uint8Array;
|
|
@@ -6,7 +7,8 @@ export declare function toStl(bodies: Body[]): Uint8Array;
|
|
|
6
7
|
* scoring coloured parts of it, so a slicer prints them in their colours */
|
|
7
8
|
export declare function to3mf(bodies: Body[]): Uint8Array;
|
|
8
9
|
/** GLB (binary glTF 2.0): a node and a mesh for each body, in metres with
|
|
9
|
-
* y up as glTF has it; each node's extras give its kind, part and copy
|
|
10
|
-
|
|
10
|
+
* y up as glTF has it; each node's extras give its kind, part and copy.
|
|
11
|
+
* Lights become point lights (KHR_lights_punctual), a strip several. */
|
|
12
|
+
export declare function toGlb(bodies: Body[], lights?: Light[]): Uint8Array;
|
|
11
13
|
/** The model as a 3D file: "glb", "3mf" or "stl" */
|
|
12
14
|
export declare function toModel(source: MeshSource, format: ModelFormat, options?: MeshOptions): Uint8Array;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { RenderResult } from '../render.cjs';
|
|
2
|
+
import { type FontBook } from '../text.cjs';
|
|
3
|
+
type Ring = [number, number][];
|
|
4
|
+
/** Something drawn on a page, in points from its top left, y down: filled
|
|
5
|
+
* rings (even-odd), or with no fill a line `width` wide through them */
|
|
6
|
+
export interface PageItem {
|
|
7
|
+
rings: Ring[];
|
|
8
|
+
fill: string;
|
|
9
|
+
stroke: string;
|
|
10
|
+
width: number;
|
|
11
|
+
}
|
|
12
|
+
export interface Page {
|
|
13
|
+
w: number;
|
|
14
|
+
h: number;
|
|
15
|
+
items: PageItem[];
|
|
16
|
+
}
|
|
17
|
+
/** The instructions as pages */
|
|
18
|
+
export declare function instructionPages(r: RenderResult, title: string, fonts: FontBook): Page[];
|
|
19
|
+
/** Pages as a PDF: filled vector paths, the text as the font's outlines */
|
|
20
|
+
export declare function pagesPdf(pages: Page[]): Uint8Array;
|
|
21
|
+
/** A page as a PNG `width` pixels wide */
|
|
22
|
+
export declare function pagePng(page: Page, width?: number): Uint8Array;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { RenderResult } from '../render.js';
|
|
2
|
+
import { type FontBook } from '../text.js';
|
|
3
|
+
type Ring = [number, number][];
|
|
4
|
+
/** Something drawn on a page, in points from its top left, y down: filled
|
|
5
|
+
* rings (even-odd), or with no fill a line `width` wide through them */
|
|
6
|
+
export interface PageItem {
|
|
7
|
+
rings: Ring[];
|
|
8
|
+
fill: string;
|
|
9
|
+
stroke: string;
|
|
10
|
+
width: number;
|
|
11
|
+
}
|
|
12
|
+
export interface Page {
|
|
13
|
+
w: number;
|
|
14
|
+
h: number;
|
|
15
|
+
items: PageItem[];
|
|
16
|
+
}
|
|
17
|
+
/** The instructions as pages */
|
|
18
|
+
export declare function instructionPages(r: RenderResult, title: string, fonts: FontBook): Page[];
|
|
19
|
+
/** Pages as a PDF: filled vector paths, the text as the font's outlines */
|
|
20
|
+
export declare function pagesPdf(pages: Page[]): Uint8Array;
|
|
21
|
+
/** A page as a PNG `width` pixels wide */
|
|
22
|
+
export declare function pagePng(page: Page, width?: number): Uint8Array;
|
|
23
|
+
export {};
|
package/dist/geometry.d.cts
CHANGED
|
@@ -13,9 +13,18 @@ export interface PartShape {
|
|
|
13
13
|
thickness: number;
|
|
14
14
|
kerf: number;
|
|
15
15
|
material: string;
|
|
16
|
+
paint?: string;
|
|
17
|
+
pieces?: number | 'any';
|
|
16
18
|
placements?: Placement[];
|
|
17
19
|
stack?: number;
|
|
18
20
|
bends?: Bend[];
|
|
21
|
+
folds?: Fold[];
|
|
22
|
+
split?: true | [number, number];
|
|
23
|
+
joins?: string[];
|
|
24
|
+
hang?: {
|
|
25
|
+
at: Pt;
|
|
26
|
+
cord: number;
|
|
27
|
+
};
|
|
19
28
|
on?: string;
|
|
20
29
|
slots?: string[];
|
|
21
30
|
clearance?: number;
|
|
@@ -28,8 +37,18 @@ export interface PartShape {
|
|
|
28
37
|
host: string;
|
|
29
38
|
face: 'top' | 'bottom';
|
|
30
39
|
};
|
|
40
|
+
pressFit?: boolean;
|
|
31
41
|
mirrored?: boolean;
|
|
32
42
|
copies?: number[];
|
|
43
|
+
layerOf?: {
|
|
44
|
+
part: PartShape;
|
|
45
|
+
k: number;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export interface Fold {
|
|
49
|
+
from: Pt;
|
|
50
|
+
to: Pt;
|
|
51
|
+
angle: number;
|
|
33
52
|
}
|
|
34
53
|
export interface Bend {
|
|
35
54
|
x0: number;
|
|
@@ -54,6 +73,7 @@ export declare function clipLines(lines: Poly[], region: Poly[], keep: 'inside'
|
|
|
54
73
|
export declare function offset(regions: Poly[], delta: number, join?: 'round' | 'miter' | 'square', arcTolerance?: number): Poly[];
|
|
55
74
|
export declare function strokeLines(lines: Poly[], width: number): Poly[];
|
|
56
75
|
export declare function pieces(regions: Poly[]): Poly[][];
|
|
76
|
+
export declare function cutOrder(rings: Poly[]): number[];
|
|
57
77
|
export declare function area(p: Poly): number;
|
|
58
78
|
/** The area of regions (holes counting against it) and their centroid. */
|
|
59
79
|
export declare function regionMoments(regions: Poly[]): {
|
package/dist/geometry.d.ts
CHANGED
|
@@ -13,9 +13,18 @@ export interface PartShape {
|
|
|
13
13
|
thickness: number;
|
|
14
14
|
kerf: number;
|
|
15
15
|
material: string;
|
|
16
|
+
paint?: string;
|
|
17
|
+
pieces?: number | 'any';
|
|
16
18
|
placements?: Placement[];
|
|
17
19
|
stack?: number;
|
|
18
20
|
bends?: Bend[];
|
|
21
|
+
folds?: Fold[];
|
|
22
|
+
split?: true | [number, number];
|
|
23
|
+
joins?: string[];
|
|
24
|
+
hang?: {
|
|
25
|
+
at: Pt;
|
|
26
|
+
cord: number;
|
|
27
|
+
};
|
|
19
28
|
on?: string;
|
|
20
29
|
slots?: string[];
|
|
21
30
|
clearance?: number;
|
|
@@ -28,8 +37,18 @@ export interface PartShape {
|
|
|
28
37
|
host: string;
|
|
29
38
|
face: 'top' | 'bottom';
|
|
30
39
|
};
|
|
40
|
+
pressFit?: boolean;
|
|
31
41
|
mirrored?: boolean;
|
|
32
42
|
copies?: number[];
|
|
43
|
+
layerOf?: {
|
|
44
|
+
part: PartShape;
|
|
45
|
+
k: number;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export interface Fold {
|
|
49
|
+
from: Pt;
|
|
50
|
+
to: Pt;
|
|
51
|
+
angle: number;
|
|
33
52
|
}
|
|
34
53
|
export interface Bend {
|
|
35
54
|
x0: number;
|
|
@@ -54,6 +73,7 @@ export declare function clipLines(lines: Poly[], region: Poly[], keep: 'inside'
|
|
|
54
73
|
export declare function offset(regions: Poly[], delta: number, join?: 'round' | 'miter' | 'square', arcTolerance?: number): Poly[];
|
|
55
74
|
export declare function strokeLines(lines: Poly[], width: number): Poly[];
|
|
56
75
|
export declare function pieces(regions: Poly[]): Poly[][];
|
|
76
|
+
export declare function cutOrder(rings: Poly[]): number[];
|
|
57
77
|
export declare function area(p: Poly): number;
|
|
58
78
|
/** The area of regions (holes counting against it) and their centroid. */
|
|
59
79
|
export declare function regionMoments(regions: Poly[]): {
|
package/dist/hardware.d.cts
CHANGED
package/dist/hardware.d.ts
CHANGED
package/dist/highlight.cjs
CHANGED
|
@@ -43,7 +43,7 @@ var KEYWORDS = /* @__PURE__ */ new Set([
|
|
|
43
43
|
var CONSTANTS = /* @__PURE__ */ new Set(["true", "false", "undef", "PI"]);
|
|
44
44
|
var LAYERS = /* @__PURE__ */ new Set(["cut", "score", "engrave", "guide", "layer"]);
|
|
45
45
|
var BUILTINS = new Set(
|
|
46
|
-
"rect square circle ellipse regular_polygon star polygon path text line polyline arc translate rotate scale mirror multmatrix union group difference intersection hull offset pattern spline hatch flow contours occlude hide paint measure fill_holes largest join_islands close stroke outline part place call step hardware material finger_rect finger_holes tslot living_hinge children echo assert box divider kerf_gauge slot_gauge joint_test slotted_divider grid_dividers enclosure enclosure_cutouts vents spur_gear gear_window rack lantern_disc peg_wheel eccentric snail_cam tappets cone_flat fit align cam geneva_wheel geneva_lock geneva_crank ratchet pawl world_map keyhole keyholes hanging_hole hanging_loop flex_rect flex_box flex_panel narrow_hinge flex_strip cam_lock lock_key ring_stack halved_pair symbol tabs slots tab_rect heart teardrop egg lens crescent capsule diamond rounded_polygon shield arrow chevron banner house tag ring scalloped flower cloud speech_bubble stand stand_tabs stand_slots abs sign floor ceil round sqrt exp ln log sin cos tan asin acos atan atan2 pow min max clamp lerp norm cross path_length point_at heading_at offset_path train_for path_points spline_points rotation euler orient len keys merge concat reverse sort fold scan bounds crossings sum slice str chr ord upper lower split join search contains lookup is_num is_string is_bool is_list is_undef is_function is_record type_of rands noise text_width text_metrics text_size finger_count".split(" ")
|
|
46
|
+
"rect square circle ellipse regular_polygon star polygon path text line polyline arc translate rotate scale mirror multmatrix union group difference intersection hull offset pattern spline hatch flow contours occlude hide paint measure fill_holes largest join_islands close stroke outline part place call step hardware light material finger_rect finger_holes tslot living_hinge children echo assert box divider kerf_gauge slot_gauge joint_test slotted_divider grid_dividers enclosure enclosure_cutouts vents spur_gear gear_window rack lantern_disc peg_wheel eccentric snail_cam tappets cone_flat fit align cam geneva_wheel geneva_lock geneva_crank ratchet pawl world_map keyhole keyholes hanging_hole hanging_loop flex_rect flex_box flex_panel narrow_hinge flex_strip wall cam_lock lock_key ring_stack halved_pair symbol tabs slots tab_rect heart teardrop egg lens crescent capsule diamond rounded_polygon shield arrow chevron banner house tag ring scalloped flower cloud speech_bubble stand stand_tabs stand_slots figure figure_layer figure_parts figure_shapes figure_details drawers layered ball inlaid scene_rails scene_floor standee scene_figure figure_base drip_edge wave_edge abs sign floor ceil round sqrt exp ln log sin cos tan asin acos atan atan2 pow min max clamp lerp norm cross path_length point_at heading_at offset_path train_for path_points spline_points rotation euler orient len keys merge concat reverse sort fold scan bounds crossings sum slice str chr ord upper lower split join search contains lookup is_num is_string is_bool is_list is_undef is_function is_record type_of rands noise text_width text_metrics text_size finger_count".split(" ")
|
|
47
47
|
);
|
|
48
48
|
var NUMBER = /(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?(?:(?:mm|cm|m|in|ft)(?![A-Za-z0-9_]))?/y;
|
|
49
49
|
var WORD = /\$?[A-Za-z_][A-Za-z0-9_]*/y;
|
package/dist/highlight.js
CHANGED
|
@@ -16,7 +16,7 @@ var KEYWORDS = /* @__PURE__ */ new Set([
|
|
|
16
16
|
var CONSTANTS = /* @__PURE__ */ new Set(["true", "false", "undef", "PI"]);
|
|
17
17
|
var LAYERS = /* @__PURE__ */ new Set(["cut", "score", "engrave", "guide", "layer"]);
|
|
18
18
|
var BUILTINS = new Set(
|
|
19
|
-
"rect square circle ellipse regular_polygon star polygon path text line polyline arc translate rotate scale mirror multmatrix union group difference intersection hull offset pattern spline hatch flow contours occlude hide paint measure fill_holes largest join_islands close stroke outline part place call step hardware material finger_rect finger_holes tslot living_hinge children echo assert box divider kerf_gauge slot_gauge joint_test slotted_divider grid_dividers enclosure enclosure_cutouts vents spur_gear gear_window rack lantern_disc peg_wheel eccentric snail_cam tappets cone_flat fit align cam geneva_wheel geneva_lock geneva_crank ratchet pawl world_map keyhole keyholes hanging_hole hanging_loop flex_rect flex_box flex_panel narrow_hinge flex_strip cam_lock lock_key ring_stack halved_pair symbol tabs slots tab_rect heart teardrop egg lens crescent capsule diamond rounded_polygon shield arrow chevron banner house tag ring scalloped flower cloud speech_bubble stand stand_tabs stand_slots abs sign floor ceil round sqrt exp ln log sin cos tan asin acos atan atan2 pow min max clamp lerp norm cross path_length point_at heading_at offset_path train_for path_points spline_points rotation euler orient len keys merge concat reverse sort fold scan bounds crossings sum slice str chr ord upper lower split join search contains lookup is_num is_string is_bool is_list is_undef is_function is_record type_of rands noise text_width text_metrics text_size finger_count".split(" ")
|
|
19
|
+
"rect square circle ellipse regular_polygon star polygon path text line polyline arc translate rotate scale mirror multmatrix union group difference intersection hull offset pattern spline hatch flow contours occlude hide paint measure fill_holes largest join_islands close stroke outline part place call step hardware light material finger_rect finger_holes tslot living_hinge children echo assert box divider kerf_gauge slot_gauge joint_test slotted_divider grid_dividers enclosure enclosure_cutouts vents spur_gear gear_window rack lantern_disc peg_wheel eccentric snail_cam tappets cone_flat fit align cam geneva_wheel geneva_lock geneva_crank ratchet pawl world_map keyhole keyholes hanging_hole hanging_loop flex_rect flex_box flex_panel narrow_hinge flex_strip wall cam_lock lock_key ring_stack halved_pair symbol tabs slots tab_rect heart teardrop egg lens crescent capsule diamond rounded_polygon shield arrow chevron banner house tag ring scalloped flower cloud speech_bubble stand stand_tabs stand_slots figure figure_layer figure_parts figure_shapes figure_details drawers layered ball inlaid scene_rails scene_floor standee scene_figure figure_base drip_edge wave_edge abs sign floor ceil round sqrt exp ln log sin cos tan asin acos atan atan2 pow min max clamp lerp norm cross path_length point_at heading_at offset_path train_for path_points spline_points rotation euler orient len keys merge concat reverse sort fold scan bounds crossings sum slice str chr ord upper lower split join search contains lookup is_num is_string is_bool is_list is_undef is_function is_record type_of rands noise text_width text_metrics text_size finger_count".split(" ")
|
|
20
20
|
);
|
|
21
21
|
var NUMBER = /(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?(?:(?:mm|cm|m|in|ft)(?![A-Za-z0-9_]))?/y;
|
|
22
22
|
var WORD = /\$?[A-Za-z_][A-Za-z0-9_]*/y;
|