A viewer for OCP based Code-CAD (CadQuery, build123d) integrated into VS Code
TypeScript
408
1,310 commits
updated Sep 15, 2026
OCP CAD Viewer for VS Code is an extension to show CadQuery and build123d objects in VS Code via the three-cad-viewer viewer component.

A typical session is just a few lines of Python:
# build123d
from build123d import Box
from ocp_vscode import show
show(Box(1, 2, 3))
# CadQuery
import cadquery as cq
from ocp_vscode import show
show(cq.Workplane().box(1, 2, 3))
python and pip or uv pip/uv add available in the Python environment that will be used for CAD development.Notes:
Open the VS Code Marketplace, and search and install OCP CAD Viewer 4.1.0.
Afterwards the OCP viewer is available in the VS Code sidebar:
![]()
Clicking on it shows the OCP CAD Viewer UI with the viewer manager and the library manager:

You have 3 options:
Prepare OCP CAD Viewer for working with build123d: Press the Quickstart build123d button.
This will install OCP, build123d, ipykernel (jupyter_client), ocp_tessellate and ocp_vscode via pip

Prepare OCP CAD Viewer for working with CadQuery: Press the Quickstart CadQuery button.
This will install OCP, CadQuery, ipykernel (jupyter_client), ocp_tessellate and ocp_vscode via pip

Ignore the quick starts and use the "Library Manager" to install the libraries via pip (per default, this can be changed in the VS Code settings). Install the needed library by pressing the down-arrow behind the library name (hover over the library name to see the button) in the "Library Manager" section of the OCP CAD Viewer sidebar. For more details, see here
Quickstart will also
Notes:
Do not use the OCP CAD Viewer logo to verify your OCP CAD Viewer settings! The logo overwrites all your settings in VS Code with its own settings to always look the same on each instance. Use a simple own model for checking your configuration
If you run into issues, see Troubleshooting
If you aren't using VS Code, you can install/use this extension via command line
Since this is a python extension, it is recommended to install/activate a virtual environment first, (e.g. uv, venv, poetry, conda, pip, etc)
uv based virtual environemnts:
source .venv/bin/activate # to activate the uv virtual environment
uv add ocp-vscode
pip for other virtual environments:
source .venv/bin/activate # to activate venv virtual environments
conda / mamba / micromamba activate <env> # to activate conda like virtual environments
pip install ocp-vscode
Notes:
pip or uv pip needs to be used.This extension is not available on the OpenVSX marketplace used by code-server. If you want to use it in code-server, you need to install it manually on the server running code-server:
ocp-cad-viewer-<version>.vsix file, e.g. using wget <url of vsix file>code-server --install-extension ocp-cad-viewer-<version>.vsix to install the extensionThe simplest way to run a Python script with OCP CAD Viewer is via VS Code's built-in Run menu:
from ocp_vscode import ... (or import ocp_vscode) is somewhere in the file — this matches the default OcpCadViewer.advanced.autostartTriggers and starts the viewer automatically when the file is opened.Ctrl-F5 / on macOS ⌃F5) for a plain run, or Run > Start Debugging (F5) to run under the Python debugger with visual debugging enabled (see docs/debug.md).show(...) call in your script is sent to the running viewer. If more than one viewer is open, show prompts in the terminal to choose which port to send to; call set_port(<port>) explicitly to skip the prompt.ocp_vscode entry to see the button).
The standalone viewer became its own package, ocp_viewer: pip install ocp_viewer, then python -m ocp_viewer starts a server reachable at http://127.0.0.1:3939. See OCP Viewer in the documentation, including the full CLI reference and how to run it in Docker.
After each step, the debugger checks all variables in locals() for being CAD objects and displays them with their variable name. See docs/debug.md for details.
The "Library Manager" in the OCP CAD Viewer sidebar lets you install or upgrade build123d, cadquery, ipykernel, ocp_viewer_core and ocp_tessellate from VS Code. See Viewer and Library Manager for the default install commands, placeholder substitution, and uv add override.
The full documentation lives at bernhard-42.github.io/ocp_viewer_docs — the VS Code CAD Viewer chapter covers this viewer's specifics; everything below is a deep link into it.
~/.ocpvscode, ~/.ocpvscode_standalone)show* commandsshow commandshow_object commandpush_object and show_objects commandshow_all commandset_viewer_config commandsave_screenshot, status, set_port, …)Camera, Collapse, Render, AnalysisTool, UiTab, Studio*)Testing:
make tests
Major release — the picking/selection architecture has been rewritten in three-cad-viewer, leading to chages for OCP CAD Viewer:
New picking system
THREE.Raycaster and the duplicated "exploded" scene graph with GPU id-based picking over a single compact scene graph, highlighting is GPU shader-driven.New mesh based Measurement
ocp_vscode) backendshape_type/geom_type are exact (taken from the tessellation face_types/edge_types).New status bar
r ≈ …, c ≈ …); edge start/end are the exact BRep vertices. Not enabled for GDS (dense, stacked layout data).Other Features
Performance
part_local, sketch_local, and line_Local support for build123d
part_local and line_local. The viewer can show the local versions llike it did in the past with sketch_local. As a consequence show_sketch_local (now deprecated) is renamed to show_localsFixes
a = All, v/e/f, s = Solid)S → I,s → S,a → AA → 0.render(); the incremental addPart/updatePart/removePart API keeps the tool.render() — each provided field wins and missing fields fall back to defaults.bp.part.color, bs.sketch.color, and bl.line.colorFor the change history see CHANGELOG
83 followers · starred Apr 2025
277 followers · starred Jun 2024
130 followers · starred Apr 2024
55 followers · starred Mar 2026
A viewer for OCP based Code-CAD (CadQuery, build123d) integrated into VS Code
TypeScript
408
1,310 commits
updated Sep 15, 2026
OCP CAD Viewer for VS Code is an extension to show CadQuery and build123d objects in VS Code via the three-cad-viewer viewer component.

A typical session is just a few lines of Python:
# build123d
from build123d import Box
from ocp_vscode import show
show(Box(1, 2, 3))
# CadQuery
import cadquery as cq
from ocp_vscode import show
show(cq.Workplane().box(1, 2, 3))
python and pip or uv pip/uv add available in the Python environment that will be used for CAD development.Notes:
Open the VS Code Marketplace, and search and install OCP CAD Viewer 4.1.0.
Afterwards the OCP viewer is available in the VS Code sidebar:
![]()
Clicking on it shows the OCP CAD Viewer UI with the viewer manager and the library manager:

You have 3 options:
Prepare OCP CAD Viewer for working with build123d: Press the Quickstart build123d button.
This will install OCP, build123d, ipykernel (jupyter_client), ocp_tessellate and ocp_vscode via pip

Prepare OCP CAD Viewer for working with CadQuery: Press the Quickstart CadQuery button.
This will install OCP, CadQuery, ipykernel (jupyter_client), ocp_tessellate and ocp_vscode via pip

Ignore the quick starts and use the "Library Manager" to install the libraries via pip (per default, this can be changed in the VS Code settings). Install the needed library by pressing the down-arrow behind the library name (hover over the library name to see the button) in the "Library Manager" section of the OCP CAD Viewer sidebar. For more details, see here
Quickstart will also
Notes:
Do not use the OCP CAD Viewer logo to verify your OCP CAD Viewer settings! The logo overwrites all your settings in VS Code with its own settings to always look the same on each instance. Use a simple own model for checking your configuration
If you run into issues, see Troubleshooting
If you aren't using VS Code, you can install/use this extension via command line
Since this is a python extension, it is recommended to install/activate a virtual environment first, (e.g. uv, venv, poetry, conda, pip, etc)
uv based virtual environemnts:
source .venv/bin/activate # to activate the uv virtual environment
uv add ocp-vscode
pip for other virtual environments:
source .venv/bin/activate # to activate venv virtual environments
conda / mamba / micromamba activate <env> # to activate conda like virtual environments
pip install ocp-vscode
Notes:
pip or uv pip needs to be used.This extension is not available on the OpenVSX marketplace used by code-server. If you want to use it in code-server, you need to install it manually on the server running code-server:
ocp-cad-viewer-<version>.vsix file, e.g. using wget <url of vsix file>code-server --install-extension ocp-cad-viewer-<version>.vsix to install the extensionThe simplest way to run a Python script with OCP CAD Viewer is via VS Code's built-in Run menu:
from ocp_vscode import ... (or import ocp_vscode) is somewhere in the file — this matches the default OcpCadViewer.advanced.autostartTriggers and starts the viewer automatically when the file is opened.Ctrl-F5 / on macOS ⌃F5) for a plain run, or Run > Start Debugging (F5) to run under the Python debugger with visual debugging enabled (see docs/debug.md).show(...) call in your script is sent to the running viewer. If more than one viewer is open, show prompts in the terminal to choose which port to send to; call set_port(<port>) explicitly to skip the prompt.ocp_vscode entry to see the button).
The standalone viewer became its own package, ocp_viewer: pip install ocp_viewer, then python -m ocp_viewer starts a server reachable at http://127.0.0.1:3939. See OCP Viewer in the documentation, including the full CLI reference and how to run it in Docker.
After each step, the debugger checks all variables in locals() for being CAD objects and displays them with their variable name. See docs/debug.md for details.
The "Library Manager" in the OCP CAD Viewer sidebar lets you install or upgrade build123d, cadquery, ipykernel, ocp_viewer_core and ocp_tessellate from VS Code. See Viewer and Library Manager for the default install commands, placeholder substitution, and uv add override.
The full documentation lives at bernhard-42.github.io/ocp_viewer_docs — the VS Code CAD Viewer chapter covers this viewer's specifics; everything below is a deep link into it.
~/.ocpvscode, ~/.ocpvscode_standalone)show* commandsshow commandshow_object commandpush_object and show_objects commandshow_all commandset_viewer_config commandsave_screenshot, status, set_port, …)Camera, Collapse, Render, AnalysisTool, UiTab, Studio*)Testing:
make tests
Major release — the picking/selection architecture has been rewritten in three-cad-viewer, leading to chages for OCP CAD Viewer:
New picking system
THREE.Raycaster and the duplicated "exploded" scene graph with GPU id-based picking over a single compact scene graph, highlighting is GPU shader-driven.New mesh based Measurement
ocp_vscode) backendshape_type/geom_type are exact (taken from the tessellation face_types/edge_types).New status bar
r ≈ …, c ≈ …); edge start/end are the exact BRep vertices. Not enabled for GDS (dense, stacked layout data).Other Features
Performance
part_local, sketch_local, and line_Local support for build123d
part_local and line_local. The viewer can show the local versions llike it did in the past with sketch_local. As a consequence show_sketch_local (now deprecated) is renamed to show_localsFixes
a = All, v/e/f, s = Solid)S → I,s → S,a → AA → 0.render(); the incremental addPart/updatePart/removePart API keeps the tool.render() — each provided field wins and missing fields fall back to defaults.bp.part.color, bs.sketch.color, and bl.line.colorFor the change history see CHANGELOG
83 followers · starred Apr 2025
277 followers · starred Jun 2024
130 followers · starred Apr 2024
55 followers · starred Mar 2026