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

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 -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.

Evidence

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

Source

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

Source

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

Source

  • Record date: 2026-10-15T11:56:08.818Z