DEV Community

Ethan Tan
Ethan Tan

Posted on Edited on

Reading a STEP file's volume and weight in the browser: what actually happens

Correction (21 October 2026): The earlier text conflated a possible browser/WebAssembly implementation with CADProps, overstated what STEP files contain, and used an incorrect inch-to-millimetre volume factor. CADProps uploads files for server processing; it is not a local-only browser/WASM tool. This factual correction was prepared with AI assistance.

STEP (ISO 10303) files can carry different geometric representations. AP242 supports tessellated part geometry as well as B-Rep geometry. So "how much does this part weigh?" is a geometry question before it's a math question.

1. Parse and identify the representation. Open CASCADE compiled to WebAssembly is one possible browser implementation, not a description of CADProps. A display mesh and the underlying B-Rep are different representations. Mesh-based volume estimates depend on tessellation; valid closed B-Rep solid volume can be calculated independently of display tessellation. CADProps uses server processing for uploaded files.

2. Integrate the volume. For a valid closed, consistently oriented triangle surface bounding the intended solid, volume can be calculated by summing signed tetrahedra from the origin: V = Σ (v1 · (v2 × v3)) / 6. Check watertightness, orientation and self-intersections; an arbitrary positive sum is not proof of a valid solid.

3. Multiply by density. Steel ≈ 7.85 g/cm³, aluminium ≈ 2.70, PLA ≈ 1.24 are approximate density assumptions, not material specifications. Confirm the file's units instead of assuming millimetres. For volume in mm³, conversion to cm³ is /1000. A solid-material estimate is not the filament mass of an infilled print.

4. Gotchas. Summing component occurrences can double-count overlapping material; it is not the same as measuring their geometric union. Open surface shells do not establish an enclosed solid volume. One inch is exactly 25.4 mm: reading inch coordinates as millimetres makes lengths 25.4 times too small and volumes 25.4³ = 16,387.064 times too small.

FreeCAD's Shape.Volume is a geometry property, not a substitute for checking the shape's validity, units and component scope. Disclosure: I work on CADProps. The earlier phrase "built this way" was incorrect: CADProps uploads and processes files on a server. Do not upload confidential geometry without the owner's permission.

Top comments (0)