Files
visualizer/README.md
T
Vignesh Suresh 29dfbf99a5 Visualizer 2
2026-06-06 20:43:01 +02:00

2.9 KiB

wired3d viewer

Interactive 3D viewer for the Beckhoff 5-axis metal-DED NC toolpaths produced by stl_slicer.py. It reads the machine NC dialect and renders a self-contained, offline-capable HTML page: a 3D toolpath scene (rapid moves + per-layer welds), an A/B tilt-angle chart, a statistics table, layer isolation, and a progressive-reveal print animation.

Layout

visualizer/
├── pyproject.toml            # package metadata + the `wired3d` console script
├── README.md
├── wired3d_viewer/           # the Python package
│   ├── __init__.py           # lightweight; no heavy imports
│   ├── __main__.py           # CLI: `python -m wired3d_viewer view|serve`
│   ├── parser.py             # NC dialect reader (standard library only)
│   ├── viewer.py             # NC Plotly figure builder + HTML writer
│   ├── server.py             # NC drag-and-drop local web front end
│   ├── stl_viewer.py         # STL mesh figure builder + HTML writer
│   ├── server2.py            # STL drag-and-drop local web front end
│   └── assets/
│       └── wired3d.avif      # logo, embedded into the HTML as a data URI

Install

pip install -e .          # installs plotly + numpy and the `wired3d` command

The package runs fine without installing too — just call the modules directly (see below). Only viewer/server need plotly + numpy; parser is pure standard library.

Usage

Render an NC file to a standalone HTML viewer:

python -m wired3d_viewer view path/to/part.nc     # writes <stem>_viewer.html
wired3d view path/to/part.nc                       # same, if installed

Start the drag-and-drop web front end (drop an .nc file or a folder onto the page):

python -m wired3d_viewer serve            # http://127.0.0.1:8765
python -m wired3d_viewer serve 9000       # custom port
wired3d serve                             # same, if installed

STL mesh viewer ("server 2")

View a raw .stl part in 3D before slicing — rotate/zoom with the mouse. Once a part is loaded a Slice & Visualize button (with layer-height / infill inputs) runs stl_slicer and shows the resulting toolpath with the NC viewer on the same page; "Back to mesh" flips back. (Per-coordinate direction vectors are the next feature and are not drawn yet.)

python -m wired3d_viewer view-stl path/to/part.stl   # writes <stem>_stl_viewer.html
python -m wired3d_viewer serve-stl                    # http://127.0.0.1:8766
python -m wired3d_viewer serve-stl 9001               # custom port
wired3d view-stl part.stl   /   wired3d serve-stl     # same, if installed

Parse only (no visualisation, no third-party deps):

from wired3d_viewer.parser import parse_nc, summarise
summarise(parse_nc("part.nc"))

Run the parser self-test:

python -m wired3d_viewer.parser