@chestnutlabs/gcode-containers 0.6.0 → 0.8.1
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/dist/gcode-3mf.d.ts +8 -0
- package/dist/gcode-3mf.d.ts.map +1 -1
- package/dist/gcode-3mf.js +15 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/gcode-3mf.d.ts
CHANGED
|
@@ -41,5 +41,13 @@ export interface OpenedContainer {
|
|
|
41
41
|
openPlate(index: number): StreamLike;
|
|
42
42
|
}
|
|
43
43
|
export declare function sniffGcode3mf(prefix: Uint8Array, name?: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The slicer filament palette from a parsed `project_settings.config`: the `filament_colour` array,
|
|
46
|
+
* one hex string per filament slot (0-based), `undefined` where a slot has no colour. This is the
|
|
47
|
+
* single source of the "which key is the palette" semantics — shared so the model presentation
|
|
48
|
+
* renderer (`@chestnutlabs/gcode-model-renderer`) reads the same palette for source-model painting
|
|
49
|
+
* (Bambu/Orca `paint_color`) instead of duplicating it. Empty array when the key is absent/malformed.
|
|
50
|
+
*/
|
|
51
|
+
export declare function filamentColoursFromSettings(settings: Record<string, unknown>): (string | undefined)[];
|
|
44
52
|
export declare function openGcode3mf(bytes: Uint8Array, limits?: ContainerLimits): Promise<OpenedContainer>;
|
|
45
53
|
//# sourceMappingURL=gcode-3mf.d.ts.map
|
package/dist/gcode-3mf.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcode-3mf.d.ts","sourceRoot":"","sources":["../src/gcode-3mf.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAU,MAAM,6BAA6B,CAAC;AACzF,OAAO,EASL,KAAK,eAAe,EAErB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,UAAU;IACz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iBAAiB;IAChC,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;IAC3B,+EAA+E;IAC/E,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC/C;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,IAAI;QAAE,IAAI,IAAI,OAAO,CAAC;YAAE,IAAI,EAAE,OAAO,CAAC;YAAC,KAAK,CAAC,EAAE,UAAU,CAAA;SAAE,CAAC,CAAC;QAAC,WAAW,CAAC,IAAI,IAAI,CAAA;KAAE,CAAC;CAC/F;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,WAAW,CAAC;IAChB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC;CACtC;AAgBD,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAKxE;AA0CD;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAIrG;AAaD,wBAAsB,YAAY,CAChC,KAAK,EAAE,UAAU,EACjB,MAAM,GAAE,eAA0C,GACjD,OAAO,CAAC,eAAe,CAAC,CA2G1B"}
|
package/dist/gcode-3mf.js
CHANGED
|
@@ -59,15 +59,28 @@ function machineFromSettings(settings) {
|
|
|
59
59
|
source: { adapterId: 'gcode-3mf', evidence: 'Metadata/project_settings.config printable_area' }
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* The slicer filament palette from a parsed `project_settings.config`: the `filament_colour` array,
|
|
64
|
+
* one hex string per filament slot (0-based), `undefined` where a slot has no colour. This is the
|
|
65
|
+
* single source of the "which key is the palette" semantics — shared so the model presentation
|
|
66
|
+
* renderer (`@chestnutlabs/gcode-model-renderer`) reads the same palette for source-model painting
|
|
67
|
+
* (Bambu/Orca `paint_color`) instead of duplicating it. Empty array when the key is absent/malformed.
|
|
68
|
+
*/
|
|
69
|
+
export function filamentColoursFromSettings(settings) {
|
|
70
|
+
const colours = settings['filament_colour'];
|
|
71
|
+
if (!Array.isArray(colours))
|
|
72
|
+
return [];
|
|
73
|
+
return colours.slice(0, 64).map((c) => (typeof c === 'string' ? c : undefined));
|
|
74
|
+
}
|
|
62
75
|
function filamentsFromSettings(settings) {
|
|
63
76
|
const types = settings['filament_type'];
|
|
64
77
|
if (!Array.isArray(types))
|
|
65
78
|
return undefined;
|
|
66
|
-
const colours =
|
|
79
|
+
const colours = filamentColoursFromSettings(settings);
|
|
67
80
|
return types.slice(0, 64).map((t, i) => ({
|
|
68
81
|
slot: i,
|
|
69
82
|
type: typeof t === 'string' ? t : undefined,
|
|
70
|
-
color:
|
|
83
|
+
color: colours[i]
|
|
71
84
|
}));
|
|
72
85
|
}
|
|
73
86
|
export async function openGcode3mf(bytes, limits = DEFAULT_CONTAINER_LIMITS) {
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export { ContainerError, DEFAULT_CONTAINER_LIMITS, canonicalName, crc32, crc32Final, readDirectory, locatePayload, extractEntry, streamEntry } from './zip.js';
|
|
10
10
|
export type { ContainerLimits, ZipEntry, ZipDirectory } from './zip.js';
|
|
11
|
-
export { openGcode3mf, sniffGcode3mf } from './gcode-3mf.js';
|
|
11
|
+
export { openGcode3mf, sniffGcode3mf, filamentColoursFromSettings } from './gcode-3mf.js';
|
|
12
12
|
export type { OpenedContainer, PlateEntry, ContainerMetadata, StreamLike } from './gcode-3mf.js';
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,aAAa,EACb,KAAK,EACL,UAAU,EACV,aAAa,EACb,aAAa,EACb,YAAY,EACZ,WAAW,EACZ,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,aAAa,EACb,KAAK,EACL,UAAU,EACV,aAAa,EACb,aAAa,EACb,YAAY,EACZ,WAAW,EACZ,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC1F,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* it through its structural ContainerAdapterLike type (worker entries compose).
|
|
8
8
|
*/
|
|
9
9
|
export { ContainerError, DEFAULT_CONTAINER_LIMITS, canonicalName, crc32, crc32Final, readDirectory, locatePayload, extractEntry, streamEntry } from './zip.js';
|
|
10
|
-
export { openGcode3mf, sniffGcode3mf } from './gcode-3mf.js';
|
|
10
|
+
export { openGcode3mf, sniffGcode3mf, filamentColoursFromSettings } from './gcode-3mf.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chestnutlabs/gcode-containers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Safe, bounded, in-memory container extraction for sliced G-code (.gcode.3mf) — DD-005 §4.4/§7. Never writes files, never fetches, zero dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gcode",
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
"test": "vitest run"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@chestnutlabs/toolpath-core": "0.
|
|
45
|
+
"@chestnutlabs/toolpath-core": "0.8.1"
|
|
46
46
|
}
|
|
47
47
|
}
|