@constructorfleet/sketchforge3d 1.24.1 → 1.26.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/README.md CHANGED
@@ -254,9 +254,9 @@ A module that exports a bare function instead of a definition runs in a `fresh`
254
254
  | `bolt-plate.macro.mjs` | A plate sized around a computed row of tapped holes |
255
255
  | `bolt-circle.macro.mjs` | A flange with N tapped holes on a ring of radius R |
256
256
  | `filleted-box.macro.mjs` | A box from three numbers, with every roundable edge filleted on the server |
257
- | `tap-drill-plate.macro.mjs` | A plate drilled for a tap through `project.cut`, exported as STL |
257
+ | `tap-drill-plate.macro.mjs` | A plate cut with an M8 thread through `project.cut`, exported as STL |
258
258
 
259
- Tapped holes are `kind: "thread"` with `hole: true`: the form is cut wider by a clearance and the shape is marked as a hole, so grouping it with the plate in the editor taps the plate. The API does group and cut (`project.group`, `project.cut`), but a thread is stored as a mesh, and the server's exact boolean cannot cut that mesh yet, so the bolt macros stop at marked holes. `tap-drill-plate.macro.mjs` runs the whole cut-and-export workflow through the API, with a cylinder at the tap-drill diameter instead of the thread form.
259
+ Tapped holes are `kind: "thread"` with `hole: true`: the form is cut wider by a clearance and the shape is marked as a hole, so grouping it with the plate in the editor or through `project.group` taps the plate. `project.cut` can also subtract a thread mesh directly. `tap-drill-plate.macro.mjs` runs the whole cut-and-export workflow through the API with an M8 thread cutter.
260
260
 
261
261
  ## Development
262
262
 
@@ -1,31 +1,30 @@
1
1
  import { writeFile } from "node:fs/promises";
2
2
 
3
3
  /**
4
- * A plate drilled for a tap, cut on the server and exported as STL.
4
+ * A plate tapped with an M8 thread cutter, cut on the server and exported as STL.
5
5
  *
6
6
  * This is the whole workflow, end to end through the API: the plate and a
7
- * cylinder at the tap-drill diameter are added as shapes, `project.cut`
8
- * subtracts the cylinder as one exact boolean, and `project.export` returns
7
+ * M8 thread cutter is added as a shape, `project.cut` subtracts it as one
8
+ * exact boolean, and `project.export` returns
9
9
  * the finished part as STL ready for a slicer. Nothing is left for the editor.
10
10
  *
11
- * The hole is the tap drill rather than the thread form: tap it after
12
- * printing. A `kind: "thread"` cutter is stored as a mesh, and the server's
13
- * exact boolean cannot cut that mesh today.
11
+ * The thread cutter includes its core, so it removes the bore and helical
12
+ * thread form in one operation.
14
13
  *
15
14
  * `replace`, because a part is something you iterate on: a second run gives
16
15
  * one plate with the new hole, not a second plate beside the first.
17
16
  *
18
17
  * @type {import("@constructorfleet/sketchforge3d").MacroDefinition<{
19
- * drill: number, width: number, depth: number, thickness: number, offset: number, out: string,
18
+ * size: number, width: number, depth: number, thickness: number, offset: number, out: string,
20
19
  * }>}
21
20
  */
22
21
  export default {
23
- name: "Tap-drill plate",
24
- description: "A plate drilled for a tap, cut on the server and exported as STL.",
25
- project: { mode: "replace", name: "Tap-drill plate" },
22
+ name: "Tapped plate",
23
+ description: "A plate cut with an M8 thread cutter and exported as STL.",
24
+ project: { mode: "replace", name: "Tapped plate" },
26
25
  params: {
27
- /** Tap-drill diameter in mm: 6.8 is the drill for an M8 x 1.25 tap. */
28
- drill: 6.8,
26
+ /** Metric thread size; the cutter removes its matching thread form. */
27
+ size: 8,
29
28
  width: 60,
30
29
  depth: 40,
31
30
  thickness: 8,
@@ -39,24 +38,24 @@ export default {
39
38
  const { shapes } = await project.addMany([
40
39
  { kind: "box", name: "Plate", width: params.width, depth: params.depth, height: params.thickness },
41
40
  {
42
- kind: "cylinder",
43
- name: `${params.drill} mm tap drill`,
44
- width: params.drill,
45
- depth: params.drill,
46
- // Longer than the plate and started below it, so it leaves no skin.
47
- height: params.thickness + 2,
41
+ kind: "thread",
42
+ name: `M${params.size} tapped hole`,
43
+ size: `M${params.size}`,
44
+ // Match the plate thickness: longer helical meshes can exceed the
45
+ // server kernel's STL importer limits for boolean cutters.
46
+ length: params.thickness,
48
47
  x: params.offset,
49
- elevation: -1,
48
+ elevation: 0,
50
49
  },
51
50
  ]);
52
- const [plate, drill] = shapes;
53
- if (!plate || !drill) throw new Error("Expected a plate and a drill.");
51
+ const [plate, thread] = shapes;
52
+ if (!plate || !thread) throw new Error("Expected a plate and a thread cutter.");
54
53
 
55
- // Named operands: the drill need not be marked `hole: true` to be cut away.
56
- const cut = await project.cut({ solidIds: [plate.id], holeIds: [drill.id] });
57
- log(`drilled ${params.drill} mm through the plate: ${cut.triangles} triangles`);
54
+ // Named operands: the thread need not be marked `hole: true` to be cut away.
55
+ const cut = await project.cut({ solidIds: [plate.id], holeIds: [thread.id] });
56
+ log(`tapped M${params.size} through the plate: ${cut.triangles} triangles`);
58
57
 
59
- const stl = await project.export({ format: "stl", shapeIds: [cut.shape.id], name: "tap-drill-plate" });
58
+ const stl = await project.export({ format: "stl", shapeIds: [cut.shape.id], name: "tapped-plate" });
60
59
  if (params.out) {
61
60
  await writeFile(params.out, stl.data);
62
61
  log(`wrote ${stl.bytes} bytes to ${params.out}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructorfleet/sketchforge3d",
3
- "version": "1.24.1",
3
+ "version": "1.26.0",
4
4
  "description": "Typed client and macro runner for the SketchForge REST API.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "author": {
@@ -19,7 +19,7 @@
19
19
  "client"
20
20
  ],
21
21
  "dependencies": {
22
- "@constructorfleet/sketchforge-engine": "1.24.1",
22
+ "@constructorfleet/sketchforge-engine": "1.26.0",
23
23
  "fflate": "^0.8.3",
24
24
  "sharp": "^0.35.5"
25
25
  },