MCPcopy Index your code
hub / github.com/bohdanbirdie/react-stl-obj-viewer

github.com/bohdanbirdie/react-stl-obj-viewer @1.2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.2.0 ↗ · + Follow
24 symbols 42 edges 4 files 0 documented · 0% updated 5y ago1.2.0 · 2019-01-13★ 339 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

react-stl-obj-viewer

React components to view STL and OBJ models. Based on THREE.js and react-stl-viewer

Live Demo.

Example.

How to use

  1. Install the app

    • via npm npm install react-stl-obj-viewer --save
    • via yarn yarn add react-stl-obj-viewer
  2. Use OBJ or STL loader

    import {OBJViewer, STLViewer} from 'npm-react-component-starter'; 3. Pass props to viewers:

static propTypes = {
        className: PropTypes.string, // Class name for viewer wrapper
        url: PropTypes.string,       // Url for STL or OBJ model
        file: PropTypes.object,      // File object of STL or OBJ model, 
                                     // when passed *url* prop will be ingonred
        width: PropTypes.number,     // Width of rendered area 
        height: PropTypes.number,    // Height of rendered area
        backgroundColor: PropTypes.string, // Scene background color 
        modelColor: PropTypes.string,// Model color(textures unsupported)
        sceneClassName: PropTypes.string, // Class name for rendered canvas scene
        onSceneRendered: PropTypes.func,  // Callback for rendered scene ready
    };

Default props

static defaultProps = {
        backgroundColor: '#EAEAEA',
        modelColor: '#B92C2C',
        height: 400,
        width: 400,
        sceneClassName: '',
    };

Convert scene to screenshot

Simply get your element (canvas scene) by any selector and call .toDataURL("image/png") on it.


Core symbols most depended-on inside this repo

renderModel
called by 2
src/OBJViewer.js
renderModel
called by 2
src/STLViewer.js
constructor
called by 0
src/OBJViewer.js
componentDidMount
called by 0
src/OBJViewer.js
componentDidUpdate
called by 0
src/OBJViewer.js
onProgress
called by 0
src/OBJViewer.js
onLoad
called by 0
src/OBJViewer.js
onError
called by 0
src/OBJViewer.js

Shape

Method 20
Class 4

Languages

TypeScript100%

Modules by API surface

src/OBJViewer.js13 symbols
src/STLViewer.js11 symbols

For agents

$ claude mcp add react-stl-obj-viewer \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page