React + Vite application that visualizes 3D models exported from Onshape using Three.js via @react-three/fiber.
- Upload GLB, GLTF, OBJ, or STL files and preview them instantly.
- Auto-centering and auto-scaling based on the model bounding box.
- PBR-ready lighting, HDRI-style environment, shadow-catching ground plane.
- Smooth OrbitControls with camera reset.
- Loading overlay to indicate progress.
- Parts inspector panel that lists every mesh/component with editable colors.
- Placeholder
example-model.glbbundled inpublic/so the viewer always boots with content.
npm install
npm run devThen open the URL printed in the terminal (usually http://localhost:5173).
- Export your Onshape part/assembly as GLB/GLTF/OBJ/STL.
- Drag the file into the upload dropzone or click “Browse files”.
- Interact with the model using OrbitControls (scroll to zoom, left-drag to orbit, right-drag to pan).
- Use the “Reset Camera” button anytime to snap back to the default view.
src/
components/
Canvas3D.jsx # Three.js canvas, lighting, controls, auto-normalization
ModelLoader.jsx # File upload UI / drag-and-drop
utils/
modelLoaders.js # GLB/GLTF/OBJ/STL loader helpers
App.jsx # Application shell + layout
main.jsx # React entry point
styles.css # Global styles + layout
public/
example-model.glb # Placeholder model visible on first load
Feel free to replace public/example-model.glb with any other default asset. Just keep the filename consistent or update the path inside src/App.jsx.