partforge 0.163.1 → 0.164.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/bin/cli.js CHANGED
@@ -559,14 +559,17 @@ function printVerify(v) {
559
559
  for (const c of v.cases) {
560
560
  console.log(` ${c.name}`);
561
561
  for (const ch of c.checks) {
562
- const icon = ch.status === "pass" ? "✓" : ch.status === "fail" ? "✗" : ch.status === "warn" ? "⚠" : "·";
563
- console.log(` ${icon} ${ch.subpart ?? "_view"} ${ch.metric} ${ch.expr} (${ch.message})`);
562
+ // A cost has a price (supports, a brim), so it gets `$`, not a warning sign.
563
+ const icon = ch.status === "pass" ? "✓" : ch.status === "fail" ? "✗" : ch.status === "warn" ? "⚠"
564
+ : ch.status === "cost" ? "$" : "·";
565
+ console.log(` ${icon} ${ch.subpart ?? "_view"} ${ch.metric} ${ch.expr} (${ch.message})${ch.accepted ? " (accepted)" : ""}`);
564
566
  // A measurement caveat prints whatever the verdict — "passed, but sampled"
565
567
  // is precisely the line a reader must not miss.
566
568
  if (ch.note) console.log(` note: ${ch.note}`);
567
- if (ch.status === "fail" || ch.status === "warn") {
569
+ if (ch.status === "fail" || ch.status === "warn" || ch.status === "cost") {
568
570
  if (ch.location) console.log(` at [${ch.location.map((n) => n.toFixed(1)).join(", ")}]`);
569
- if (ch.hint) console.log(` hint: ${ch.hint}${ch.pattern ? ` (${patternRef(ch.pattern)})` : ""}`);
571
+ // An accepted cost's remedy is moot: the user already chose to pay it.
572
+ if (ch.hint && !ch.accepted) console.log(` hint: ${ch.hint}${ch.pattern ? ` (${patternRef(ch.pattern)})` : ""}`);
570
573
  }
571
574
  }
572
575
  }
@@ -584,7 +587,8 @@ function printVerify(v) {
584
587
  : v.unevaluated?.length ? `verdict withheld (${v.unevaluated.length} check(s) not evaluated)`
585
588
  : v.declared ? "nothing verified (every declared check skipped)"
586
589
  : "nothing verified (no expectations declared)";
587
- console.log(` result: ${verdict}${w ? `, ${w} warning(s)` : ""}`);
590
+ const c = v.costs?.length ?? 0;
591
+ console.log(` result: ${verdict}${w ? `, ${w} warning(s)` : ""}${c ? `, ${c} cost(s)` : ""}`);
588
592
  }
589
593
 
590
594
  function printLint(r) {
@@ -1761,8 +1761,10 @@ const plate = k.shape2d(roundedRectProfile(40, 24, 4))
1761
1761
  .extrude({ h: 3 }); // sugar for k.extrude({ profile: …, h: 3 }); .revolve({ degrees }) too
1762
1762
  ```
1763
1763
 
1764
- A `Shape2D` also carries `.extrude({ h, twist?, scaleTop? })` and `.revolve({ degrees? })`
1765
- sugar (equivalent to the `k.extrude`/`k.revolve` forms), and `.regions()` — scission, which
1764
+ A `Shape2D` also carries `.extrude({ h, twist?, scaleTop?, bevel? })` and `.revolve({ degrees? })`
1765
+ sugar (equivalent to the `k.extrude`/`k.revolve` forms — every option is passed through, so
1766
+ `shape.extrude({ h, bevel: 1 })` bevels the rims exactly as `k.extrude` does; before partforge
1767
+ 0.163.2 the sugar dropped `bevel` and any unknown key without a word), and `.regions()` — scission, which
1766
1768
  returns each disjoint region as its own live `Shape2D` (vs `.toRegions()`, which returns raw
1767
1769
  `{outer, holes}` data).
1768
1770
 
@@ -1919,6 +1921,128 @@ that tessellates nothing, unlike `toRegions()`), `fillet(r, opts?)`, `chamfer(di
1919
1921
  opts?)`, `simplify(tolerance)`, `corners()`, `contains([x,y])`, `isEmpty()` (no
1920
1922
  regions left — see the vanishing-features rule above).
1921
1923
 
1924
+ ## Printed parts
1925
+
1926
+ 3D-printed parts: FDM (filament) and resin. Everything that is not a sheet
1927
+ part is printed, but a part says so on purpose by declaring its print process in
1928
+ `verify.process`; that one key arms the process's print checks below from the first
1929
+ build (all of them under FDM; bed fit and min wall under `resin`). Name
1930
+ the process the user will print with, never one written by habit: it is the declaration
1931
+ the checks, the fits and the advice all read.
1932
+
1933
+ ### Declaring the process
1934
+
1935
+ `process` is a profile id — `fdm-pla`, `fdm-petg` (the `fdm` process) or `resin` (the
1936
+ `resin` process) — or an inline object whose `base` names one and whose other keys
1937
+ override it: `{ base: "fdm-pla", bed: [256, 256, 256] }` for a bigger printer,
1938
+ `{ base: "fdm-pla", fits: { … } }` for a calibrated one (`fits` replaces the whole
1939
+ table). The profile numbers are in the `verify` section's table below. `accept` lists
1940
+ the costs the user has chosen to pay:
1941
+
1942
+ ```js
1943
+ verify: {
1944
+ process: "fdm-pla",
1945
+ accept: ["supports"], // the user chose supports for the organic body
1946
+ expect: { body: { holes: 1 }, _view: { overlaps: 0 } },
1947
+ }
1948
+ ```
1949
+
1950
+ ### Gates, costs and advisories
1951
+
1952
+ Every print check is in exactly one tier, decided by what the reading means:
1953
+
1954
+ | tier | checks | effect on `verify.ok` |
1955
+ | --- | --- | --- |
1956
+ | **gate** — a defect in any orientation | bed fit (`bbox` within `bed`), bed contact (`bedContactPct` ≥ 50) | fails it |
1957
+ | **cost** — a design choice with a price | overhang (`overhangArea`, id `supports`), footprint (`footprintPct` ≥ 10, id `footprint`) | never |
1958
+ | **advisory** — a reading that may not matter | min wall (`minWall`), `wall` | never; a warning |
1959
+
1960
+ A **gate** is fixed before the work is done: the piece cannot be printed this way
1961
+ whatever the user wants. A **cost** is a fact with a number and a location — mm² of
1962
+ overhang on a named piece and where it sits, or the share of a piece's silhouette on
1963
+ the bed that actually touches it — listed in `verify().costs` (never in `warnings`) with `status: "cost"`. It
1964
+ does not block a part still being shaped; it informs. Say each cost to the user once,
1965
+ in one sentence naming the piece, the number and the alternative ("the arm overhangs
1966
+ by 840 mm² and prints on supports; splitting it at the elbow avoids them"), and record
1967
+ the answer in `accept`. An **advisory** is read, and acted on only when
1968
+ it is real (a thin wall the user will hold, not a sliver at a facet seam).
1969
+
1970
+ **Accepting a cost is not switching it off.** An accepted cost is still measured and
1971
+ still listed in `costs`, with `accepted: true`, so the number stays visible; it is
1972
+ simply no longer something to raise. Switching a measurement off is the inline
1973
+ profile form, `{ base: "fdm-pla", overhang: null }` (or `footprint: null`,
1974
+ `bedContact: null`), and is for a part where the reading is meaningless, not unwelcome.
1975
+ A threshold the user named ("under 500 mm² of supports") is an `expect`:
1976
+ `overhangArea: "<=500"` — still a cost, reported in `costs` and never failing `ok`;
1977
+ the user's own limit keeps its meaning, so it is never marked accepted, whatever
1978
+ `accept` says (`accept` covers only the process's default check). Lint refuses an `accept` entry the process does not define
1979
+ (`verify-unknown-accept`): `fdm` defines `supports` and `footprint`; `resin` prints on
1980
+ supports and defines none.
1981
+
1982
+ **What arms what.** Under `fdm-pla`/`fdm-petg` the profile alone arms every check in
1983
+ the table except `wall`, which runs only where a sub-part declares a band; overhang fires past 1 mm². `resin` arms bed fit and min wall only. `orientation: "print"` declares that `build()`
1984
+ is the print pose (Z up, bed at the lowest Z); it arms nothing under a named profile,
1985
+ and with no profile at all it arms bed contact alone. An expectation you write yourself
1986
+ (`overhangArea`, `bedContactPct`, `footprintPct`) arms its own measurement under any
1987
+ profile or none; an `overhangArea` one is measured against 45° when the profile names no
1988
+ angle.
1989
+
1990
+ ### Orientation first
1991
+
1992
+ Decide each piece's print pose before its geometry. Put its largest flat face on the
1993
+ bed; when a piece has none, split it at its widest flat section so each half has one,
1994
+ and join the halves with pins or a dovetail. `build()` IS that pose — every check and
1995
+ every export reads the piece as built — and `views.assembly` poses it into place; a
1996
+ `print` view lays the pieces out on the bed beside each other (see "The
1997
+ `PartDefinition` contract"). A piece that reads well in the assembly and prints on its
1998
+ side is the most common source of both costs.
1999
+
2000
+ ### What costs supports and what does not
2001
+
2002
+ Overhangs past the profile's angle (45° from vertical on FDM) cost supports, and so
2003
+ do bridges longer than `bridge` (10 mm) and any cavity that opens downward — a socket
2004
+ under a ball, a pocket on the underside. The check counts every flat underside, a short
2005
+ bridge and the ceiling of a horizontal bore included, since a mesh cannot tell a bridge
2006
+ from a ceiling: a bridge within `bridge` prints without support, so tell the user that
2007
+ rather than redesign it. Faces within 45° of
2008
+ vertical do not cost supports: a chamfer under a ledge instead of a square step, a
2009
+ teardrop bore (a round hole with a 45° peak on top) instead of a round one. Faces on
2010
+ the bed or within 1 mm of it are never counted, so a bottom-edge chamfer, or a small fillet, is
2011
+ free.
2012
+
2013
+ **Ball joints on FDM** are a split socket (two halves that clamp the ball and screw or
2014
+ pin together) or a pinned clevis, not a socket snapped over a sphere: the snap's inside
2015
+ is a downward cavity that prints on supports nobody can reach. Build the snap only when
2016
+ the user wants it and has accepted the supports.
2017
+
2018
+ ### Small features and scale
2019
+
2020
+ A feature thinner than the profile's `minWall` (1.2 mm PLA, 1.5 mm PETG, 0.6 mm
2021
+ resin) prints as noise or not at all. A part with a scale parameter is checked at both
2022
+ ends of it: add a preset at the smallest and the largest scale and name them in
2023
+ `verify.cases`, so the small end's pins and walls are measured rather than described
2024
+ in the control's label ("below 150 mm the pins get thin").
2025
+
2026
+ ### Fits
2027
+
2028
+ Size a mating feature from the profile's fit class — `press`, `push`, `slip`,
2029
+ `moving`, `printInPlace` — copied into `derive()` with a comment naming it
2030
+ (`// slip fit: fdm-pla 0.25`), and a horizontal bore enlarged by `holeUndersize`. A
2031
+ snap is a contact; its fit is `push` or `slip`. The numbers, and how a diametral fit
2032
+ becomes a `clearance` expectation, are in the `verify` section below.
2033
+
2034
+ ### First layer
2035
+
2036
+ The first layer squashes wider than drawn (elephant's foot): give a bottom edge that
2037
+ must mate or measure true a small 45° chamfer (about 0.4 mm). Keep the underside flat
2038
+ and lowest: a knuckle, pin or boss that dips below it lifts the flat face off the bed
2039
+ and fails bed contact ([piece-hovers-above-bed](ERROR-PATTERNS.md#piece-hovers-above-bed))
2040
+ — size a print-in-place knuckle tangent to the bed and give it a block down to
2041
+ z = 0. A piece resting on a point, a line or a curve is reported as a footprint cost
2042
+ ([piece-stands-on-nothing](ERROR-PATTERNS.md#piece-stands-on-nothing)): lay it on a
2043
+ flat face, add a pad, or record the user's brim with `accept: ["footprint"]`. Never
2044
+ emboss text on the underside; deboss it, or put it on a side or the top.
2045
+
1922
2046
  ## Sheet parts
1923
2047
 
1924
2048
  Laser-cut parts from flat stock — plywood, MDF, acrylic — for a laser cutter
@@ -4008,7 +4132,7 @@ runtime a throwing probe only degrades quietly to `{ error }`.
4008
4132
 
4009
4133
  **Verify block** — `verify-unknown-metric`, `verify-unknown-subpart`,
4010
4134
  `verify-bad-expr`, `verify-bad-pair-check`, `verify-unknown-process`,
4011
- `verify-unknown-orientation`,
4135
+ `verify-unknown-orientation`, `verify-unknown-accept`,
4012
4136
  `verify-expect-throws` (all errors). Note `_view` also accepts the pair-wise
4013
4137
  `contacts` / `clearance` / `held` keys, which are not scalar view metrics; they are
4014
4138
  validated by `verify-bad-pair-check`, matching `verify.js`'s own handling.
@@ -4173,7 +4297,8 @@ carries:
4173
4297
  from a sample rather than every triangle (see below); `overhangArea` sets one
4174
4298
  naming the steepest unsupported face's angle,
4175
4299
  - `location` — `[x, y, z]` in mm where the metric has one: `minWall` (thinnest
4176
- sample point), `overhangArea` (the largest unsupported face's centroid) and
4300
+ sample point), `overhangArea` (the largest unsupported face's centroid),
4301
+ `footprintPct` (the piece's lowest point; absent when its export-pose reading failed) and
4177
4302
  `overlaps` (the center of the first offending intersection's
4178
4303
  *bounding box* — a nearby indicator, not an exact point: when a pair overlaps in
4179
4304
  more than one place the bbox center can fall in the empty space between regions)
@@ -4188,7 +4313,8 @@ exists, e.g. the OCCT backend or min-wall measurement turned off, matching
4188
4313
  per triangle, which is unbounded work on a dense mesh, so past a sample budget
4189
4314
  it casts from a spread, deterministic subset instead — `minWallSampled` (boolean)
4190
4315
  and `minWallSamples` (`{ sampled, total }` or `null`) say whether that happened.
4191
- A part that opted into the overhang check (see the `verify` block) also carries
4316
+ A part checked for overhang (a profile carrying `overhang`, or an `overhangArea`
4317
+ expectation — see the `verify` block) also carries
4192
4318
  `overhangArea` (mm² of unsupported downward-facing surface, `null` when not
4193
4319
  checked or on an `exportable: false` sub-part), `overhangAngle` (the steepest such
4194
4320
  face, degrees from vertical) and `overhangAt` (that face's centroid); the report's
@@ -4198,7 +4324,13 @@ A part checked for bed contact (an FDM profile, see the `verify` block) carries
4198
4324
  when not checked or on an `exportable: false` sub-part), `bedContactArea` and
4199
4325
  `bedHoverArea` (mm² touching and hovering), `bedHoverGap` (how far above the bed the
4200
4326
  largest hovering face sits, `null` when nothing hovers) and `bedHoverAt` (its
4201
- centroid); the report's `measuredBedContact` says whether the pass ran.
4327
+ centroid); the report's `measuredBedContact` says whether the pass ran. The same
4328
+ pass reads `footprintPct` (the share of the piece's silhouette on the bed that actually
4329
+ touches it, in percent; `null` when not measured or the silhouette is empty) and
4330
+ `footprintAt`
4331
+ (the piece's lowest point; `null` when its export-pose reading failed), stamped by
4332
+ `measuredFootprint`; a profile carrying
4333
+ `footprint`, or a `footprintPct` expectation, arms the pass too.
4202
4334
  A sub-part that declares `wall` (see the `verify` section below) also carries
4203
4335
  `wall` — `{ value, location, band, members }` or `null`: the declared band's
4204
4336
  worst member, located, with the band it was measured against and how many rays
@@ -4302,10 +4434,11 @@ A part can declare how it should be checked, co-located with its schema, so
4302
4434
 
4303
4435
  ```js
4304
4436
  verify: {
4305
- process: "fdm-pla", // a DFM profile: fdm-pla | fdm-petg | resin, or an
4306
- // inline { base, bed:[x,y,z], minWall, overhang, bedContact, fits, holeUndersize, bridge } object
4307
- orientation: "print", // optional; ONLY with this is overhang checked — it says the
4308
- // part is laid out for its bed (Z up, bed at the lowest Z)
4437
+ process: "fdm-pla", // a DFM profile: fdm-pla | fdm-petg | resin, or an inline
4438
+ // { base, bed:[x,y,z], minWall, overhang, bedContact, footprint, fits, holeUndersize, bridge } object
4439
+ accept: ["supports"], // optional; the costs the user chose to pay (fdm: supports, footprint)
4440
+ orientation: "print", // optional; declares build() is the print pose (Z up, bed at
4441
+ // the lowest Z) — with no profile it arms bed contact
4309
4442
  cases: ["defaults", "M3"], // optional; default = defaults + every preset
4310
4443
  expect: { // design intent, by sub-part name (+ "_view")
4311
4444
  spacer: { holes: 1, bbox: "<=[60,60,60]", volume: "0.4..0.6cm3" },
@@ -4318,28 +4451,38 @@ verify: {
4318
4451
  ```
4319
4452
 
4320
4453
  **What the profile gives you:** a hard **bed-fit** gate (the view bbox must fit `bed`),
4321
- a **min-wall** warning, and — only for a part that also declares
4322
- `orientation: "print"` — an **overhang** warning: `overhangArea` is the mm² of
4454
+ a **min-wall** warning, and on the FDM profiles a **bed-contact** gate and two
4455
+ **costs** — overhang and footprint (below). A cost is never a failure: it is a design
4456
+ choice with a price, reported in `verify().costs` with its number, location and hint
4457
+ and `status: "cost"`, and `ok` ignores it. See "Printed parts" for the tiers and how
4458
+ to raise a cost with the user.
4459
+
4460
+ **Overhang — a COST, armed by the process.** `overhangArea` is the mm² of
4323
4461
  downward-facing surface steeper than the profile's `overhang` angle (45° from vertical
4324
4462
  on the FDM profiles; resin carries none, since it prints on supports), measured per
4325
4463
  sub-part in its print (export) pose — not as the view shows it — with the bed at that
4326
- pose's own lowest Z, and warned past 1 mm²; the reported location is where the face sits
4327
- in the view. The
4328
- opt-in is deliberate: a profile says what a process can print, the orientation key
4329
- says this part is laid out for it, and a part still being shaped, or one bound for a
4330
- different process, should not be nagged about its underside. Writing your own
4464
+ pose's own lowest Z; it is a cost past 1 mm², with cost id `supports`, and the
4465
+ reported location is where the face sits in the view. A profile carrying `overhang`
4466
+ arms it from the first build; `orientation` takes no part. Writing your own
4331
4467
  `overhangArea` expectation is the other way in — it arms the measurement by itself,
4332
- against the profile's angle or 45° when the profile names none, so a declared
4333
- expectation is never answered "unavailable". Two bands next to the bed are never
4468
+ against the profile's angle or 45° when the profile names none, and is also how a
4469
+ user's limit is spelled (`overhangArea: "<=500"`). Two bands next to the bed are never
4334
4470
  counted: the footprint itself, and faces whose centroid sits within 1 mm of the bed
4335
4471
  (the lower curl of a bottom-edge fillet or chamfer, which prints fine). A bridge (a
4336
4472
  flat underside spanning two supports) and the ceiling of a horizontal bore are
4337
- reported as overhangs — the mesh alone cannot tell a bridge from a ceiling — which
4338
- is why this is a warning and never a gate. Two more limits, stated: it is judged in
4339
- the DISPLAY pose, so a sub-part whose `assembly` pose stands it differently from how it prints (a lid that prints
4340
- flat beside its base) is measured as displayed, and `exportable: false` sub-parts
4341
- are skipped. Switch it off under an FDM profile with an inline
4342
- `{ base: "fdm-pla", overhang: null }`.
4473
+ reported as overhangs — the mesh alone cannot tell a bridge from a ceiling — so read
4474
+ the location before proposing a redesign. When a sub-part's `place()` cannot be
4475
+ trusted as a rigid pose (it queries its solid), the reading falls back to the DISPLAY
4476
+ pose, so such a piece is measured as the view shows it. `exportable: false` sub-parts
4477
+ are skipped.
4478
+
4479
+ **`accept` records the user's choice.** `accept: ["supports"]` says the user chose to
4480
+ print with supports: the overhang is still measured and still listed in `costs`, with
4481
+ `accepted: true`, and is no longer something to raise. That is a different thing from
4482
+ switching the measurement off, which is the inline `{ base: "fdm-pla", overhang: null }`
4483
+ (and `footprint: null`) for a part where the reading means nothing. `accept` holds cost
4484
+ ids, not metric names — `fdm` defines `supports` and `footprint`, `resin` none — and
4485
+ lint refuses any other entry (`verify-unknown-accept`).
4343
4486
 
4344
4487
  **Bed contact — a GATE, armed by the FDM profile alone.** Every exporter and slicer
4345
4488
  lays a printed piece on its lowest point. When that point is something small — a
@@ -4362,10 +4505,9 @@ its note says how far up it sits and how much area hovers versus touches. The fi
4362
4505
  almost always to trim the piece flat at the bed plane — cut away everything below
4363
4506
  z = 0 in its print pose — or to raise or shorten the lower feature so the flat face
4364
4507
  is the lowest; size a print-in-place knuckle so its cylinder is tangent to the bed
4365
- (diameter = 2 × its centre height) and give it a support block down to z = 0. Unlike
4366
- overhang, no orientation key is needed: an overhang is a design choice a part still
4367
- being shaped may not have made, but a hovering underside is a defect in whatever
4368
- orientation the piece exports. Resin prints on supports, so `resin` never checks it
4508
+ (diameter = 2 × its centre height) and give it a support block down to z = 0. It is a
4509
+ gate where overhang is a cost: an overhang is a design choice that prints on supports,
4510
+ but a hovering underside is a defect in whatever orientation the piece exports. Resin prints on supports, so `resin` never checks it
4369
4511
  unless you ask: your own `bedContactPct` expectation arms it under any profile, and
4370
4512
  `orientation: "print"` arms it on a part with no profile at all (both against 50%). A
4371
4513
  named profile otherwise decides alone. A recess meant to clear the
@@ -4375,6 +4517,23 @@ default stands, and a part that means it declares a lower `bedContactPct` (or
4375
4517
  `{ base: "fdm-pla", bedContact: null }` to switch it off). `exportable: false`
4376
4518
  sub-parts are not judged.
4377
4519
 
4520
+ **Footprint — a COST, armed by the FDM profile.** Bed contact passes a piece that
4521
+ stands on a point, a line or a curve, since nothing flat hovers; the first layer still
4522
+ has almost nothing to grip, and the piece tips or pulls loose unless it prints with a
4523
+ brim or a raft. `footprintPct` is the share of the piece's silhouette on the bed (its
4524
+ outline seen from below, in the same print pose) that actually touches it, read by bed
4525
+ contact's pass, in percent: a plate reads 100, and so do a tube on its rim, a frame of
4526
+ thin bars, spread pins and a bar laid diagonally, since each stands on all of its
4527
+ outline; a rod on a rounded tip reads about 0, a cylinder on its side a few percent
4528
+ (the facets along its lowest line), under the floor, and a wide piece balanced on a
4529
+ narrow foot reads low too. It is a cost below the profile's `footprint` (10%), with cost id
4530
+ `footprint`, located at the piece's lowest point
4531
+ ([piece-stands-on-nothing](ERROR-PATTERNS.md#piece-stands-on-nothing)). Lay the piece on
4532
+ a flat face or add a pad; when the user chooses the brim, `accept: ["footprint"]`
4533
+ records it. Your own `footprintPct` expectation arms it under any profile; `orientation`
4534
+ does not, and `{ base: "fdm-pla", footprint: null }` switches it off. `exportable: false`
4535
+ sub-parts are not judged.
4536
+
4378
4537
  **What the profile tells you.** Three more fields carry the numbers a mating
4379
4538
  feature needs. Nothing checks them; they are the one place the value is spelled,
4380
4539
  so `derive()` copies it with a comment naming the fit (`// slip fit: fdm-pla 0.25`).
@@ -4399,7 +4558,7 @@ an inline `{ base: "fdm-pla", fits: { … } }` replaces the whole table.
4399
4558
  **What `expect` gives you:** per-sub-part
4400
4559
  assertions on the facts `measure` already reports — `holes` (through-bores / genus),
4401
4560
  `volume`, `surfaceArea`, `triangleCount`, `bbox`, `watertight`, `minWall`,
4402
- `overhangArea`, `bedContactPct`, `wall` (a range — see below), `bounds` (the axis-aligned corner
4561
+ `overhangArea`, `bedContactPct`, `footprintPct`, `wall` (a range — see below), `bounds` (the axis-aligned corner
4403
4562
  positions, written in the same `{ min, max }` shape `measure` reports them — where
4404
4563
  the geometry sits, vs `bbox` which is only its size) and `centerOfMass` (`[x,y,z]`, the volume-weighted
4405
4564
  centroid; `null` for a degenerate/zero-volume sub-part); and `_view` assertions `bbox`,
@@ -4442,12 +4601,14 @@ verify: { expect: {
4442
4601
  } }
4443
4602
  ```
4444
4603
 
4445
- **Gates vs. warnings:** exact facts are **gates** (a failure sets a non-zero exit code);
4446
- `minWall` is computed (a ray/shot wall-thickness measurement) and reported as a
4447
- **warning** — it flags walls below the profile's minimum but never fails the build —
4448
- and so is `overhangArea` (see above). `bedContactPct` is a **gate** even though the
4449
- profile arms it (see above). `holes`/`watertight` are Manifold-only, so those
4450
- assertions **skip** on OCCT parts rather than fail.
4604
+ **Gates, costs and warnings:** exact facts are **gates** (a failure sets a non-zero
4605
+ exit code and `ok: false`), and so is `bedContactPct`, even though the profile arms it.
4606
+ `overhangArea` and `footprintPct` under a process are **costs**: listed in `costs`, never
4607
+ failing, `accepted` once `accept` names them — but an `overhangArea` or `footprintPct`
4608
+ you write in `expect` is still a cost, not a gate. `minWall` is computed (a ray/shot
4609
+ wall-thickness measurement) and reported as a **warning** — it flags walls below the
4610
+ profile's minimum but never fails the build. `holes`/`watertight` are Manifold-only, so
4611
+ those assertions **skip** on OCCT parts rather than fail.
4451
4612
 
4452
4613
  **A wall that must stay one thickness: `wall`.** `minWall` answers "is anything too
4453
4614
  thin"; `wall` answers "does this wall stay what I declared" — the question a bend, a
@@ -4553,8 +4714,8 @@ mass. A reference ghost (`exportable: false`) is left out entirely: it neither
4553
4714
  counts nor holds, since it is never printed (lint refuses one named as the base).
4554
4715
  A named base that is `enabled()`-off
4555
4716
  in a case skips that case; a name that exists nowhere throws, like a `contacts`
4556
- pair. It is an expectation, never a default, for the overhang reason: a part
4557
- still being shaped should not be nagged. Topological only — a part balanced on a
4717
+ pair. It is an expectation, never a default: a part still being shaped should not
4718
+ fail for pieces it has not joined yet. Topological only — a part balanced on a
4558
4719
  point passes — and the same OCCT caveat applies: a sub-part fully inside another
4559
4720
  reads as not touching there. A view with fewer than two printed sub-parts passes with nothing to hold. A pin or axle running in a clearance bore, or a print-in-place piece, touches nothing in the model and reads as floating: `held` is for assemblies whose pieces seat on each other, so leave it off when a piece is captured with running clearance (`fits.moving`, `fits.printInPlace`) and declare that pair's `clearance` instead. A quick lap answers it `unevaluated`.
4560
4721
 
@@ -210,6 +210,12 @@ Variant literals under this entry: `extrude: unknown bevel option`, `extrude: be
210
210
  - **Cause:** Something smaller than the piece's flat underside sits lower than it in the print pose — a horizontal knuckle or pin whose cylinder dips below the plate, a boss, or lettering embossed on the bottom — so exporters and slicers rest the piece on that feature and the flat face prints in mid-air.
211
211
  - **Fix:** Trim the piece flat at the bed plane (cut everything below z = 0 in its print pose), or raise or shorten the lower feature so the flat face is the lowest; size a print-in-place knuckle so its cylinder is tangent to the bed and give it a support block down to z = 0. A recess meant to clear the bed declares a lower `bedContactPct`. See [AUTHORING-PARTS.md](AUTHORING-PARTS.md) § "Self-verification (the `verify` block)".
212
212
 
213
+ ## piece-stands-on-nothing
214
+
215
+ - **Symptom:** A `footprintPct` cost from `verify` (in `verify.costs`, e.g. `0.42 not >= 10`) on a piece whose print pose rests on a point, a line or a curl — a sphere-tipped rod standing on its end, a cylinder lying on its side — while `bedContactPct` passes.
216
+ - **Cause:** The lowest point of the piece is not a flat face, so almost none of its silhouette on the bed actually touches it (a cylinder on its side reads a few percent, under the floor): the first layer has almost nothing to bond to, and the piece tips or pulls loose unless it prints with a brim, a raft, or in a different orientation.
217
+ - **Fix:** Lay the piece on its flat face in its print pose, add a flat foot or pad at its lowest point, or print it with a brim. When the user chose the brim, `verify.accept: ["footprint"]` records it and the cost reads accepted. See [AUTHORING-PARTS.md](AUTHORING-PARTS.md) § "Printed parts".
218
+
213
219
  ## expect-static-across-presets
214
220
 
215
221
  - **Symptom:** A `verify` exact gate (`holes`, `volume`, …) fails on SOME presets only — e.g. `✗ planter holes 1 (0 != 1)` on two cases while defaults pass — and the preview looks right for every preset.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "partforge",
3
- "version": "0.163.1",
3
+ "version": "0.164.1",
4
4
  "description": "Turn a declarative part definition into a parametric-CAD web app (three.js + Manifold/Replicad). Requires a Vite-based consumer.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -135,7 +135,7 @@ export const ROUTED_CAD_OPS = ["shell"];
135
135
  * @property {(tolerance:number) => Shape2D} simplify corner-preserving decimation/refit within tolerance
136
136
  * @property {() => {index:number,point:number[],interiorAngleDeg:number,convex:boolean,segTypes:string[]}[]} corners corner list (the positional order fillet/chamfer `{indices}` index into)
137
137
  * @property {(p:number[]) => boolean} contains is point [x,y] inside the shape (holes excluded)
138
- * @property {(o?:{h:number,twist?:number,scaleTop?:number}) => Solid} extrude sugar for k.extrude({profile:this,…})
138
+ * @property {(o?:{h:number,twist?:number,scaleTop?:number,bevel?:number|{bottom?:number,top?:number}}) => Solid} extrude sugar for k.extrude({profile:this,…}); every option is forwarded
139
139
  * @property {(o?:{degrees?:number}) => Solid} revolve sugar for k.revolve({profile:this,…})
140
140
  *
141
141
  * @typedef {Object} GeometryKernel
@@ -14,12 +14,17 @@ export function addShape2dSugar(s, { shape2d, extrude, revolve }) {
14
14
  // lifted and resolved by every boolean since — re-lifting them untrusted would
15
15
  // re-run profile validation on machine-produced geometry on every call.
16
16
  s.regions = () => s.toRegions().map((r) => shape2d.trusted(r));
17
- // .extrude({ h, twist?, scaleTop? }) / .revolve({ degrees? }) → Solid. Sugar for
18
- // k.extrude({ profile: shape, … }) / k.revolve({ profile: shape, … }). Passed as an
19
- // options object (not positional) so the kernel op's key/required-arg validation still
20
- // fires — e.g. a missing `h` throws "extrude: h is required" rather than silently
21
- // producing empty geometry.
22
- s.extrude = ({ h, twist, scaleTop } = {}) => extrude({ profile: s, h, twist, scaleTop });
23
- s.revolve = ({ degrees } = {}) => revolve({ profile: s, degrees });
17
+ // .extrude({ h, twist?, scaleTop?, bevel? }) / .revolve({ degrees? }) → Solid. Sugar for
18
+ // k.extrude({ profile: shape, … }) / k.revolve({ profile: shape, … }). Every option is
19
+ // forwarded as-is, so the kernel op's own key/required-arg validation fires: a missing
20
+ // `h` throws "extrude: h is required", an unknown key throws, and an option the kernel
21
+ // grows later (as `bevel` was) works here with no change. Never list the keys: a list
22
+ // silently drops whatever it leaves out. `profile` is refused — this shape is the profile.
23
+ const sugar = (op, fn) => (o = {}) => {
24
+ if (o.profile !== undefined) throw new Error(`Shape2D.${op}: don't pass profile — the shape you call .${op}() on is the profile`);
25
+ return fn({ ...o, profile: s });
26
+ };
27
+ s.extrude = sugar("extrude", extrude);
28
+ s.revolve = sugar("revolve", revolve);
24
29
  return s;
25
30
  }
@@ -7,7 +7,7 @@ import { SUBPART_METRICS, VIEW_METRICS, BOUNDS_FORM, teachableMetrics, sidesSpec
7
7
  import { PROFILES, ORIENTATIONS } from "../oracle/dfm-profiles.js";
8
8
  import { parseAssertion, bareVectorHint } from "../oracle/assert-dsl.js";
9
9
  import { suggest } from "../geometry/op-options.js";
10
- import { PROCESS_IDS } from "../process/registry.js";
10
+ import { PRINT_PROCESSES, PROCESS_IDS, printProcessFor } from "../process/registry.js";
11
11
  import { SHEET_DOC_ID } from "../sheet/constants.js";
12
12
 
13
13
  // Resolve `expect` to a plain object. The function form (p, d) => ({…}) is invoked
@@ -410,8 +410,41 @@ export const VERIFY_RULES = [
410
410
  const hint = safeSuggest(orientation, ORIENTATIONS);
411
411
  return [err("verify-unknown-orientation",
412
412
  `\`verify.orientation\` is ${describe(orientation)}, which is not a known orientation`,
413
- `Use ${ORIENTATIONS.map((o) => `"${o}"`).join(", ")}${hint ? ` — did you mean "${hint}"?` : ""} (declares the part is laid out for its print bed, arming the profile's overhang check), or omit the key.`,
413
+ `Use ${ORIENTATIONS.map((o) => `"${o}"`).join(", ")}${hint ? ` — did you mean "${hint}"?` : ""} (declares that \`build()\` is the print pose: Z up, bed at the lowest Z), or omit the key.`,
414
414
  "verify.orientation")];
415
415
  },
416
416
  },
417
+ {
418
+ // `verify.accept` lists cost ids the user accepted. verify() reads it but
419
+ // never validates it, so a typo would be silently ignored without this rule.
420
+ // A process that does not resolve is verify-unknown-process's finding, not ours.
421
+ id: "verify-unknown-accept",
422
+ run: ({ part }) => {
423
+ const verify = part?.verify;
424
+ if (verify?.accept == null) return [];
425
+ if (!Array.isArray(verify.accept)) {
426
+ return [err("verify-unknown-accept",
427
+ `\`verify.accept\` is ${describe(verify.accept)}, not a list of cost ids`,
428
+ "Write `accept` as an array of cost ids, e.g. `accept: [\"supports\"]`, or omit the key.",
429
+ "verify.accept")];
430
+ }
431
+ // With no print process resolved, a cost can still fire (an authored expectation,
432
+ // an inline profile with no base), so check against every print process's ids.
433
+ const proc = printProcessFor(verify.process);
434
+ const known = proc ? Object.keys(proc.costs) : [...new Set(PRINT_PROCESSES.flatMap((d) => Object.keys(d.costs)))];
435
+ const out = [];
436
+ verify.accept.forEach((id, i) => {
437
+ if (typeof id === "string" && known.includes(id)) return;
438
+ out.push(err("verify-unknown-accept",
439
+ `\`verify.accept[${i}]\` is ${describe(id)}, which is not a cost ${proc ? "this process" : "any print process"} defines`,
440
+ !proc
441
+ ? `No print process is declared; the cost ids any print process knows are: ${known.join(", ")}.`
442
+ : known.length
443
+ ? `Known cost ids for this process: ${known.join(", ")}.`
444
+ : "This process defines no acceptable costs; remove the entry.",
445
+ `verify.accept[${i}]`));
446
+ });
447
+ return out;
448
+ },
449
+ },
417
450
  ];