Skip to main content

Module mesh

Module mesh 

Source
Expand description

Triangle meshes and point clouds for the 3D preview.

Pure-Rust readers for the common mesh, 3D-printing, visualisation and point-cloud formats, plus STEP B-rep tessellation with the truck CAD kernel (Apache-2.0). Every reader produces one Mesh in model coordinates; Mesh::encode writes the compact binary form that shared/js/viewer.js draws (TCMESH01, little endian).

Simulation results (VTK, VTU/VTP, CalculiX FRD, see crate::simmesh) additionally carry per-vertex scalar Fields that the viewer colours with a colour map; the section is optional and flagged, so older viewers and cached meshes keep working.

The readers are defensive: sizes are limited, indices are checked and a malformed file is an error, never a panic or an endless loop. The server still runs them in a separate process with a time limit (see preview).

Modules§

creo
PTC Creo parts (.prt.N): a preview mesh tessellated from the exact B-rep the file stores – Creo keeps no display tessellation of the body. See docs/src/research/creo-brep-preview.md. Assemblies (.asm.N) are put together from their parts (asm, services::assemblies).
render
A small software renderer for thumbnails: an isometric view of a Mesh with a z-buffer, flat shading and dark outlines where the depth jumps (silhouettes, steps), written as an RGBA PNG with a transparent background, so it sits on light and dark skins alike.
rhino
Rhino models (.3dm, versions 1 to 8).

Structs§

Field
A scalar result field on the vertices of a Mesh: a measured value, the magnitude of a vector or the von Mises stress of a tensor. Values that are not finite mark vertices without a value (drawn neutral).
Mesh
Triangles (or points when indices is empty) in model coordinates.

Constants§

MAX_FIELDS
Fields a mesh carries at most (the viewer offers them in a selector).
MAX_POINTS
Point clouds with more points are thinned out evenly.
MAX_STEP_BYTES
Larger STEP files are not previewed (the kernel needs several times the file size in memory and would not finish within the time limit).
MAX_TRIANGLES
Largest triangle count that is previewed.

Functions§

color_map
Colour of t in 0..=1 on the colour map (NaN = neutral grey).
read
Mesh formats the readers understand (ids as in cadformat).