@leverege/tpi-viz
v0.2.6
Published
3D scene viewer for TPI manufacturing data — renders blade geometry, PTZ cameras, defects, ply layers, and flows. Exports mountViewer()/destroy() for embedding (e.g. an Imaginarium React route); also runs standalone.
Readme
@leverege/tpi-viz
3D scene viewer for TPI manufacturing data. Renders blade geometry, PTZ
cameras, defects, ply layers, and flows from JSON scene files written by
tpi-scripts-py (Python).
This is a sibling package inside the tpi-scripts-py repo. The Python
side writes scene data + image assets into work_dir/scenes/<name>/. This
package's dev server mounts that directory at /scenes/* so the viewer
can fetch any scene by name.
Dev loop (the normal flow)
cd packages/tpi-scripts-py/tpi-viz
yarn install
yarn dev # vite dev server on http://localhost:5173Leave that running. In another terminal generate a scene:
cd packages/tpi-scripts-py
python -m scripts.visualize.defects <SA_JOB_ID>
python -m scripts.visualize.plylayers <SA_JOB_ID>
python -m scripts.visualize.ptz_camera <CAMERA_ID>
python -m scripts.flow.viewer --shell <SHELL_ID>Each writes work_dir/scenes/<name>/scene.json (plus sibling image dirs
when relevant) and prints the URL to open:
http://localhost:5173/?scene=<name>Refresh the page after re-running the script to see new data — no Python re-render, no rebuild.
Hitting http://localhost:5173/ with no ?scene= shows a list of
available scenes scraped from the dev server's directory listing.
How it works
vite.config.jsmounts<repo>/work_dir/scenes/at/scenes/*via asirvmiddleware.src/main.jsreads?scene=<name>from the URL, sets<base href="/scenes/<name>/">so relative paths inscene.json(images/foo.jpg,overlays/bar.png) resolve under the scene's dir, then fetches/scenes/<name>/scene.jsonand renders.- The viewer is a single-page app built with Three.js +
@leverege/ptz-camera.
Production build
yarn build # writes dist/index.html (single self-contained file)Useful for shipping the viewer somewhere. The dev-server scene loading
still works against the built artifact if it's hosted with /scenes/*
mapped the same way.
