@mylasertools/kerfscript 0.6.0 → 0.7.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 +167 -1
- package/LANGUAGE.md +160 -30
- package/README.md +8 -2
- package/THIRD-PARTY-NOTICES.md +113 -0
- package/dist/analysis.d.cts +20 -0
- package/dist/analysis.d.ts +20 -0
- package/dist/assembly.d.cts +28 -1
- package/dist/assembly.d.ts +28 -1
- package/dist/ast.d.cts +9 -0
- package/dist/ast.d.ts +9 -0
- package/dist/cli.js +10165 -4669
- package/dist/diff.d.cts +18 -0
- package/dist/diff.d.ts +18 -0
- package/dist/evaluator.d.cts +34 -0
- package/dist/evaluator.d.ts +34 -0
- package/dist/functions.d.cts +1 -0
- package/dist/functions.d.ts +1 -0
- package/dist/geometry.d.cts +17 -0
- package/dist/geometry.d.ts +17 -0
- package/dist/hardware.d.cts +13 -0
- package/dist/hardware.d.ts +13 -0
- package/dist/highlight.cjs +2 -2
- package/dist/highlight.js +2 -2
- package/dist/index.cjs +1941 -52
- package/dist/index.d.cts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +1941 -52
- package/dist/instructions.d.cts +3 -0
- package/dist/instructions.d.ts +3 -0
- package/dist/language.cjs +1899 -51
- package/dist/language.js +1899 -51
- package/dist/libraries.cjs +1874 -26
- package/dist/libraries.d.cts +3 -0
- package/dist/libraries.d.ts +3 -0
- package/dist/libraries.js +1874 -26
- package/dist/png.d.cts +9 -0
- package/dist/png.d.ts +9 -0
- package/dist/render.d.cts +22 -1
- package/dist/render.d.ts +22 -1
- package/dist/signatures.cjs +244 -11
- package/dist/signatures.js +244 -11
- package/dist/slots.d.cts +8 -0
- package/dist/slots.d.ts +8 -0
- package/dist/values.d.cts +6 -1
- package/dist/values.d.ts +6 -1
- package/dist/verify/command.d.cts +1 -0
- package/dist/verify/command.d.ts +1 -0
- package/dist/verify/geometry.d.cts +25 -0
- package/dist/verify/geometry.d.ts +25 -0
- package/dist/verify/index.d.cts +10 -0
- package/dist/verify/index.d.ts +10 -0
- package/dist/verify/joints.d.cts +7 -0
- package/dist/verify/joints.d.ts +7 -0
- package/dist/verify/mechanics.d.cts +11 -0
- package/dist/verify/mechanics.d.ts +11 -0
- package/dist/verify/motion.d.cts +8 -0
- package/dist/verify/motion.d.ts +8 -0
- package/dist/verify/pose.d.cts +5 -0
- package/dist/verify/pose.d.ts +5 -0
- package/dist/verify/relations.d.cts +8 -0
- package/dist/verify/relations.d.ts +8 -0
- package/dist/verify/snapshot.d.cts +11 -0
- package/dist/verify/snapshot.d.ts +11 -0
- package/dist/verify/solids.d.cts +39 -0
- package/dist/verify/solids.d.ts +39 -0
- package/dist/verify/spec.d.cts +9 -0
- package/dist/verify/spec.d.ts +9 -0
- package/dist/verify/summary.d.cts +17 -0
- package/dist/verify/summary.d.ts +17 -0
- package/dist/verify/types.d.cts +299 -0
- package/dist/verify/types.d.ts +299 -0
- package/docs/cli.md +87 -15
- package/docs/javascript.md +57 -25
- package/docs/layers.md +42 -2
- package/docs/library.md +299 -3
- package/docs/parts-and-sheets.md +186 -1
- package/docs/shared-libraries.md +8 -1
- package/docs/specification.md +78 -23
- package/docs/verification.md +363 -0
- package/docs/versions.md +2 -2
- package/package.json +2 -1
- package/dist/import/dbg.d.cts +0 -1
- package/dist/import/dbg.d.ts +0 -1
package/dist/png.d.cts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LayerDef } from './evaluator.cjs';
|
|
2
|
+
import type { Sheet } from './render.cjs';
|
|
3
|
+
/** The most pixels a picture of a sheet has, and on each side */
|
|
4
|
+
export declare const MAX_PIXELS = 16000000;
|
|
5
|
+
export declare const MAX_SIDE = 16384;
|
|
6
|
+
/** A sheet as a PNG `width` pixels wide (narrower when that would pass
|
|
7
|
+
* MAX_PIXELS or MAX_SIDE): fills in their layer colours,
|
|
8
|
+
* then line and cut layers on top. `side` "back" draws the back job. */
|
|
9
|
+
export declare function sheetPng(sheet: Sheet, layers: LayerDef[], width?: number): Uint8Array;
|
package/dist/png.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LayerDef } from './evaluator.js';
|
|
2
|
+
import type { Sheet } from './render.js';
|
|
3
|
+
/** The most pixels a picture of a sheet has, and on each side */
|
|
4
|
+
export declare const MAX_PIXELS = 16000000;
|
|
5
|
+
export declare const MAX_SIDE = 16384;
|
|
6
|
+
/** A sheet as a PNG `width` pixels wide (narrower when that would pass
|
|
7
|
+
* MAX_PIXELS or MAX_SIDE): fills in their layer colours,
|
|
8
|
+
* then line and cut layers on top. `side` "back" draws the back job. */
|
|
9
|
+
export declare function sheetPng(sheet: Sheet, layers: LayerDef[], width?: number): Uint8Array;
|
package/dist/render.d.cts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { type AssemblyPart } from './assembly.cjs';
|
|
2
|
-
import
|
|
2
|
+
import type { RenderAnalysis } from './analysis.cjs';
|
|
3
|
+
import { type HardwareItem, type LayerDef, type Limits } from './evaluator.cjs';
|
|
3
4
|
import { type LayerPath } from './export/svg.cjs';
|
|
4
5
|
import { type Layer } from './geometry.cjs';
|
|
5
6
|
import { type FontSource } from './text.cjs';
|
|
6
7
|
import { type Value } from './values.cjs';
|
|
7
8
|
export interface RenderOptions {
|
|
9
|
+
/** Capture nominal manufacturing geometry before toolpath compensation. */
|
|
10
|
+
analysis?: boolean;
|
|
8
11
|
params?: Record<string, Value>;
|
|
9
12
|
fonts?: Record<string, FontSource>;
|
|
10
13
|
defaultFont?: string;
|
|
@@ -12,6 +15,8 @@ export interface RenderOptions {
|
|
|
12
15
|
kerf?: number;
|
|
13
16
|
layout?: 'pack' | 'none';
|
|
14
17
|
sheet?: [number, number];
|
|
18
|
+
defaultSheet?: [number, number];
|
|
19
|
+
nest?: boolean;
|
|
15
20
|
gap?: number;
|
|
16
21
|
margin?: number;
|
|
17
22
|
guides?: boolean;
|
|
@@ -28,12 +33,19 @@ export interface PartInfo {
|
|
|
28
33
|
thickness: number;
|
|
29
34
|
kerf: number;
|
|
30
35
|
material: string;
|
|
36
|
+
stack?: number;
|
|
37
|
+
glued?: string;
|
|
38
|
+
label?: number;
|
|
39
|
+
mirrored?: boolean;
|
|
31
40
|
}
|
|
32
41
|
export interface Placed {
|
|
33
42
|
part: string;
|
|
34
43
|
copy: number;
|
|
35
44
|
layers: Map<string, Layer>;
|
|
36
45
|
rotated: boolean;
|
|
46
|
+
/** With layout "none": the move from the part's coordinates, y flipped
|
|
47
|
+
* down, to the sheet's */
|
|
48
|
+
offset?: [number, number];
|
|
37
49
|
}
|
|
38
50
|
export interface Sheet {
|
|
39
51
|
width: number;
|
|
@@ -44,8 +56,15 @@ export interface Sheet {
|
|
|
44
56
|
paths: LayerPath[];
|
|
45
57
|
svg: string;
|
|
46
58
|
dxf: string;
|
|
59
|
+
back?: {
|
|
60
|
+
paths: LayerPath[];
|
|
61
|
+
svg: string;
|
|
62
|
+
dxf: string;
|
|
63
|
+
};
|
|
47
64
|
}
|
|
48
65
|
export interface RenderResult {
|
|
66
|
+
/** Present only when requested; separate from packed, compensated cut paths. */
|
|
67
|
+
analysis?: RenderAnalysis;
|
|
49
68
|
sheets: Sheet[];
|
|
50
69
|
width: number;
|
|
51
70
|
height: number;
|
|
@@ -56,5 +75,7 @@ export interface RenderResult {
|
|
|
56
75
|
layers: LayerDef[];
|
|
57
76
|
warnings: string[];
|
|
58
77
|
echoes: string[];
|
|
78
|
+
hardware: HardwareItem[];
|
|
79
|
+
steps: string[];
|
|
59
80
|
}
|
|
60
81
|
export declare function render(source: string, options?: RenderOptions): RenderResult;
|
package/dist/render.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { type AssemblyPart } from './assembly.js';
|
|
2
|
-
import
|
|
2
|
+
import type { RenderAnalysis } from './analysis.js';
|
|
3
|
+
import { type HardwareItem, type LayerDef, type Limits } from './evaluator.js';
|
|
3
4
|
import { type LayerPath } from './export/svg.js';
|
|
4
5
|
import { type Layer } from './geometry.js';
|
|
5
6
|
import { type FontSource } from './text.js';
|
|
6
7
|
import { type Value } from './values.js';
|
|
7
8
|
export interface RenderOptions {
|
|
9
|
+
/** Capture nominal manufacturing geometry before toolpath compensation. */
|
|
10
|
+
analysis?: boolean;
|
|
8
11
|
params?: Record<string, Value>;
|
|
9
12
|
fonts?: Record<string, FontSource>;
|
|
10
13
|
defaultFont?: string;
|
|
@@ -12,6 +15,8 @@ export interface RenderOptions {
|
|
|
12
15
|
kerf?: number;
|
|
13
16
|
layout?: 'pack' | 'none';
|
|
14
17
|
sheet?: [number, number];
|
|
18
|
+
defaultSheet?: [number, number];
|
|
19
|
+
nest?: boolean;
|
|
15
20
|
gap?: number;
|
|
16
21
|
margin?: number;
|
|
17
22
|
guides?: boolean;
|
|
@@ -28,12 +33,19 @@ export interface PartInfo {
|
|
|
28
33
|
thickness: number;
|
|
29
34
|
kerf: number;
|
|
30
35
|
material: string;
|
|
36
|
+
stack?: number;
|
|
37
|
+
glued?: string;
|
|
38
|
+
label?: number;
|
|
39
|
+
mirrored?: boolean;
|
|
31
40
|
}
|
|
32
41
|
export interface Placed {
|
|
33
42
|
part: string;
|
|
34
43
|
copy: number;
|
|
35
44
|
layers: Map<string, Layer>;
|
|
36
45
|
rotated: boolean;
|
|
46
|
+
/** With layout "none": the move from the part's coordinates, y flipped
|
|
47
|
+
* down, to the sheet's */
|
|
48
|
+
offset?: [number, number];
|
|
37
49
|
}
|
|
38
50
|
export interface Sheet {
|
|
39
51
|
width: number;
|
|
@@ -44,8 +56,15 @@ export interface Sheet {
|
|
|
44
56
|
paths: LayerPath[];
|
|
45
57
|
svg: string;
|
|
46
58
|
dxf: string;
|
|
59
|
+
back?: {
|
|
60
|
+
paths: LayerPath[];
|
|
61
|
+
svg: string;
|
|
62
|
+
dxf: string;
|
|
63
|
+
};
|
|
47
64
|
}
|
|
48
65
|
export interface RenderResult {
|
|
66
|
+
/** Present only when requested; separate from packed, compensated cut paths. */
|
|
67
|
+
analysis?: RenderAnalysis;
|
|
49
68
|
sheets: Sheet[];
|
|
50
69
|
width: number;
|
|
51
70
|
height: number;
|
|
@@ -56,5 +75,7 @@ export interface RenderResult {
|
|
|
56
75
|
layers: LayerDef[];
|
|
57
76
|
warnings: string[];
|
|
58
77
|
echoes: string[];
|
|
78
|
+
hardware: HardwareItem[];
|
|
79
|
+
steps: string[];
|
|
59
80
|
}
|
|
60
81
|
export declare function render(source: string, options?: RenderOptions): RenderResult;
|
package/dist/signatures.cjs
CHANGED
|
@@ -61,7 +61,8 @@ var text = (name, doc) => ({
|
|
|
61
61
|
p("font", "Font name", "$font"),
|
|
62
62
|
named("halign", "left, center or right", '"left"'),
|
|
63
63
|
named("valign", "baseline, top, center or bottom", '"baseline"'),
|
|
64
|
-
named("spacing", "Letter spacing factor", "1")
|
|
64
|
+
named("spacing", "Letter spacing factor", "1"),
|
|
65
|
+
named("fit", "Measure at the size that fits this width")
|
|
65
66
|
],
|
|
66
67
|
section: "Text measurements",
|
|
67
68
|
doc
|
|
@@ -137,7 +138,8 @@ var SIGNATURES = [
|
|
|
137
138
|
kind: "module",
|
|
138
139
|
params: [
|
|
139
140
|
p("d", 'SVG path data, as "M0 0 L10 0 L5 8 Z"'),
|
|
140
|
-
named("fill", '"evenodd" or "nonzero"', '"evenodd"')
|
|
141
|
+
named("fill", '"evenodd" or "nonzero"', '"evenodd"'),
|
|
142
|
+
named("close", "Close every open subpath into an area", "false")
|
|
141
143
|
],
|
|
142
144
|
section: "Shapes",
|
|
143
145
|
doc: "Shapes from SVG path data: closed subpaths become areas, open ones lines"
|
|
@@ -151,7 +153,8 @@ var SIGNATURES = [
|
|
|
151
153
|
p("font", "Font name", "$font"),
|
|
152
154
|
named("halign", "left, center or right", '"left"'),
|
|
153
155
|
named("valign", "baseline, top, center or bottom", '"baseline"'),
|
|
154
|
-
named("spacing", "Letter spacing factor", "1")
|
|
156
|
+
named("spacing", "Letter spacing factor", "1"),
|
|
157
|
+
named("fit", "Shrink the size so the text is no wider than this")
|
|
155
158
|
],
|
|
156
159
|
section: "Shapes",
|
|
157
160
|
doc: "Text as shapes; the font must be available to the renderer"
|
|
@@ -159,9 +162,13 @@ var SIGNATURES = [
|
|
|
159
162
|
{
|
|
160
163
|
name: "line",
|
|
161
164
|
kind: "module",
|
|
162
|
-
params: [
|
|
165
|
+
params: [
|
|
166
|
+
p("from", "Start point", "[0, 0]"),
|
|
167
|
+
p("to", "End point", "[10, 0]"),
|
|
168
|
+
p("width", "Make a strip this wide, an area, instead of a line")
|
|
169
|
+
],
|
|
163
170
|
section: "Shapes",
|
|
164
|
-
doc: "A straight line,
|
|
171
|
+
doc: "A straight line, or with a width a strip between the points"
|
|
165
172
|
},
|
|
166
173
|
{
|
|
167
174
|
name: "polyline",
|
|
@@ -281,6 +288,73 @@ var SIGNATURES = [
|
|
|
281
288
|
section: "Combining",
|
|
282
289
|
doc: "Grow or shrink the areas of the children"
|
|
283
290
|
},
|
|
291
|
+
{
|
|
292
|
+
name: "pattern",
|
|
293
|
+
kind: "module",
|
|
294
|
+
params: [
|
|
295
|
+
p("spacing", "Distance between copies, a number or [x, y]", "10"),
|
|
296
|
+
p("stagger", "Shift of every other row, as a share of the x spacing", "0")
|
|
297
|
+
],
|
|
298
|
+
children: true,
|
|
299
|
+
section: "Combining",
|
|
300
|
+
doc: "Repeat the first child over the area of the others, clipping copies at its edge"
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
name: "spline",
|
|
304
|
+
kind: "module",
|
|
305
|
+
params: [
|
|
306
|
+
p("points", "The [x, y] points the curve goes through"),
|
|
307
|
+
p("width", "Make an area this wide along the curve, instead of a line"),
|
|
308
|
+
named("steps", "Points between each two given ones", "8"),
|
|
309
|
+
named("closed", "Join the curve back to its start", "false")
|
|
310
|
+
],
|
|
311
|
+
section: "Shapes",
|
|
312
|
+
doc: "A smooth curve through points: a line, or with a width an area"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
name: "hatch",
|
|
316
|
+
kind: "module",
|
|
317
|
+
params: [
|
|
318
|
+
p("angle", "Direction of the lines, in degrees from +x", "45"),
|
|
319
|
+
p("pitch", "Distance between the lines", "5"),
|
|
320
|
+
p("width", "Make stripes this wide, areas, instead of lines")
|
|
321
|
+
],
|
|
322
|
+
children: true,
|
|
323
|
+
section: "Combining",
|
|
324
|
+
doc: "Parallel lines or stripes across the area of the children"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
name: "paint",
|
|
328
|
+
kind: "module",
|
|
329
|
+
params: [p("layers", 'A layer for each child; "" leaves that child out')],
|
|
330
|
+
children: true,
|
|
331
|
+
section: "Combining",
|
|
332
|
+
doc: "Painter's order: each child loses the area of the children after it"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
name: "measure",
|
|
336
|
+
kind: "module",
|
|
337
|
+
params: [p("draw", "Draw the first child too", "false")],
|
|
338
|
+
children: true,
|
|
339
|
+
section: "Combining",
|
|
340
|
+
doc: "Set $bounds = [x0, y0, x1, y1] of the first child for the children after it"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
name: "fill_holes",
|
|
344
|
+
kind: "module",
|
|
345
|
+
params: [p("min_area", "Fill only holes smaller than this many square millimetres")],
|
|
346
|
+
children: true,
|
|
347
|
+
section: "Combining",
|
|
348
|
+
doc: "Fill the holes in the areas of the children"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
name: "close",
|
|
352
|
+
kind: "module",
|
|
353
|
+
params: [p("r", "Close gaps and notches narrower than twice this", "0.5")],
|
|
354
|
+
children: true,
|
|
355
|
+
section: "Combining",
|
|
356
|
+
doc: "Close narrow gaps between and in the areas of the children"
|
|
357
|
+
},
|
|
284
358
|
{
|
|
285
359
|
name: "stroke",
|
|
286
360
|
kind: "module",
|
|
@@ -309,7 +383,13 @@ var SIGNATURES = [
|
|
|
309
383
|
{
|
|
310
384
|
name: "score",
|
|
311
385
|
kind: "module",
|
|
312
|
-
params: [
|
|
386
|
+
params: [
|
|
387
|
+
p(
|
|
388
|
+
"side",
|
|
389
|
+
'"front", or "back" for the face underneath, made after turning the part over',
|
|
390
|
+
'"front"'
|
|
391
|
+
)
|
|
392
|
+
],
|
|
313
393
|
children: true,
|
|
314
394
|
section: "Layers",
|
|
315
395
|
doc: "Put the children on the score layer: lines marked without cutting through"
|
|
@@ -317,7 +397,13 @@ var SIGNATURES = [
|
|
|
317
397
|
{
|
|
318
398
|
name: "engrave",
|
|
319
399
|
kind: "module",
|
|
320
|
-
params: [
|
|
400
|
+
params: [
|
|
401
|
+
p(
|
|
402
|
+
"side",
|
|
403
|
+
'"front", or "back" for the face underneath, made after turning the part over',
|
|
404
|
+
'"front"'
|
|
405
|
+
)
|
|
406
|
+
],
|
|
321
407
|
children: true,
|
|
322
408
|
section: "Layers",
|
|
323
409
|
doc: "Put the children on the engrave layer: areas filled in"
|
|
@@ -336,7 +422,14 @@ var SIGNATURES = [
|
|
|
336
422
|
params: [
|
|
337
423
|
p("name", "Layer name"),
|
|
338
424
|
p("mode", '"cut", "line", "fill" or "guide"'),
|
|
339
|
-
p("color", 'Colour in the output, as "#00aa00"')
|
|
425
|
+
p("color", 'Colour in the output, as "#00aa00"'),
|
|
426
|
+
named("order", "Where it goes among the custom layers in the files, lowest first", "0"),
|
|
427
|
+
named("bleed", "How far past the part's edge it may print", "0"),
|
|
428
|
+
named(
|
|
429
|
+
"side",
|
|
430
|
+
'"front", or "back" for the face underneath, made after turning the part over',
|
|
431
|
+
'"front"'
|
|
432
|
+
)
|
|
340
433
|
],
|
|
341
434
|
children: true,
|
|
342
435
|
section: "Layers",
|
|
@@ -349,12 +442,70 @@ var SIGNATURES = [
|
|
|
349
442
|
p("name", "Part name", '"part"'),
|
|
350
443
|
p("qty", "Number of copies to cut", "1"),
|
|
351
444
|
named("at", "Where the part goes in the assembled view, [x, y, z]"),
|
|
352
|
-
named("rotate", "How the part is turned in the assembled view, [x, y, z] in degrees")
|
|
445
|
+
named("rotate", "How the part is turned in the assembled view, [x, y, z] in degrees"),
|
|
446
|
+
named("stack", "Layers glued in a stack at each placement, one thickness apart", "1"),
|
|
447
|
+
named("mirror", "Cut the part mirrored left to right, its text still reading", "false"),
|
|
448
|
+
named("bend", "Living hinge bends in the assembled view: [x0, x1, angle] or a list"),
|
|
449
|
+
named("on", "The name of a bent part this one is glued to, to move with it"),
|
|
450
|
+
named("slots", "Names of parts whose tabs pass through this one: their slots are cut"),
|
|
451
|
+
named("clearance", "Added to the slots, in total across each", "0.1"),
|
|
452
|
+
named(
|
|
453
|
+
"glue",
|
|
454
|
+
"The name of a part this one is glued flat onto; at and rotate are then on its face"
|
|
455
|
+
),
|
|
456
|
+
named("face", 'The face of the glue part it goes on: "top" or "bottom"', '"top"')
|
|
353
457
|
],
|
|
354
458
|
children: true,
|
|
355
459
|
section: "Parts and sheets",
|
|
356
460
|
doc: "A named part, with its thickness, kerf and material"
|
|
357
461
|
},
|
|
462
|
+
{
|
|
463
|
+
name: "place",
|
|
464
|
+
kind: "module",
|
|
465
|
+
params: [
|
|
466
|
+
p("at", "Where the parts inside go, [x, y, z]", "[0, 0, 0]"),
|
|
467
|
+
p("rotate", "How they are turned, [x, y, z] in degrees", "[0, 0, 0]")
|
|
468
|
+
],
|
|
469
|
+
children: true,
|
|
470
|
+
section: "Parts and sheets",
|
|
471
|
+
doc: "Place the parts inside in the assembled view, with their own placements inside this one"
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
name: "call",
|
|
475
|
+
kind: "module",
|
|
476
|
+
params: [p("name", 'The name of a module, as "roses"')],
|
|
477
|
+
rest: true,
|
|
478
|
+
children: true,
|
|
479
|
+
section: "Other",
|
|
480
|
+
doc: "Calls the module of that name with the other arguments and the children, so a table can carry which module draws each entry"
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
name: "step",
|
|
484
|
+
kind: "module",
|
|
485
|
+
params: [
|
|
486
|
+
p("text", "What to do in this step", '""'),
|
|
487
|
+
p("substeps", "Steps inside it become its sub-steps; false adds them to this one", "true")
|
|
488
|
+
],
|
|
489
|
+
children: true,
|
|
490
|
+
section: "Parts and sheets",
|
|
491
|
+
doc: 'An assembly step: the parts and hardware inside are added in it, in order. A step inside a step is a sub-step, named "outer: inner"'
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
name: "hardware",
|
|
495
|
+
kind: "module",
|
|
496
|
+
params: [
|
|
497
|
+
p("kind", 'What it is, as "dowel", "screw", "magnet", "elastic" or "paper"', '"dowel"'),
|
|
498
|
+
p("from", "One end, [x, y, z]"),
|
|
499
|
+
p("to", "The other end, [x, y, z]"),
|
|
500
|
+
p("size", "Diameter, or [width, height] for a flat section", "6"),
|
|
501
|
+
named("up", "The direction a [width, height] section's height points"),
|
|
502
|
+
named("sides", "Sides of a round section in the 3D view", "24"),
|
|
503
|
+
named("label", "The name in the hardware list")
|
|
504
|
+
],
|
|
505
|
+
children: true,
|
|
506
|
+
section: "Parts and sheets",
|
|
507
|
+
doc: "Hardware the assembly needs, in the parts list and the 3D view"
|
|
508
|
+
},
|
|
358
509
|
{
|
|
359
510
|
name: "material",
|
|
360
511
|
kind: "module",
|
|
@@ -519,13 +670,94 @@ var SIGNATURES = [
|
|
|
519
670
|
section: "Numbers and vectors",
|
|
520
671
|
doc: "Cross product: a number for 2D vectors, a vector for 3D ones"
|
|
521
672
|
},
|
|
673
|
+
// Paths and 3D rotations
|
|
674
|
+
{
|
|
675
|
+
name: "path_length",
|
|
676
|
+
kind: "function",
|
|
677
|
+
params: [p("points", "A list of [x, y] points")],
|
|
678
|
+
section: "Paths and rotations",
|
|
679
|
+
doc: "The length of the lines through a list of points"
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
name: "point_at",
|
|
683
|
+
kind: "function",
|
|
684
|
+
params: [p("points", "A list of [x, y] points"), p("s", "Distance along the path")],
|
|
685
|
+
section: "Paths and rotations",
|
|
686
|
+
doc: "The point a distance along a path; past either end it carries on straight"
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
name: "heading_at",
|
|
690
|
+
kind: "function",
|
|
691
|
+
params: [p("points", "A list of [x, y] points"), p("s", "Distance along the path")],
|
|
692
|
+
section: "Paths and rotations",
|
|
693
|
+
doc: "The direction of a path a distance along it, in degrees from +x"
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
name: "path_points",
|
|
697
|
+
kind: "function",
|
|
698
|
+
params: [
|
|
699
|
+
p("d", 'SVG path data, as "M0 0 L10 0 A5 5 0 0 1 20 0"'),
|
|
700
|
+
p("tolerance", "How far curves may stray from their points", "0.05")
|
|
701
|
+
],
|
|
702
|
+
section: "Paths and rotations",
|
|
703
|
+
doc: "The points of SVG path data: one list of points for each subpath"
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
name: "spline_points",
|
|
707
|
+
kind: "function",
|
|
708
|
+
params: [
|
|
709
|
+
p("points", "The [x, y] points the curve goes through"),
|
|
710
|
+
p("steps", "Points between each two given ones", "8"),
|
|
711
|
+
p("closed", "Join the curve back to its start", "false")
|
|
712
|
+
],
|
|
713
|
+
section: "Paths and rotations",
|
|
714
|
+
doc: "The points of a smooth curve through points, as spline() draws it"
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
name: "rotation",
|
|
718
|
+
kind: "function",
|
|
719
|
+
params: [p("angles", "[x, y, z] in degrees, as part() turns")],
|
|
720
|
+
section: "Paths and rotations",
|
|
721
|
+
doc: "The 3x3 matrix of a rotation; matrices multiply with *"
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
name: "euler",
|
|
725
|
+
kind: "function",
|
|
726
|
+
params: [p("matrix", "A 3x3 rotation matrix")],
|
|
727
|
+
section: "Paths and rotations",
|
|
728
|
+
doc: "The [x, y, z] angles of a rotation matrix, for part()'s rotate"
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
name: "orient",
|
|
732
|
+
kind: "function",
|
|
733
|
+
params: [
|
|
734
|
+
p("x", "Where the part's own x axis points"),
|
|
735
|
+
p("z", "Where its z axis, out of its top face, points", "[0, 0, 1]")
|
|
736
|
+
],
|
|
737
|
+
section: "Paths and rotations",
|
|
738
|
+
doc: "The rotate angles that turn a part's x and z axes onto two directions"
|
|
739
|
+
},
|
|
522
740
|
// Lists and strings
|
|
523
741
|
{
|
|
524
742
|
name: "len",
|
|
525
743
|
kind: "function",
|
|
526
744
|
params: value,
|
|
527
745
|
section: "Lists and strings",
|
|
528
|
-
doc: "Number of items in a list or
|
|
746
|
+
doc: "Number of items in a list, characters in a string or fields in a record"
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
name: "keys",
|
|
750
|
+
kind: "function",
|
|
751
|
+
params: [p("record", "A record, as {name = value}")],
|
|
752
|
+
section: "Lists and strings",
|
|
753
|
+
doc: "A record's field names, in the order they were written"
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
name: "merge",
|
|
757
|
+
kind: "function",
|
|
758
|
+
params: [p("a", "A record"), p("b", "A record whose fields add to or replace those of a")],
|
|
759
|
+
section: "Lists and strings",
|
|
760
|
+
doc: "A record with the fields of a and b, b winning where both have one"
|
|
529
761
|
},
|
|
530
762
|
{
|
|
531
763
|
name: "concat",
|
|
@@ -639,12 +871,13 @@ var SIGNATURES = [
|
|
|
639
871
|
is("is_list", "a list"),
|
|
640
872
|
is("is_undef", "undef"),
|
|
641
873
|
is("is_function", "a function"),
|
|
874
|
+
is("is_record", "a record, as {name = value}"),
|
|
642
875
|
{
|
|
643
876
|
name: "type_of",
|
|
644
877
|
kind: "function",
|
|
645
878
|
params: value,
|
|
646
879
|
section: "Types",
|
|
647
|
-
doc: "The type name: number, string, boolean, undef, list, range or
|
|
880
|
+
doc: "The type name: number, string, boolean, undef, list, range, function or record"
|
|
648
881
|
},
|
|
649
882
|
{
|
|
650
883
|
name: "rands",
|