Convert STEP to GLB and enforce a 3D asset budget
Description and use
Convert STEP to GLB with size, triangle, and node budget enforcement, integrated into CI.
Problem
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.
Outcome
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.
Workflow
- Install Node.js 22+ and Rust toolchain.
Run
npm init -yandnpm install --save-exact [email protected]. Install glbscope withcargo install glbscope --version 0.3.0 --locked. Download a test STEP fixture. Runnpx step2glb inspect sample.stepto view assembly manifest. Runnpx step2glb build sample.step --out sample.glb --preset webto generate GLB. Createbudget.tomlwith max_bytes, max_triangles, max_nodes. Runglbscope --budget budget.toml sample.glbto validate against budget. Generate reports:glbscope --format markdown --budget budget.toml sample.glb > model-report.mdandglbscope --json sample.glb > baseline.json. Useglbscope --baseline baseline.json sample.glbto detect regressions. Integrate budget check into CI as a build step.
Evidence
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
- Record date: 2026-10-15T11:56:08.818Z