bambu-printer-mcp 1.1.53 → 1.1.54
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/README.md +4 -1
- package/dist/index.js +4 -1
- package/dist/slicer/process-overrides.d.ts +5 -3
- package/dist/slicer/process-overrides.js +30 -1
- package/package.json +1 -1
- package/src/index.ts +4 -1
- package/src/slicer/process-overrides.ts +26 -3
package/README.md
CHANGED
|
@@ -1200,8 +1200,11 @@ When `slicer_type` is `bambustudio` (the default), these additional parameters a
|
|
|
1200
1200
|
| `layer_height` | number | Layer height in mm, such as 0.28, 0.2 or 0.12; at most the nozzle diameter |
|
|
1201
1201
|
| `wall_loops` | integer | Number of walls, 0 to 1000 |
|
|
1202
1202
|
| `sparse_infill_density` | string | Sparse infill density, such as `"15%"` |
|
|
1203
|
+
| `enable_support` | boolean | Turn support generation on or off |
|
|
1204
|
+
| `support_type` | string | `normal(auto)`, `tree(auto)`, `normal(manual)` or `tree(manual)` |
|
|
1205
|
+
| `support_threshold_angle` | integer | Overhang threshold for automatic supports, 0 to 90 degrees (0 lets the slicer decide) |
|
|
1203
1206
|
|
|
1204
|
-
`layer_height`, `wall_loops
|
|
1207
|
+
`layer_height`, `wall_loops`, `sparse_infill_density` and the three support arguments are written as a process override on top of the machine and process preset the tool resolves, using Bambu Studio's keys and string forms (`"0.2"`, `"2"`, `"15%"`). Every other preset value, and the machine preset, stay as resolved, and your own profile files are not changed. They work with every Bambu-compatible slicer, including remote `orca-slicer-api` slicing, and are refused for PrusaSlicer, Slic3r and Cura.
|
|
1205
1208
|
|
|
1206
1209
|
**Example: Slice with auto-orient and 3 copies**
|
|
1207
1210
|
```json
|
package/dist/index.js
CHANGED
|
@@ -2121,7 +2121,10 @@ class BambuPrinterMCPServer {
|
|
|
2121
2121
|
slice_plate: { type: "number", description: "Which plate index to slice. 0 = all plates for local slicers; remote slicing defaults to plate 1 and rejects 0. Use 1, 2, etc. to slice only a specific plate in multi-plate 3MF projects." },
|
|
2122
2122
|
layer_height: { type: "number", exclusiveMinimum: 0, description: "Layer height in mm, such as 0.28 (draft), 0.2 (standard) or 0.12 (fine). Written as the process preset's layer_height over the machine and process preset this tool resolves; at most the nozzle diameter. Bambu-compatible slicers only." },
|
|
2123
2123
|
wall_loops: { type: "integer", minimum: 0, maximum: 1000, description: "Number of walls (perimeters), written as the process preset's wall_loops. Bambu-compatible slicers only." },
|
|
2124
|
-
sparse_infill_density: { type: "string", pattern: "^\\s*\\d+(\\.\\d+)?\\s*%\\s*$", description: "Sparse infill density as a percentage, such as \"15%\", written as the process preset's sparse_infill_density. Bambu-compatible slicers only." }
|
|
2124
|
+
sparse_infill_density: { type: "string", pattern: "^\\s*\\d+(\\.\\d+)?\\s*%\\s*$", description: "Sparse infill density as a percentage, such as \"15%\", written as the process preset's sparse_infill_density. Bambu-compatible slicers only." },
|
|
2125
|
+
enable_support: { type: "boolean", description: "Turn support generation on or off, written as the process preset's enable_support. Bambu-compatible slicers only." },
|
|
2126
|
+
support_type: { type: "string", enum: ["normal(auto)", "tree(auto)", "normal(manual)", "tree(manual)"], description: "Support style, written as the process preset's support_type. Bambu-compatible slicers only." },
|
|
2127
|
+
support_threshold_angle: { type: "integer", minimum: 0, maximum: 90, description: "Overhang threshold in degrees for automatic supports, written as the process preset's support_threshold_angle (0 lets the slicer decide). Bambu-compatible slicers only." }
|
|
2125
2128
|
},
|
|
2126
2129
|
required: ["stl_path", "bambu_model"]
|
|
2127
2130
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* slice_stl's layer_height, wall_loops and
|
|
2
|
+
* slice_stl's layer_height, wall_loops, sparse_infill_density and support arguments
|
|
3
3
|
* (PRD §8.4). They are written over the process preset the slicer already
|
|
4
4
|
* resolved, using Bambu Studio/Orca keys and their string forms ("0.2", "2",
|
|
5
5
|
* "15%"), so the machine preset and every other process value stay as resolved.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
8
|
-
export
|
|
7
|
+
export declare const PROCESS_OVERRIDE_KEYS: readonly ["layer_height", "wall_loops", "sparse_infill_density", "enable_support", "support_type", "support_threshold_angle"];
|
|
8
|
+
export type ProcessOverrides = Partial<Record<(typeof PROCESS_OVERRIDE_KEYS)[number], string>>;
|
|
9
|
+
/** Bambu Studio's and OrcaSlicer's support_type values. */
|
|
10
|
+
export declare const SUPPORT_TYPES: readonly ["normal(auto)", "tree(auto)", "normal(manual)", "tree(manual)"];
|
|
9
11
|
/** Validate the tool arguments; undefined when none are given. */
|
|
10
12
|
export declare function parseProcessOverrides(args: Record<string, unknown> | undefined, nozzleDiameter: number): ProcessOverrides | undefined;
|
|
11
13
|
/** The process profile with the overrides written over its values. */
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* slice_stl's layer_height, wall_loops, sparse_infill_density and support arguments
|
|
3
|
+
* (PRD §8.4). They are written over the process preset the slicer already
|
|
4
|
+
* resolved, using Bambu Studio/Orca keys and their string forms ("0.2", "2",
|
|
5
|
+
* "15%"), so the machine preset and every other process value stay as resolved.
|
|
6
|
+
*/
|
|
7
|
+
export const PROCESS_OVERRIDE_KEYS = ["layer_height", "wall_loops", "sparse_infill_density", "enable_support", "support_type", "support_threshold_angle"];
|
|
8
|
+
/** Bambu Studio's and OrcaSlicer's support_type values. */
|
|
9
|
+
export const SUPPORT_TYPES = ["normal(auto)", "tree(auto)", "normal(manual)", "tree(manual)"];
|
|
2
10
|
/** Validate the tool arguments; undefined when none are given. */
|
|
3
11
|
export function parseProcessOverrides(args, nozzleDiameter) {
|
|
4
12
|
const overrides = {};
|
|
@@ -25,6 +33,27 @@ export function parseProcessOverrides(args, nozzleDiameter) {
|
|
|
25
33
|
throw new Error('sparse_infill_density must be a percentage from 0% to 100%, such as "15%".');
|
|
26
34
|
overrides.sparse_infill_density = `${Number(match[1])}%`;
|
|
27
35
|
}
|
|
36
|
+
const enableSupport = args?.enable_support;
|
|
37
|
+
if (enableSupport !== undefined) {
|
|
38
|
+
if (typeof enableSupport !== "boolean")
|
|
39
|
+
throw new Error("enable_support must be true or false.");
|
|
40
|
+
overrides.enable_support = enableSupport ? "1" : "0";
|
|
41
|
+
}
|
|
42
|
+
const supportType = args?.support_type;
|
|
43
|
+
if (supportType !== undefined) {
|
|
44
|
+
if (typeof supportType !== "string" || !SUPPORT_TYPES.includes(supportType)) {
|
|
45
|
+
throw new Error(`support_type must be one of ${SUPPORT_TYPES.join(", ")}.`);
|
|
46
|
+
}
|
|
47
|
+
overrides.support_type = supportType;
|
|
48
|
+
}
|
|
49
|
+
const threshold = args?.support_threshold_angle;
|
|
50
|
+
if (threshold !== undefined) {
|
|
51
|
+
// Studio's threshold angle runs 0-90 degrees; 0 lets the slicer pick by its own rule.
|
|
52
|
+
if (typeof threshold !== "number" || !Number.isInteger(threshold) || threshold < 0 || threshold > 90) {
|
|
53
|
+
throw new Error("support_threshold_angle must be an integer number of degrees from 0 to 90.");
|
|
54
|
+
}
|
|
55
|
+
overrides.support_threshold_angle = String(threshold);
|
|
56
|
+
}
|
|
28
57
|
return Object.keys(overrides).length ? overrides : undefined;
|
|
29
58
|
}
|
|
30
59
|
/** The process profile with the overrides written over its values. */
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -2654,7 +2654,10 @@ class BambuPrinterMCPServer {
|
|
|
2654
2654
|
slice_plate: { type: "number", description: "Which plate index to slice. 0 = all plates for local slicers; remote slicing defaults to plate 1 and rejects 0. Use 1, 2, etc. to slice only a specific plate in multi-plate 3MF projects." },
|
|
2655
2655
|
layer_height: { type: "number", exclusiveMinimum: 0, description: "Layer height in mm, such as 0.28 (draft), 0.2 (standard) or 0.12 (fine). Written as the process preset's layer_height over the machine and process preset this tool resolves; at most the nozzle diameter. Bambu-compatible slicers only." },
|
|
2656
2656
|
wall_loops: { type: "integer", minimum: 0, maximum: 1000, description: "Number of walls (perimeters), written as the process preset's wall_loops. Bambu-compatible slicers only." },
|
|
2657
|
-
sparse_infill_density: { type: "string", pattern: "^\\s*\\d+(\\.\\d+)?\\s*%\\s*$", description: "Sparse infill density as a percentage, such as \"15%\", written as the process preset's sparse_infill_density. Bambu-compatible slicers only." }
|
|
2657
|
+
sparse_infill_density: { type: "string", pattern: "^\\s*\\d+(\\.\\d+)?\\s*%\\s*$", description: "Sparse infill density as a percentage, such as \"15%\", written as the process preset's sparse_infill_density. Bambu-compatible slicers only." },
|
|
2658
|
+
enable_support: { type: "boolean", description: "Turn support generation on or off, written as the process preset's enable_support. Bambu-compatible slicers only." },
|
|
2659
|
+
support_type: { type: "string", enum: ["normal(auto)", "tree(auto)", "normal(manual)", "tree(manual)"], description: "Support style, written as the process preset's support_type. Bambu-compatible slicers only." },
|
|
2660
|
+
support_threshold_angle: { type: "integer", minimum: 0, maximum: 90, description: "Overhang threshold in degrees for automatic supports, written as the process preset's support_threshold_angle (0 lets the slicer decide). Bambu-compatible slicers only." }
|
|
2658
2661
|
},
|
|
2659
2662
|
required: ["stl_path", "bambu_model"]
|
|
2660
2663
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* slice_stl's layer_height, wall_loops and
|
|
2
|
+
* slice_stl's layer_height, wall_loops, sparse_infill_density and support arguments
|
|
3
3
|
* (PRD §8.4). They are written over the process preset the slicer already
|
|
4
4
|
* resolved, using Bambu Studio/Orca keys and their string forms ("0.2", "2",
|
|
5
5
|
* "15%"), so the machine preset and every other process value stay as resolved.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export const PROCESS_OVERRIDE_KEYS = ["layer_height", "wall_loops", "sparse_infill_density", "enable_support", "support_type", "support_threshold_angle"] as const;
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export type ProcessOverrides = Partial<Record<(typeof PROCESS_OVERRIDE_KEYS)[number], string>>;
|
|
10
|
+
|
|
11
|
+
/** Bambu Studio's and OrcaSlicer's support_type values. */
|
|
12
|
+
export const SUPPORT_TYPES = ["normal(auto)", "tree(auto)", "normal(manual)", "tree(manual)"] as const;
|
|
10
13
|
|
|
11
14
|
/** Validate the tool arguments; undefined when none are given. */
|
|
12
15
|
export function parseProcessOverrides(args: Record<string, unknown> | undefined, nozzleDiameter: number): ProcessOverrides | undefined {
|
|
@@ -33,6 +36,26 @@ export function parseProcessOverrides(args: Record<string, unknown> | undefined,
|
|
|
33
36
|
if (!match || Number(match[1]) > 100) throw new Error('sparse_infill_density must be a percentage from 0% to 100%, such as "15%".');
|
|
34
37
|
overrides.sparse_infill_density = `${Number(match[1])}%`;
|
|
35
38
|
}
|
|
39
|
+
const enableSupport = args?.enable_support;
|
|
40
|
+
if (enableSupport !== undefined) {
|
|
41
|
+
if (typeof enableSupport !== "boolean") throw new Error("enable_support must be true or false.");
|
|
42
|
+
overrides.enable_support = enableSupport ? "1" : "0";
|
|
43
|
+
}
|
|
44
|
+
const supportType = args?.support_type;
|
|
45
|
+
if (supportType !== undefined) {
|
|
46
|
+
if (typeof supportType !== "string" || !(SUPPORT_TYPES as readonly string[]).includes(supportType)) {
|
|
47
|
+
throw new Error(`support_type must be one of ${SUPPORT_TYPES.join(", ")}.`);
|
|
48
|
+
}
|
|
49
|
+
overrides.support_type = supportType;
|
|
50
|
+
}
|
|
51
|
+
const threshold = args?.support_threshold_angle;
|
|
52
|
+
if (threshold !== undefined) {
|
|
53
|
+
// Studio's threshold angle runs 0-90 degrees; 0 lets the slicer pick by its own rule.
|
|
54
|
+
if (typeof threshold !== "number" || !Number.isInteger(threshold) || threshold < 0 || threshold > 90) {
|
|
55
|
+
throw new Error("support_threshold_angle must be an integer number of degrees from 0 to 90.");
|
|
56
|
+
}
|
|
57
|
+
overrides.support_threshold_angle = String(threshold);
|
|
58
|
+
}
|
|
36
59
|
return Object.keys(overrides).length ? overrides : undefined;
|
|
37
60
|
}
|
|
38
61
|
|