Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Convert STEP to GLB and enforce a 3D asset budget

说明与用途

将STEP转换为GLB,并执行大小、三角形和节点预算检查,集成到CI中。

问题

Need to convert CAD STEP files to web‑friendly GLB meshes while ensuring the resulting asset stays within size, triangle, and node limits for efficient web delivery.

结果

The workflow produces a 3,356‑byte GLB with 8 triangles, 24 vertices, and 5 nodes from a two‑tetrahedra STEP fixture, and the budget check passes. When the byte budget is tightened to 3,000, the check fails with exit code 1, demonstrating the gate.

工作流

  • Install Node.js 22+ and Rust toolchain. Run npm init -y and npm install --save-exact [email protected]. Install glbscope with cargo install glbscope --version 0.3.0 --locked. Download a test STEP fixture. Run npx step2glb inspect sample.step to view assembly manifest. Run npx step2glb build sample.step --out sample.glb --preset web to generate GLB. Create budget.toml with max_bytes, max_triangles, max_nodes. Run glbscope --budget budget.toml sample.glb to validate against budget. Generate reports: glbscope --format markdown --budget budget.toml sample.glb > model-report.md and glbscope --json sample.glb > baseline.json. Use glbscope --baseline baseline.json sample.glb to detect regressions. Integrate budget check into CI as a build step.

证据

Use Node.js 22 or later and a current Rust toolchain:

来源

npx step2glb inspect sample.step npx step2glb build sample.step --out sample.glb --preset web

来源

The sample passes. To prove that the gate works, temporarily set max_bytes = 3_000 and run it again. The 3,356-byte sample fails with exit code 1

来源

  • 记录日期: 2026-10-15T11:56:08.818Z