/aps-viewer-react-demo

Simple React app with experimental wrapper for Autodesk Platform Services Viewer.

Primary LanguageTypeScript

aps-viewer-react-demo

Simple React application with an experimental wrapper for Autodesk Platform Services Viewer.

Running locally

Prerequisites

In order to test this application you'll need two things:

  • access token for accessing models in APS (only the viewables:read scope is needed)
  • URN of a model that's been converted to the SVF2 format

If you don't know how to get these, start by creating an APS application, install Visual Studio Code, and add our extension to it. The extension allows you to do various tasks within Autodesk Platform Services, incl. uploading models, translating them, and generating access tokens.

Steps

  • clone this repository
  • install Node.js dependencies: npm install
  • hard-code your access token and model URN in ./src/index.tsx
  • build the React app: npm run build
  • serve the built app locally: npm run preview
  • open your browser and go to http://127.0.0.1:4173/

Reusing the wrapper

If you want to use the <Viewer /> component in your own React application, copy the following two files to your source code:

And don't forget to add Viewer dependencies to your markup:

<link rel="stylesheet" href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.css">
<script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.js"></script>