@mylasertools/kerfscript 0.11.0 → 0.11.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.1 (2026-11-27)
4
+
5
+ Fixes:
6
+
7
+ - 3MF files open in OrcaSlicer, Bambu Studio and the slicers based on them
8
+ with each colour on its own filament, so the engraving and scoring print
9
+ in their colours instead of all on the first filament.
10
+
3
11
  ## 0.11.0 (2026-11-18)
4
12
 
5
13
  Language:
package/dist/cli.js CHANGED
@@ -20932,9 +20932,12 @@ var LIBRARIES = {
20932
20932
  // Copyright (c) 2026 MyLaserTools. AGPL-3.0-only or MyLaserTools commercial licence.
20933
20933
  //
20934
20934
  // A flat key turns an eccentric cam, which slides a bolt: half a turn
20935
- // throws its nose out past the lock's top edge, into a notch or a slot in
20936
- // whatever it locks, and half a turn back pulls it in. Pulling on what is
20937
- // locked only presses the bolt against its slot. The lock is three layers
20935
+ // throws its nose out past the lock's top edge, into a slot in whatever it
20936
+ // locks, and half a turn back pulls it in. A bolt only holds against a pull
20937
+ // across its travel: set the lock so the bolt moves across the way the
20938
+ // locked part opens (sideways for a lid that lifts), and give the slot
20939
+ // wood on the side the part pulls from (a pocket, not a notch open that
20940
+ // way), so pulling presses the bolt against it. The lock is three layers
20938
20941
  // of the current material: a base with the cam's hub, a frame with the
20939
20942
  // cam and the bolt, and a plate with the keyhole.
20940
20943
  //
@@ -20947,7 +20950,7 @@ var LIBRARIES = {
20947
20950
  function lock_bounds(throw = 7) = let (d = lock_dims(throw))
20948
20951
  [-d[6] / 2, d[8], d[6] / 2, d[7]];
20949
20952
 
20950
- // Where the bolt's nose is: [width, y of its tip when locked]. Cut a notch
20953
+ // Where the bolt's nose is: [width, y of its tip when locked]. Cut a pocket
20951
20954
  // a little wider than this where it goes.
20952
20955
  function lock_nose(throw = 7) = let (d = lock_dims(throw)) [d[4], d[7] + d[5]];
20953
20956
 
@@ -27118,6 +27121,8 @@ function to3mf(bodies2) {
27118
27121
  };
27119
27122
  const objects = [];
27120
27123
  const items2 = [];
27124
+ const settings = [];
27125
+ const meta = (key2, value3) => `<metadata key="${key2}" value="${xml(String(value3))}"/>`;
27121
27126
  const groups = /* @__PURE__ */ new Map();
27122
27127
  bodies2.forEach((b, i) => {
27123
27128
  const key2 = b.instance === void 0 ? `h${i}` : `p${b.instance}`;
@@ -27126,6 +27131,7 @@ function to3mf(bodies2) {
27126
27131
  let id = 2;
27127
27132
  for (const group of groups.values()) {
27128
27133
  const ids = [];
27134
+ const parts = [];
27129
27135
  for (const b of group) {
27130
27136
  const vs = [];
27131
27137
  for (let i = 0; i < b.positions.length; i += 3)
@@ -27140,13 +27146,20 @@ function to3mf(bodies2) {
27140
27146
  objects.push(
27141
27147
  `<object id="${id}" type="model" name="${xml(copyName(b))}" pid="1" pindex="${colourIndex(b)}"><mesh><vertices>${vs.join("")}</vertices><triangles>${ts.join("")}</triangles></mesh></object>`
27142
27148
  );
27149
+ parts.push(
27150
+ `<part id="${id}" subtype="normal_part">${meta("name", copyName(b))}${meta("extruder", colourIndex(b) + 1)}</part>`
27151
+ );
27143
27152
  ids.push(id++);
27144
27153
  }
27145
- if (ids.length === 1) items2.push(`<item objectid="${ids[0]}"/>`);
27146
- else {
27154
+ const head = `${meta("name", copyName(group[0]))}${meta("extruder", colourIndex(group[0]) + 1)}`;
27155
+ if (ids.length === 1) {
27156
+ items2.push(`<item objectid="${ids[0]}"/>`);
27157
+ settings.push(`<object id="${ids[0]}">${head}</object>`);
27158
+ } else {
27147
27159
  objects.push(
27148
27160
  `<object id="${id}" type="model" name="${xml(copyName(group[0]))}"><components>${ids.map((i) => `<component objectid="${i}"/>`).join("")}</components></object>`
27149
27161
  );
27162
+ settings.push(`<object id="${id}">${head}${parts.join("")}</object>`);
27150
27163
  items2.push(`<item objectid="${id++}"/>`);
27151
27164
  }
27152
27165
  }
@@ -27164,7 +27177,7 @@ function to3mf(bodies2) {
27164
27177
  {
27165
27178
  name: "[Content_Types].xml",
27166
27179
  data: enc.encode(
27167
- '<?xml version="1.0" encoding="UTF-8"?>\n<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="model" ContentType="application/vnd.ms-package.3dmanufacturing-3dmodel+xml"/></Types>\n'
27180
+ '<?xml version="1.0" encoding="UTF-8"?>\n<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="model" ContentType="application/vnd.ms-package.3dmanufacturing-3dmodel+xml"/><Default Extension="config" ContentType="text/xml"/></Types>\n'
27168
27181
  )
27169
27182
  },
27170
27183
  {
@@ -27173,7 +27186,15 @@ function to3mf(bodies2) {
27173
27186
  '<?xml version="1.0" encoding="UTF-8"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Target="/3D/3dmodel.model" Id="rel0" Type="http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel"/></Relationships>\n'
27174
27187
  )
27175
27188
  },
27176
- { name: "3D/3dmodel.model", data: enc.encode(model) }
27189
+ { name: "3D/3dmodel.model", data: enc.encode(model) },
27190
+ {
27191
+ name: "Metadata/model_settings.config",
27192
+ data: enc.encode(
27193
+ `<?xml version="1.0" encoding="UTF-8"?>
27194
+ <config>${settings.join("")}</config>
27195
+ `
27196
+ )
27197
+ }
27177
27198
  ]);
27178
27199
  }
27179
27200
  var linear = (v) => {
@@ -32955,7 +32976,7 @@ function triageText(result) {
32955
32976
  }
32956
32977
 
32957
32978
  // src/index.ts
32958
- var VERSION = "0.11.0";
32979
+ var VERSION = "0.11.1";
32959
32980
  var LANGUAGE_VERSION = "0.3";
32960
32981
 
32961
32982
  // fonts/AtkinsonHyperlegible-Regular.ttf
@@ -4,7 +4,10 @@ export type ModelFormat = 'glb' | '3mf' | 'stl';
4
4
  /** Binary STL of all the bodies as one mesh, in millimetres */
5
5
  export declare function toStl(bodies: Body[]): Uint8Array;
6
6
  /** A 3MF package in millimetres: each part one object, its engraving and
7
- * scoring coloured parts of it, so a slicer prints them in their colours */
7
+ * scoring coloured parts of it, so a slicer prints them in their colours.
8
+ * Each colour is a base material, and also a filament (1, 2, ... in the
9
+ * same order) in Metadata/model_settings.config, which is what OrcaSlicer,
10
+ * Bambu Studio and the slicers based on them read */
8
11
  export declare function to3mf(bodies: Body[]): Uint8Array;
9
12
  /** GLB (binary glTF 2.0): a node and a mesh for each body, in metres with
10
13
  * y up as glTF has it; each node's extras give its kind, part and copy.
@@ -4,7 +4,10 @@ export type ModelFormat = 'glb' | '3mf' | 'stl';
4
4
  /** Binary STL of all the bodies as one mesh, in millimetres */
5
5
  export declare function toStl(bodies: Body[]): Uint8Array;
6
6
  /** A 3MF package in millimetres: each part one object, its engraving and
7
- * scoring coloured parts of it, so a slicer prints them in their colours */
7
+ * scoring coloured parts of it, so a slicer prints them in their colours.
8
+ * Each colour is a base material, and also a filament (1, 2, ... in the
9
+ * same order) in Metadata/model_settings.config, which is what OrcaSlicer,
10
+ * Bambu Studio and the slicers based on them read */
8
11
  export declare function to3mf(bodies: Body[]): Uint8Array;
9
12
  /** GLB (binary glTF 2.0): a node and a mesh for each body, in metres with
10
13
  * y up as glTF has it; each node's extras give its kind, part and copy.