Skip to main content

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.

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

Documentation

Quick start

Requires Python 3.10 through 3.12 (see requires-python in pyproject.toml).

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},
)

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.

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".

Special thanks

Yet Another CAD Viewer (YACV) by Yeicor and contributors is the orginal 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

cadquery_web_viewer-2.0.0.tar.gz (267.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cadquery_web_viewer-2.0.0-py3-none-any.whl (38.9 kB view details)

Uploaded Python 3

File details

Details for the file cadquery_web_viewer-2.0.0.tar.gz.

File metadata

  • Download URL: cadquery_web_viewer-2.0.0.tar.gz
  • Upload date:
  • Size: 267.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cadquery_web_viewer-2.0.0.tar.gz
Algorithm Hash digest
SHA256 8199425fdd0921ca1604b5434c3a9e54a2e1aab7892a6c5375b0e6a5c02b89f6
MD5 048412a507bdf34fddd55d7a04a8f781
BLAKE2b-256 4648c7c4b7ce60628305b9a738604ab7753df01dcf8746618341efd7d649b4b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for cadquery_web_viewer-2.0.0.tar.gz:

Publisher: release.yml on jimcortez/cadquery-web-viewer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cadquery_web_viewer-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cadquery_web_viewer-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c602d71bed5afbfabb96868be09393cd6692bcc090374a07759697f5e5ba3993
MD5 0f32e958e977da82cac4177732851ea6
BLAKE2b-256 123360c917c2fa02d65bd15945533b5de3def4c105f4f4a66669b0d83411c04f

See more details on using hashes here.

Provenance

The following attestation bundles were made for cadquery_web_viewer-2.0.0-py3-none-any.whl:

Publisher: release.yml on jimcortez/cadquery-web-viewer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page