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.0.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.0-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cadquery_web_viewer-1.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 b0f001d0beb4f5fb384f40c79791527b6d3eda9f89ef2d34a34faeb23ca088d6
MD5 c864af025c7b30d94cdb4cf1324d540f
BLAKE2b-256 f81db198405c4b68f423c71f24b200f9b37cdaeb4c1c8da60ec91be23fe2b15d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cadquery_web_viewer-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02efa6f4ff9919bcfc6a543c5904d5a26043ff40ebe9417a8188da494ca8d8c9
MD5 a6a2b0acae653964669c62736e151e58
BLAKE2b-256 f2124419e77b285488e102369ec431e8930e55ec5885837dee1a745b92c92d2a

See more details on using hashes here.

Provenance

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