3D Files Preview

VS Code extension for CAD-style 3D preview of mesh files and OpenSCAD.
Install from the VS Code Marketplace: niradler.3d-files-preview.
Open stl / obj / fbx / dae / 3ds / 3mf and you get a Z-up viewer with an XY print-bed grid. Open .scad and it stays a text editor; a side panel tessellates through the OpenSCAD CLI when you hit Render.
Not a fork of vscode-3dviewer. Same problem, CAD-oriented UI.
Features
- Mesh files open in a custom readonly 3D editor (Text Editor still available via Open With)
.scad stays text; Render Preview runs OpenSCAD once (no save/live rebuild)
- OpenSCAD mouse: LMB orbit, RMB drag pan, RMB click menu, scroll zoom
- Views: Fit, Front (+Y), Top (+Z), Right (+X), Iso
- Shading: Shaded / Edges / Wireframe; 3MF file colors on by default
- Hover inspect: name, size (tooltip only while hovering)
- Move / Rotate a part, then Drop to bed to sit it on Z = 0 (keeps XY)
- Refresh re-tessellates
.scad or reloads a mesh file
- Right-click the model (click, not drag — drag still pans): Copy dimensions, Copy point…, Copy for chat…, Insert in SCAD…, Go to SCAD, Clear pin
- Copy dimensions copies W × D × H of the part under the click. Items with … switch to a crosshair; click a face to see a yellow pin, then copy or insert. Esc or Clear pin removes it.
- Go to SCAD jumps to
// @id, module, or // @cad-pick (QuickPick when the mesh has no names)
Requirements
- VS Code 1.85+
- Node 22+ (to build)
- OpenSCAD on PATH, or set
cadPreview.openscadPath (default: C:\Program Files\OpenSCAD\openscad.exe)
[!NOTE]
OpenSCAD 2021 writes STL. STL has no part names and no color, so a .scad preview is gray and Go to SCAD falls back to QuickPick. Named jump and file colors work on examples/colors.3mf (same basename as examples/colors.scad). Mark modules with // @id name so a click can land on the right line.
Run from source
npm install
npm test
npm run typecheck
npm run compile
Press F5 (Run Extension). In the Extension Development Host:
- Open
examples/colors.3mf — red / green / blue parts, file materials on
- Right-click a colored part → Go to SCAD jumps to
examples/colors.scad
- Right-click a part → Copy dimensions copies
W × D × H mm. Right-click → Copy for chat… → crosshair → click a face
- Open
examples/colors.scad → right-click Render Preview (or the title-bar preview icon)
Command Palette: CAD Preview: Render Current File. Explorer and editor context menus also have Render Preview.
Settings
| Setting |
Default |
Purpose |
cadPreview.openscadPath |
C:\Program Files\OpenSCAD\openscad.exe |
OpenSCAD executable used to tessellate .scad files |
Spawn is always argv (never a shell string). Working directory is the .scad file’s folder.
Examples
| File |
What it shows |
examples/cube.stl / examples/cube.scad |
Centered 20 mm cube |
examples/colors.3mf / examples/colors.scad |
Named colored parts + SCAD jump |
examples/bad.scad |
OpenSCAD error overlay |
Development
Host and webview are separate esbuild bundles in dist/. Tests are Vitest next to the pure modules (src/*.test.ts).
npm run watch
Agent notes and locked product decisions live in AGENTS.md.