printbench 0.8.3 → 0.8.4

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
@@ -59,6 +59,7 @@ function onExported(payload: PrintBenchExportedPayload) {
59
59
  // payload.longestEdgeMm — 若导出时指定了目标边长缩放
60
60
  // payload.scaleAxis — 若按 X/Y/Z 轴缩放(最长边模式不带此字段)
61
61
  // payload.partIds / modelSize — 分件导出时带回写出的零件与缩放后整模尺寸
62
+ // payload.groundCenter — 若导出时置于地面中心
62
63
  }
63
64
  </script>
64
65
 
@@ -188,7 +189,7 @@ async function upload() {
188
189
  | -------------------- | ------------------------------------------------- | -------------------------------------------------- |
189
190
  | `ready` | — | 几何内核就绪 |
190
191
  | `error` | `string` | 可展示错误 |
191
- | `exported` | `{ action, format, fileName, blob, unit, size, longestEdgeMm?, scaleAxis?, scaleBasis?, partIds?, modelSize?, axis? }` | 网格导出完成。`size` 为本次 blob 内网格包围盒;分件且按整模缩放时带 `modelSize`;`partIds` 为实际写出的零件 |
192
+ | `exported` | `{ action, format, fileName, blob, unit, size, longestEdgeMm?, scaleAxis?, scaleBasis?, partIds?, modelSize?, groundCenter?, axis? }` | 网格导出完成。`size` 为本次 blob 内网格包围盒;分件且按整模缩放时带 `modelSize`;`groundCenter: true` 表示已贴地居中 |
192
193
  | `snapshot` | `{ action, format, fileName, blob, mime, width, height }` | 模型快照完成。`format` 为 `'png'` \| `'jpeg'` |
193
194
  | `report` | 审核报告对象 | 下载 JSON / HTML 审核报告时触发 |
194
195
  | `parts` | `{ id, index, name, initialSize, size, unit }[]` | 零件列表;`size` 为当前尺寸,`initialSize` 为导入时尺寸(无则为 `null`) |
@@ -207,7 +208,7 @@ async function upload() {
207
208
 
208
209
  | 方法 | 说明 |
209
210
  | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
210
- | `exportFile(options?)` | 不打开插件对话框。`action` / `format` / `unit` 同上;`longestEdgeMm` + `scaleAxis?` 等比缩放;`scaleBasis`: `'model'`(默认,整模比例)\| `'exportSet'`;`partIds` 只导出指定零件;`silent: true` 跳过确认。成功返回与 `exported` 相同的 payload。 |
211
+ | `exportFile(options?)` | 不打开插件对话框。`action` / `format` / `unit` 同上;`longestEdgeMm` + `scaleAxis?` 等比缩放;`scaleBasis`: `'model'`(默认,整模比例)\| `'exportSet'`;`partIds` 只导出指定零件;`groundCenter: true` 导出时贴地且 XZ 居中于原点(不改工作台);`silent: true` 跳过确认。成功返回与 `exported` 相同的 payload。 |
211
212
  | `exportSnapshot(options?)` | 按当前视角截取模型图(不含网格、手柄、切面)。`action`: `'download'` \| `'upload'`;`format`: `'png'`(默认)\| `'jpeg'`;`quality` 仅 JPEG。成功返回与 `snapshot` 相同的 payload。`customExport` 时不本地下载、不 POST。 |
212
213
  | `autoSplit(options?)` | 多零件接触面自动装配(≥2 件)。检测接触后一端保留凸起、一端挖槽,再加卡扣。`connector`: `'ballSnap'` \| `'sphere'` \| `'square'`(默认 `ballSnap` 爪扣);`connectorSize` 可选;`silent: true` 时不弹修复确认,未封闭则返回 `{ ok: false, needsRepair: true, repairPartNames }`。成功 `{ ok: true }`。 |
213
214
  | `getPartBounds()` | 同步返回与 `@parts` 相同结构的零件列表(含 `initialSize` / `size`)。无模型时为 `[]`。 |
@@ -299,7 +300,7 @@ JSON 结构:
299
300
  - **STL**:二进制;无单位字段,切片软件需与导出单位一致(推荐毫米)。单零件 `.stl`,多零件 `.zip`(每件一个 STL)。不含颜色。
300
301
  - **3MF**:自带毫米单位;每零件单独 object,并写入 `displaycolor`(零件打印色)
301
302
  - **GLB**:单文件多网格;零件打印色写入材质。无打印单位字段,坐标按导出单位解释。
302
- - **目标边长缩放**:导出对话框可选参考轴(最长边 / X / Y / Z)、缩放基准(整模 / 仅导出零件)并填「目标边长 mm」;可勾选「仅导出选中」。宿主:`exportFile({ longestEdgeMm, scaleAxis?, scaleBasis?, partIds? })`。先按毫米等比缩放,再按所选 `unit` 写出。按件循环且需可组装时用默认 `scaleBasis: 'model'`。
303
+ - **目标边长缩放**:导出对话框可选参考轴(最长边 / X / Y / Z)、缩放基准(整模 / 仅导出零件)并填「目标边长 mm」;可勾选「仅导出选中」「置于地面中心」。宿主:`exportFile({ longestEdgeMm, scaleAxis?, scaleBasis?, partIds?, groundCenter? })`。先按毫米等比缩放,再按 `partIds` 过滤,再可选贴地居中(相对**本次写出集合**的 AABB),再按所选 `unit` 写出。按件循环时 `groundCenter: true` 会把每件单独放到地面中心;缩放比例仍可用默认 `scaleBasis: 'model'` 保持可组装尺寸。
303
304
  - **快照**:PNG / JPEG。按当前相机截取模型,不含工作台网格、变换手柄、拆件切面与测量。下载或一键上传(同 `uploadUrl` / `customExport`)。嵌入预览用 `exportSnapshot()`。
304
305
 
305
306
  ### 快捷键
@@ -1,5 +1,5 @@
1
1
  import j from "jszip";
2
- import { h as w, r as R } from "./index-taUrTXAq.js";
2
+ import { h as w, r as R } from "./index-Cc4caqHB.js";
3
3
  function p(s, l) {
4
4
  return s.match(new RegExp(`\\b${l}\\s*=\\s*"([^"]*)"`, "i"))?.[1];
5
5
  }
@@ -1,6 +1,6 @@
1
1
  import { Group as w, Mesh as l, MeshStandardMaterial as u, DoubleSide as h, Color as c } from "three";
2
2
  import { GLTFExporter as p } from "three/examples/jsm/exporters/GLTFExporter.js";
3
- import { b as d } from "./index-taUrTXAq.js";
3
+ import { b as d } from "./index-Cc4caqHB.js";
4
4
  async function G(r, e, n) {
5
5
  const t = new w();
6
6
  t.name = "PrintBench", r.forEach((f, o) => {