An integrated, interactive 3D preview environment for OpenSCAD (.scad) files built for Visual Studio Code. Write your code and instantly visualize your 3D models with robust native UI toolbars, hardware-accelerated rendering, intelligent parameter tweaking, and seamless multi-format slicer integration.
- Model Colors: The default 3D rendering colors dynamically inherit from your active VS Code theme instead of the default OpenSCAD colors, while still respecting custom color declarations from your
.scadcode. - UI Theme: The user interface fully integrates with your active VS Code theme and the recommended standard UI elements.
- Camera Controls: Switch between perspective and orthographic camera modes.
- Visual Environments: Toggle between a familiar grid, an accurate 256mm² build plate, or a blank environment.
- Render Modes: Swap between solid, x-ray (translucent), and wireframe rendering.
- Colors: Although color declarations in your code are respected, you can toggle them globally, allowing you to switch between a colored and monochrome preview.
- Lighting: The scene includes both ambient and directional lighting, with togglable dynamic shadows.
- Cross Section: Slice through your model with an interactive cutting plane. Click the plane to select it, then use W to translate or E to rotate. Hold Ctrl while dragging to snap to 1 mm / 5° increments. Click anywhere outside the plane to deselect it.
The preview is rendered using Three.js, so many additions are possible in the future. Let me know if you have any suggestions!
- Live Parameter Controls: Automatically parses OpenSCAD variables and generates an interactive UI panel. Drag sliders, toggle booleans, and type values while the 3D model hot-reloads instantly.
- Override Tracking: Visually track which variables you've overridden in the UI, and click the "Revert" button to instantly fall back to the raw source code value.
- Save Custom Presets: Configure your perfect dimensions and save them as named preset groups (stored in local JSON files following the OpenSCAD specification) to seamlessly switch between configurations without code modifications.
- 1-Click Slicer Handoff: Fully configured to communicate with external applications. Click the Print button to instantly compile and send your model straight to your preferred software (PrusaSlicer, Bambu Studio, UltiMaker Cura, etc) without the need to store any intermediate files.
- Format Flexibility: Supports the universal
STLformat, as well as modern3MFfiles which preserve 3D model color data (requires OpenSCAD Nightly).More formats will be supported in the future.
- Dedicated Log UI: Eliminates terminal spam. The integrated Output panel natively intercepts the OpenSCAD compiler logs.
- Improved Error Tracing: Errors and warnings are distinctly highlighted. Multi-line compiler stack traces are grouped into clean collapsible panels for effortless debugging.
- Auto-Clear Workflow: Toggle the eraser icon to automatically flush outdated logs when you render a fresh frame.
- Built-in grammar definitions provide rich syntax highlighting out of the box.
This extension does not currently include a language server. For LSP support, I recommend combining this extension with the OpenSCAD Language Support extension by Leathong.
- Included developer snippets to accelerate your parametric scripting.
- OpenScad CLI: A local installation of OpenSCAD must be present on your system path.
It is recommended to install a recent nightly build of OpenSCAD to utilize the advanced
3mfrendering configuration (which preserves.scadmodel colors). The years old stable version (2021.01) only supports the monochromeSTLformat.
- Open any OpenSCAD (
.scad) file in Visual Studio Code. - Click the Preview Icon in the top-right editor title bar.
Alternatively, trigger
OpenSCAD: Show Previewin the Command Palette, or useCmd+Shift+V/Ctrl+Shift+V. - The interactive 3D viewer, parameter editor, and logs will dock directly inside your active IDE!
Customize the extension inside VS Code Settings (Cmd+,):
openscad.previewFormat: The protocol logic used bridging OpenSCAD to VS Code. Options are3mf(default) orstl.openscad.slicerExecutable: You can optionally provide the absolute system path to your slicing software. If left blank, your OS's default 3D model handler will be invoked.
- If you have any feedback, feature requests, or bug reports, please open an issue on the GitHub repository.
- If you would like to fork this project or contribute to it by creating a pull request, please feel free to do so! This project is provided under the MIT license.
- If you would like to support the development of this extension, please consider sponsoring me.
