Skip to content

gitgreencoder/workflow-node.js-view.and.data.api

Repository files navigation

#Autodesk view and data API Node.js Basic Sample

##Description

A sample demonstrating how to load a model into web application with the Autodesk View & Data API. This web application has a basic Node.js server and JavaScript/HTML5 client

##Dependencies

Install Node.js on your machine and clone this repo. Download the project' dependencies using npm before running the app by running the following command

npm install

on the node.js console. This will install the following node.js modules in the project.

  • express
  • request
  • serve-favicon

This sample does not includes the workflow of uploading models. It depends on other workflow samples to upload models, get model URN. Please follow Setup/Usage Instructions.

##Setup/Usage Instructions

You can work with production or staging Autodesk View and Data environments. By default, the project is setup with the production server.

With the production server, you got 2 options to setup and run this sample.

Option A: Use upload tool online service to upload model.

  • The upload tool provides some existing models. Choose any one of them, or upload one of your own models with upload tool. The upload tool will generate a URN of the model that you need later.
  • Copy this URN in /www/views/index.js at line #18
var urnprod = 'your_urn_here';
node server.js

Option B: Use your own credentials and upload models on your account

credentials.ClientId = '<replace with clientId>';
credentials.ClientSecret = '<replace with clientSecret>';
var urnprod = 'your_urn_here';
  • Run the server from the Node.js console, by running the follwing command:
node server.js

To work with the staging environment, you need to use Option B.

credentials.ClientId = '<replace with clientId>';
credentials.ClientSecret = '<replace with clientSecret>';
var urnstg = 'your_urn_here';
  • In /www/views/index.js, around line #24, make sure the variable staging is true.
  • In /www/views/index.html (line $33 and #34), use viewer3D.min.js and style.css from the staging environment
<link type="text/css" rel="stylesheet" href="https://developer-stg.api.autodesk.com/viewingservice/v1/viewers/style.css"/>
<script src="https://developer-stg.api.autodesk.com/viewingservice/v1/viewers/viewer3D.min.js"></script>
  • Run the server from the Node.js console, by running the follwing command:
node server.js

License

That samples are licensed under the terms of the MIT License. Please see the LICENSE file for full details.

Written by

Written by Philippe Leefsma

About

A demo with the usage of viewer client in Node.JS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 82.0%
  • HTML 18.0%