Web server and viewer for GLB/CAD preview (forked from Yet Another CAD Viewer)
Project description
CadQuery Web Viewer
Preview CadQuery or build123d models in your browser and refresh the view while you edit Python — without manually exporting meshes each time.
Place a screenshot or short GIF of the running viewer at
assets/screenshot.png. The image is referenced here so the README renders the hero once committed; until then GitHub will show a broken image. Open an issue if you'd like a starting screenshot grabbed from the live demo.
What you get
- Browser viewer for 3D models: orbit, zoom, measurements, clipping, transparency, and related viewing tools.
- glTF 2.0 / GLB — a standard mesh format many 3D tools understand. The UI is built around the web model-viewer component, so you get common material and lighting behavior in the browser.
- Live updates while you change geometry in Python (the app keeps a channel open so the page can refresh when you publish again).
- Optional disk cache for uploaded GLBs when you run the long-lived server — see Usage.
The API and packaging are meant to be a mostly drop-in replacement for Yet Another CAD Viewer (YACV). Package renames and choosing how Python talks to the viewer — embedded server, separate server process, or buffer-only (server_type) — are covered in Migrating from yacv-server / yacv-viewer; project history and upstream links are in Special thanks at the end of this file.
Table of contents
- Quick start
- What you get
- Documentation
- Examples in this repo
- Trust model
- Contributing
- Special thanks
Quick start
Requires Python 3.10 through 3.12 (see requires-python in pyproject.toml). Python 3.13 is blocked upstream by vtk==9.3.1 (transitively pinned via build123d → cadquery-ocp 7.8.x), which only ships wheels for cp310–cp312; this will lift when build123d adopts cadquery-ocp 7.9.3.1+.
Install with pip
The viewer package depends on build123d. The example below uses CadQuery, which is a separate install:
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install cadquery-web-viewer cadquery
While the venv is active, run cadquery-web-viewer or python -m cadquery_web_viewer.
Other install methods (pipx, uv tool, Docker): docs/install.md.
Preview a CadQuery box locally
The library starts a small local server and a browser tab. By default the process waits until you close the viewer tab, so short scripts do not exit before you inspect the model.
import cadquery as cq
from cadquery_web_viewer import show
box = cq.Workplane().box(10, 10, 10)
show(box)
More options (host, port, timeouts, multiple show() calls): docs/usage.md.
Same box with a remote server
In one terminal, keep the viewer running:
cadquery-web-viewer --host localhost --port 32323
In another terminal, with the same Python environment:
import cadquery as cq
from cadquery_web_viewer import show
box = cq.Workplane().box(10, 10, 10)
show(
box,
server_type="remote",
remote_options={"host": "localhost", "port": 32323},
)
Documentation
- Installation — pipx, uv tool, Docker, and other install paths
- Usage — long-lived server, cache,
show()options - HTTP API — Flask
/apiendpoints (SSE, GLB upload, static UI), trust model - Migrating from YACV
- Development
- Changelog
Examples in this repo
| Folder | Purpose |
|---|---|
examples/in-process/ |
Full build123d sample, show() with optional textures; with CI set, runs export_all("export") after the viewer closes (not run in GitHub Actions). |
examples/remote/ |
Same style of model sent with server_type="remote". |
Trust model
cadquery-web-viewer is intended for localhost or trusted networks only:
- The HTTP API serves CORS
Access-Control-Allow-Origin: *, so any origin may call it from a browser. PUT /api/object/<name>accepts a JSON body with aurlfield and the server fetches that URL (up to 50 MB) overhttp/https.- The Python runtime is plain
flask.Flask.run— there is no auth, rate limiting, or TLS.
For details and operational guidance, see SECURITY.md and the Trust model section of docs/api.md.
Contributing
See CONTRIBUTING.md for the dev loop, test/lint/typecheck commands, and PR conventions. Bug reports and feature requests are welcome on the issue tracker.
Special thanks
Yet Another CAD Viewer (YACV) by Yeicor and contributors is the original project: a web-based CAD and GLB viewer with a Python backend for live tessellation, hot reload, and static export. This repository is a hard fork, with credit to the original authors.
MIT License. Third-party notices: assets/licenses.txt.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cadquery_web_viewer-2.1.0.tar.gz.
File metadata
- Download URL: cadquery_web_viewer-2.1.0.tar.gz
- Upload date:
- Size: 306.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a75e83cc1bc74dae4196cb1d6464c5158f1444ed5669d118dc4ac98b01122a6c
|
|
| MD5 |
7d0e266bab7b16aed2a5ba4da3ccd9b3
|
|
| BLAKE2b-256 |
e9f9d3dc296766aab66c362a4f38be35fc4972cfae7680ca38025401bfbc6c60
|
Provenance
The following attestation bundles were made for cadquery_web_viewer-2.1.0.tar.gz:
Publisher:
release.yml on jimcortez/cadquery-web-viewer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cadquery_web_viewer-2.1.0.tar.gz -
Subject digest:
a75e83cc1bc74dae4196cb1d6464c5158f1444ed5669d118dc4ac98b01122a6c - Sigstore transparency entry: 1699504868
- Sigstore integration time:
-
Permalink:
jimcortez/cadquery-web-viewer@6adbd1c3d3f626074d14408d38ebbdf052b6375e -
Branch / Tag:
refs/tags/v2.1.0 - Owner: https://github.com/jimcortez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6adbd1c3d3f626074d14408d38ebbdf052b6375e -
Trigger Event:
push
-
Statement type:
File details
Details for the file cadquery_web_viewer-2.1.0-py3-none-any.whl.
File metadata
- Download URL: cadquery_web_viewer-2.1.0-py3-none-any.whl
- Upload date:
- Size: 42.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b4b8ca9b849ea192f641c68debd3c818560a3f71d2c29212200dc7d8f2ca779
|
|
| MD5 |
a1920e9a4cc2cf238fd39f804c5e7818
|
|
| BLAKE2b-256 |
86960c5ba5a325499970b78209bc04ef356c0cbcface7f20b109ae9f73744d3e
|
Provenance
The following attestation bundles were made for cadquery_web_viewer-2.1.0-py3-none-any.whl:
Publisher:
release.yml on jimcortez/cadquery-web-viewer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cadquery_web_viewer-2.1.0-py3-none-any.whl -
Subject digest:
9b4b8ca9b849ea192f641c68debd3c818560a3f71d2c29212200dc7d8f2ca779 - Sigstore transparency entry: 1699504965
- Sigstore integration time:
-
Permalink:
jimcortez/cadquery-web-viewer@6adbd1c3d3f626074d14408d38ebbdf052b6375e -
Branch / Tag:
refs/tags/v2.1.0 - Owner: https://github.com/jimcortez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6adbd1c3d3f626074d14408d38ebbdf052b6375e -
Trigger Event:
push
-
Statement type: