Expand description
Preview images that CAD programs store inside their own files – the
thumbnails Autodesk Vault or Teamcenter show for native files (findings in
docs/src/research/cad-previews.md). Only the image is read, never the
geometry:
- Autodesk Inventor (
.ipt,.iam,.idw,.ipn) and Siemens Solid Edge (.par,.psm,.asm,.pwd,.dft) files are OLE compound files (MS-CFB); the preview is a PNG or a Windows DIB in one of their streams, normally the thumbnail property of the summary information (MS-OLEPS); - SolidWorks files up to 2014 are OLE files as well (
PreviewPNG), newer ones keep the PNG in a Deflate-compressedPreviewPNGsection of their own container (swpart); - NX parts keep a JPEG in their stream container (
nxpart). It is small and poor, so NX parts get a thumbnail rendered from their 3D preview instead (rendered,render_mesh); the JPEG stays the fallback for NX files without one (assemblies, drawings).
Every candidate is validated (PNG chunk structure and checksums, plausible
DIB header and sizes); the summary information wins, then streams named
like a preview, then the largest image. A DIB is served as BMP, which all
browsers and web views display. The layouts follow the documented
containers and open-source readers (e.g. cad-preview); they were not
tested with real files of every CAD program version.
Structs§
- Thumbnail
- An image found in a file.
Constants§
- CACHE_
VERSION - Bump to invalidate every cached thumbnail (2: SOLIDWORKS 2015+ previews, cached as “none” before; 3: NX parts rendered from their 3D preview instead of the embedded JPEG; 4: SOLIDWORKS parts and assemblies rendered from their 3D preview; 5: Rhino models; 6: Inventor parts and assemblies rendered from their 3D preview; 7: Inventor files with Zstandard segments, which kept their stored image before, #271; 8: Creo parts rendered from their 3D preview – both branches had used 7; 9: Creo assemblies rendered from their parts, turned Creo parts without a plane in the identity frame).
- RENDERED_
SIZE - Side of the thumbnails rendered from a 3D preview.
Functions§
- cached
- The thumbnail of a vault blob, cached next to the 3D previews
(
previews/ab/<sha256>.thumb.v<N>.png|bmp|jpg|none). - extract
- The preview image of a CAD file, if it has one.
- extract_
from extractfor any seekable reader (the fuzz targets pass bytes).- lookup
- A thumbnail already in the cache:
Some(None)when the blob is known to have none,Nonewhen it was never looked at. - render_
mesh - A PNG thumbnail drawn from a cached preview mesh (
TCMESH01). - rendered
- Formats whose thumbnail is rendered from their 3D preview instead of the image stored in the file: NX parts (the embedded JPEG is small and poor, the tessellation in the file is good), SOLIDWORKS and Inventor parts and assemblies, Rhino and SketchUp models, CATIA V5 parts and products, Creo parts, Fusion designs (one look for every CAD system) and stand-alone JT files (a visualisation format: the tessellation is the content). Files without a 3D preview (drawings, assemblies none of whose parts are in TeamCraft, Rhino models saved without meshes, SketchUp files without faces, Fusion files without a display scene) keep the stored image.
- store
- Stores a thumbnail (rendered or found in the file) in the cache.
- supports
- Formats whose files carry a preview image.