@rulecad/printcheck 0.3.2 → 0.4.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
@@ -1,7 +1,7 @@
1
1
  # @rulecad/printcheck
2
2
 
3
3
  Is this mesh printable on an FDM printer? Hand it triangles and your printer's limits; get back findings in plain
4
- words. No dependencies; browsers and Node 20+.
4
+ words. No dependencies; browsers and Node 22.13 or later.
5
5
 
6
6
  ```js
7
7
  import { check } from '@rulecad/printcheck';
@@ -20,7 +20,12 @@ What it checks:
20
20
 
21
21
  - **Fits the bed** (`bed`, mm) and **sits on it**: lowest point at z = 0, with faces flat on the bed.
22
22
  - **Overhangs** steeper than `overhang` degrees from vertical (with half a degree to spare: a boolean tips a 45°
23
- chamfer by hundredths of a degree).
23
+ chamfer by hundredths of a degree). This measures the sloped faces; flat undersides are left to the checks below,
24
+ and the tick says so ("no sloped overhangs past 45°; flat undersides are checked on their own"). When the part is
25
+ sliced (`layer` given), the layers decide and the faces' figure is a note. Neither overhang check gives a tick when
26
+ a finding after it says part of the print needs support (a ledge, a bridge too wide, an underside or island in
27
+ mid-air): the tick becomes a note (`info`) that says so. The faces' tick becomes a note too when the sliced layers
28
+ lean past the limit.
24
29
  - **Inside out**: a mesh whose faces all point inwards (corners running clockwise seen from outside) fails as that,
25
30
  before anything else is read from it.
26
31
  - **Flat undersides above the bed**: each must start on something. Either it rests on a built-in **breakaway support**
@@ -28,7 +33,12 @@ What it checks:
28
33
  fits in the underside, measured to the edges held up by material below. An underside held by nothing starts in
29
34
  mid-air. One held on one side only (its supports all within a half turn of it, and a little), further out than a
30
35
  print line, is a **ledge**: nothing bridges it, each line is laid past the last in the air, and it droops (slant its
31
- underside in at 45° to the wall instead). What lies within a breakaway gap or two layers of the bed, or of a
36
+ underside in at 45° to the wall instead). A hole in an underside whose edge nothing holds, such as the ring round
37
+ the screw's hole in a counterbore opening on the bed, is a ledge too: no line is laid across the hole, and the line
38
+ round it hangs out from the held edge, so it reaches the ring's width. An underside that is a bridge taken whole,
39
+ its hole filled in (a nut slot's roof with the screw's hole up through it: lines run wall to wall past the hole), is
40
+ still a bridge, as wide as it is; so is a counterbore whose seat is no wider than `bridge`. A seat roofed over by a
41
+ layer printed across it (drilled out afterwards) is a bridge as wide as the seat. What lies within a breakaway gap or two layers of the bed, or of a
32
42
  surface below it, rests on it. Undersides within a layer of each other are one height; what starts in mid-air
33
43
  and what hangs as a ledge is said once per height, with how many and the worst, and where.
34
44
  Each underside is taken on its own (the faces at a height joined where they touch), and an edge is held wherever
@@ -42,6 +52,11 @@ What it checks:
42
52
  below within the overhang reach; a region with nothing under it is an island the printer would lay on air. Drawn
43
53
  on a grid of the print line (`line`), so slivers narrower than a line don't count. Also exported as `islands()`,
44
54
  with each island's pixels for whatever fixes it.
55
+ - **Overhang, as the slicer sees it**: the area of each layer lying out past what the layer below holds (at
56
+ `overhang` degrees and a line), and past what the layers 5 and 20 below allow, so a long lean is held near the
57
+ limit. The layer just over a flat underside that the checks above judge (a bridge, a ledge, a breakaway support)
58
+ is left out of it there, and only there: bridges in one place hide nothing anywhere else. A step of a slope
59
+ narrower than a line is not left out: the slope is this check's to judge.
45
60
  - **Closed solid**: every edge is matched by a face on the other side. T-junctions count as closed, and so do hairline
46
61
  seams narrower than `HAIRLINE` (0.01 mm), which booleans leave and no printer can resolve. Wider gaps are holes.
47
62
  - **One piece**: a loose piece would print as a stray bit or fall over. A cavity inside a part (its surface faces in)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulecad/printcheck",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "description": "Is this mesh printable? Bed fit, flat base, overhangs, bridges, breakaway supports and watertightness, for any FDM printer.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -22,7 +22,7 @@
22
22
  "stl"
23
23
  ],
24
24
  "engines": {
25
- "node": ">=20"
25
+ "node": ">=22.13"
26
26
  },
27
27
  "sideEffects": false,
28
28
  "repository": {
package/printcheck.d.mts CHANGED
@@ -33,16 +33,18 @@ export function check(polys: Face[], printer: Printer, { eps, parts, slice }?: {
33
33
  /**
34
34
  * The widest circle that fits in an underside, measured to its held-up edges (the bridge it makes).
35
35
  * @param {Face[]} polys @param {(edge: [Point, Point]) => boolean} [held] @param {Face[]} [under]
36
+ * @param {number} [bridge] the longest bridge the printer spans, mm (5): an underside with a hole in it that is no wider, hole and all, is a bridge
36
37
  * @returns {number} mm
37
38
  */
38
- export function widest(polys: Face[], held?: (edge: [Point, Point]) => boolean, under?: Face[]): number;
39
+ export function widest(polys: Face[], held?: (edge: [Point, Point]) => boolean, under?: Face[], bridge?: number): number;
39
40
  /**
40
41
  * How far an underside reaches out past its last support, held on one side only (a ledge in the air): mm, 0 if it is
41
42
  * held on both sides everywhere (a bridge), null if nothing holds it.
42
43
  * @param {Face[]} polys @param {(edge: [Point, Point]) => boolean} [held] @param {Face[]} [under]
44
+ * @param {number} [bridge] the longest bridge the printer spans, mm (5): an underside with a hole in it that is no wider, hole and all, is a bridge
43
45
  * @returns {number | null} mm
44
46
  */
45
- export function ledges(polys: Face[], held?: (edge: [Point, Point]) => boolean, under?: Face[]): number | null;
47
+ export function ledges(polys: Face[], held?: (edge: [Point, Point]) => boolean, under?: Face[], bridge?: number): number | null;
46
48
  /**
47
49
  * Open edges, sorted: real gaps, T-junctions (closed) and hairline seams (closed).
48
50
  * @param {Face[]} polys @param {number} [eps]
@@ -53,11 +55,12 @@ export function seams(polys: Face[], eps?: number): {
53
55
  tjunctions: number;
54
56
  hairlines: number;
55
57
  };
56
- export function islands(polys: any, { layer, overhang, line, firstGap, onLayer }?: {
58
+ export function islands(polys: any, { layer, overhang, line, firstGap, flats, onLayer }?: {
57
59
  layer?: number;
58
60
  overhang?: number;
59
61
  line?: number;
60
62
  firstGap?: number;
63
+ flats?: any[];
61
64
  }): {
62
65
  islands: any[];
63
66
  layers: number;