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-1.1.1.tar.gz (262.4 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-1.1.1-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cadquery_web_viewer-1.1.1.tar.gz
  • Upload date:
  • Size: 262.4 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-1.1.1.tar.gz
Algorithm Hash digest
SHA256 fd149eb1cc9de3ee2884f94d0b7ce96d2d92ea551936948e20637c2ab1ddf4ec
MD5 6ae67d79264d4174622abf19e7e10e4d
BLAKE2b-256 e671b45fdb857053759f6e715644a608de2378a6d5779baa00d493f0b5df68dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for cadquery_web_viewer-1.1.1.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-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cadquery_web_viewer-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a9d1402bbe893500634d1d6d86a7e2a1c86469e082958d58871e2742fb6a9140
MD5 7b299c7cf011a7a4e021e0d24d4e9b50
BLAKE2b-256 921b8f8012d0f2d4a122ac15910fac0e825ae5d1aa62fafa6b211606cbe1c168

See more details on using hashes here.

Provenance

The following attestation bundles were made for cadquery_web_viewer-1.1.1-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