PHP Hampshire – Portsmouth
Make the Web 3D
Adam Nagy
Senior Developer Evangelist
Autodesk
@AdamTheNagy
PHP Hampshire – Portsmouth
PHP Hampshire – Portsmouth
2d and/or 3d
PHP Hampshire – Portsmouth
WebGL and three.js
PHP Hampshire – Portsmouth
Autodesk Large Model Viewer
Add 3D viewing to your web application
http://autode.sk/m3w
PHP Hampshire – Portsmouth
Autodesk View & Data API
PHP Hampshire – Portsmouth
 Server & management API
 Upload and Translate files
 Access rights
 oAuth 2.0 - REST API
 WEB Client API
 Viewing technology based on THREE.js
 Embed and control the viewer into HTML5 applications
 Access document, manipulate objects, camera, …
 JavaScript API
2 API available
PHP Hampshire – Portsmouth
 ipt, neu, stla, stl, jt, skp, prt, dwf, sldasm,
step, dwg, zip, nwc, model, sim, stp, ste,
f3d, iges, dwt, catproduct, igs, sldprt, cgr,
3dm, sab, obj, cam360, exp, wire, ige,
rcp, dae, x_b, 3ds, rvt, g, sim360, iam,
asm, dlv3, x_t, session, xas, xpr, catpart,
stlb, nwd, sat, fbx, smb, smt, dwfx.
 More coming …
Supported formats
PHP Hampshire – Portsmouth
Getting Started
Server side
PHP Hampshire – Portsmouth
 http://developer.autodesk.com
Getting Started
PHP Hampshire – Portsmouth
PHP Hampshire – Portsmouth
Getting Started – Server/Management Workflow
PHP Hampshire – Portsmouth
 Header
Content-Type: application/x-www-form-urlencoded
 Body
client_id=xxxxxxxxxxxx
&client_secret=xxxxxxxxxxxx
&grant_type=client_credentials
 POST https://developer.api.autodesk.com/authentication/v1/authenticate
Step 2: Get your access token
PHP Hampshire – Portsmouth
 Header
 "Content-Type: application/json"
 "Authorization: Bearer xxxxxxxxxxxx"
 Body '{"bucketKey":"mybucket","policy":"transient"}'
 POST https://developer.api.autodesk.com/oss/v1/buckets
Step 3: Create a bucket
PHP Hampshire – Portsmouth
 Transient:
persists for only 24 hours
 Temporary:
persists for 30 days
 Persistent:
persists until it’s deleted
Bucket policy
PHP Hampshire – Portsmouth
 Header
 "Authorization: Bearer xxxxxxxxxxxxxxxx"
 "Content-Length: 308331"
 "Content-Type: application/octet-stream"
 Body
 File content
 PUT
https://developer.api.autodesk.com/oss/v1/buckets/{buc
ketkey}/objects/{objectkey}
Step 4: Upload a file
PHP Hampshire – Portsmouth
 Get the URN
 URN = Base64 encoded id
Upload response
PHP Hampshire – Portsmouth
 Header
 "Content-Type: application/json "
 "Authorization:Bearer xxxxxxxxxxxx“
 Body
 "{"urn":“{base64 encoded id in previous step}"}“
 POST
https://developer.api.autodesk.com/viewingservice/v1/r
egister
Step 5: Register your file for viewing
PHP Hampshire – Portsmouth
 Header
 "Authorization: Bearer xxxxxxxxxxxx"
 GET https://developer.api.autodesk.com/viewingservice/v1/{URN}
 Note that even if only some parts have a status of
“complete”, you can still start viewing the object in the
viewer.
Check progress
PHP Hampshire – Portsmouth
 Header
 "Authorization: Bearer xxxxxxxxxxxx"
 GET
https://developer.api.autodesk.com/viewingservice/v1/t
humbnails/{URN}
Thumbnail
PHP Hampshire – Portsmouth
http://fast-shelf-9177.herokuapp.com/
PHP Hampshire – Portsmouth
Getting Started
Client side
PHP Hampshire – Portsmouth
 The A360 Viewer requires a WebGL canvas compatible
browser, such as:
 Chrome 18.0+
 Opera 15.0+
 Firefox 4.0+
 Safari 8.0+
 Internet Explorer 11.0+
 iOS 8.0 started supporting it too
Compatibility
PHP Hampshire – Portsmouth
http://caniuse.com/#feat=webgl
The numbers in the boxes are the version numbers of given product
PHP Hampshire – Portsmouth
 Create a html5 page or web application
 Add reference to CSS & JavaScript
<link rel="stylesheet"
href="https://developer.api.autodesk.com/viewingservice/v1/viewers
/style.css" type="text/css">
<script
src="https://developer.api.autodesk.com/viewingservice/v1/viewers/
viewer3D.min.js"></script>
Load URN in JavaScript viewer
PHP Hampshire – Portsmouth
 Add a html container
<body onload="initialize()">
<div id="viewer"></div>
</body>
 Must be a div
Load URN in JavaScript viewer
PHP Hampshire – Portsmouth
 Initialize Viewer
Load URN in JavaScript viewer
function initialize () {
var options = { "document" : "urn:XXXXXXXXXX“ } ;
var viewerElement = document.getElementById ("viewer") ;
var viewer = new Autodesk.Viewing.Viewer3D (viewerElement, {}) ;
viewer.initialize () ;
Autodesk.Viewing.Initializer (options, function () {
loadDocument (
viewer,
getURLParameterByName ("accessToken"),
options.document) ;
}) ;
}
PHP Hampshire – Portsmouth
Extend
Client side API
PHP Hampshire – Portsmouth
 Model hierarchy
 Metadata / Properties
 Events
 Camera / Zoom / Navigation
 Access to geometry, textures, …
 …
 http://developer.api.autodesk.com/documentation/v1/viewers/index.html
Client side API
PHP Hampshire – Portsmouth
 Following tutorial uses Node.js as the server side
technology, but it could be anything else
 You’ll need the urn/id of a file uploaded to the Autodesk
server - e.g. by using http://fast-shelf-9177.herokuapp.com/
Step-by-step tutorial
PHP Hampshire – Portsmouth
 Install Node.js on your platform:
 http://nodejs.org/download
 Grab an HTML/JavaScript IDE:
 http://brackets.io - FREE
 Some other non-free editors:
 Visual Studio
 https://www.jetbrains.com/webstorm
 Get cloud credentials for View & Data API
 https://developer.autodesk.com
Pre-requisites
PHP Hampshire – Portsmouth
 Pick a model saved in one of the supported format by
the View & Data API
 Create a bucket, upload model and start translation
 This step can be achieved using existing samples
 Once your model is successfully translated, grab its
URN
Step 1: Upload a model
PHP Hampshire – Portsmouth
Step 2: Create a node.js server
 Create server.js script file:
var api = require('./routes/api');
var express = require('express');
var app = express();
app.use('/node/basic', express.static(__dirname + '/www/views'));
app.use('/node/basic/api', api);
app.set('port', process.env.PORT || 3000);
var server = app.listen(app.get('port'), function() {
console.log('Server listening on port ' +
server.address().port);
});
PHP Hampshire – Portsmouth
Step 3: Add a REST API to your server
 Create api.js script file:
var express = require('express');
var request = require('request');
var router = express.Router();
// Generates access token
router.get('/token', function (req, res) {
var params = {
client_id: <your client id>,
client_secret: <your client secret>,
grant_type: 'client_credentials'
}
request.post('https://developer.api.autodesk.com/authentication/v1/authenticate',
{ form: params },
function (error, response, body) {
if (!error && response.statusCode == 200) {
var authResponse = JSON.parse(body);
res.send(authResponse.access_token);
}
});
});
module.exports = router;
PHP Hampshire – Portsmouth
Step 4: Resolve package dependencies
 Create package.json file:
{
"name": “DevDaysViewer",
"version": “1.0.0",
"dependencies": {
"express": "*",
"request": "*"
}
}
 Run npm install in the command line
PHP Hampshire – Portsmouth
Step 5: Add an HTML page
 Create index.html file:
<html>
<head>
<title>ADN DevDays Viewer</title>
<script>
</script>
</head>
<body style="margin:0">
<div id="viewerDiv">
</div>
</body>
</html>
PHP Hampshire – Portsmouth
Step 5: Include required script/css dependencies
 Add in the <head> section
<!-- jquery -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Viewer -->
<link type="text/css" rel="stylesheet"
href="https://viewing.api.autodesk.com/viewingservice/v1/viewers/style.css"/>
<script
src="https://developer.api.autodesk.com/viewingservice/v1/viewers/viewer3D.min.js"></sc
ript>
PHP Hampshire – Portsmouth
Step 6: Add some JavaScript code
 Add in the <script> section
$(document).ready(function () {
var getToken = function() {
var xhr = new XMLHttpRequest();
xhr.open("GET", 'http://' + window.location.host + '/api/token', false);
xhr.send(null);
return xhr.responseText;
}
function initializeViewer(containerId, documentId, role) {
var viewerContainer = document.getElementById(containerId);
var viewer = new Autodesk.Viewing.Private.GuiViewer3D(
viewerContainer);
viewer.start();
Autodesk.Viewing.Document.load(documentId,
function (document) {
var rootItem = document.getRootItem();
var geometryItems =
Autodesk.Viewing.Document.getSubItemsWithProperties(
rootItem,
{ 'type': 'geometry', 'role': role },
true);
viewer.load(document.getViewablePath(geometryItems[0]));
},
// onErrorCallback
function (msg) {
console.log("Error loading document: " + msg);
}
);
}
function initialize() {
var options = {
env: "AutodeskProduction",
getAccessToken: getToken,
refreshToken: getToken
};
Autodesk.Viewing.Initializer(options, function () {
initializeViewer('viewerDiv', urn, '3d');
});
}
initialize();
});
PHP Hampshire – Portsmouth
Step 7: Run your server locally
 Tidy things using proper folder hierarchy
 Run node server.js from command line
PHP Hampshire – Portsmouth
Step 8: Connect to your local server
 Using a WebGL-compatible browser
PHP Hampshire – Portsmouth
Step 9: Create a viewer extension
 Create an extension script:
 Company.Viewing.Extension.MyFirstExtension.js
AutodeskNamespace("Autodesk.ADN.Viewing.Extension");
Autodesk.ADN.Viewing.Extension.Basic = function (viewer, options) {
Autodesk.Viewing.Extension.call(this, viewer, options);
_self = this;
_self.load = function () {
alert('Autodesk.ADN.Viewing.Extension.Basic loaded');
return true;
};
_self.unload = function () {
console.log('Autodesk.ADN.Viewing.Extension.Basic unloaded');
return true;
};
};
Autodesk.ADN.Viewing.Extension.Basic.prototype =
Object.create(Autodesk.Viewing.Extension.prototype);
Autodesk.ADN.Viewing.Extension.Basic.prototype.constructor =
Autodesk.ADN.Viewing.Extension.Basic;
Autodesk.Viewing.theExtensionManager.registerExtension(
'Autodesk.ADN.Viewing.Extension.Basic',
Autodesk.ADN.Viewing.Extension.Basic);
PHP Hampshire – Portsmouth
Step 10: Load your extension in the viewer
function initializeViewer(containerId, documentId, role) {
var viewerContainer = document.getElementById(containerId);
var viewer = new Autodesk.Viewing.Private.GuiViewer3D(
viewerContainer);
viewer.start();
viewer.loadExtension('Autodesk.ADN.Viewing.Extension.Basic');
PHP Hampshire – Portsmouth
Resources
PHP Hampshire – Portsmouth
 http://developer.autodesk.com/
Resource & Documents
PHP Hampshire – Portsmouth
http://autodesk360.com
PHP Hampshire – Portsmouth
 GitHub repos
Resource & Documents
PHP Hampshire – Portsmouth
 API Console: https://developer.autodesk.com/api-console
Test the API online
PHP Hampshire – Portsmouth
 http://adndevblog.typepad.com/cloud_and_mobile/
 http://adndevblog.typepad.com/cloud_and_mobile/2015/01/what-is-this-view-data-api-thing-
anyway.html
Blog
PHP Hampshire – Portsmouth
 Blog embedding:
http://through-the-interface.typepad.com/through_the_interface/2014/05/a-sneak-peek-at-the-new-
autodesk-360-viewer.html
 Facebook: https://www.facebook.com/a360viewer
 TypePad: http://adndevblog.typepad.com/cloud_and_mobile/stephens-test-page.html
 Gallery: http://gallery.autodesk.io
 Database Integration: http://sapdemo.autodesk.io
 3rd party: https://bldng360.nl
Demos
PHP Hampshire – Portsmouth
Virtual reality
 http://autode.sk/gcbv
 http://vr.autodesk.io
PHP Hampshire – Portsmouth
https://bldng360.nl/
PHP Hampshire – Portsmouth
http://www.3dwebfest.com
PHP Hampshire – Portsmouth

More Related Content

PPTX
3D and VR on the web
PPTX
Building AR and VR Experiences for Web Apps with JavaScript
PPTX
Building modern share point apps (angularjs, npm, bower, grunt, VS2015)
PPTX
Node js to sharepoint authentication
PPTX
Introduction to Cross Platform Mobile Apps (Xamarin)
PPTX
Angularjs Tutorial for Beginners
PPTX
Azure Web Jobs
PDF
APIs, now and in the future
3D and VR on the web
Building AR and VR Experiences for Web Apps with JavaScript
Building modern share point apps (angularjs, npm, bower, grunt, VS2015)
Node js to sharepoint authentication
Introduction to Cross Platform Mobile Apps (Xamarin)
Angularjs Tutorial for Beginners
Azure Web Jobs
APIs, now and in the future

What's hot (20)

PDF
Thomas Lobinger
PDF
Empowering the "mobile web"
PDF
APIs for modern web apps
PDF
Web versus Native: round 1!
PDF
JavaScript Libraries: The Big Picture
PDF
Front End Development for Back End Developers - Devoxx UK 2017
PDF
Front End Development for Back End Java Developers - NYJavaSIG 2019
PDF
Front End Development for Back End Developers - UberConf 2017
PDF
Ionic adventures - Hybrid Mobile App Development rocks
PDF
Getting Started in VR with JS
PDF
125 고성능 web view-deview 2013 발표 자료_공유용
PDF
Booting up with polymer
PDF
What's New in JHipsterLand - Devoxx Poland 2017
ODP
An Introduction to Vuejs
PPTX
Browser Automation with Playwright – for integration, RPA, UI testing and mor...
PPTX
We come in peace hybrid development with web assembly - Maayan Hanin
PDF
How to Build ToDo App with Vue 3 + TypeScript
PPTX
Disrupting the application eco system with progressive web applications
PPTX
Maurice de Beijer
PPTX
Vue presentation
Thomas Lobinger
Empowering the "mobile web"
APIs for modern web apps
Web versus Native: round 1!
JavaScript Libraries: The Big Picture
Front End Development for Back End Developers - Devoxx UK 2017
Front End Development for Back End Java Developers - NYJavaSIG 2019
Front End Development for Back End Developers - UberConf 2017
Ionic adventures - Hybrid Mobile App Development rocks
Getting Started in VR with JS
125 고성능 web view-deview 2013 발표 자료_공유용
Booting up with polymer
What's New in JHipsterLand - Devoxx Poland 2017
An Introduction to Vuejs
Browser Automation with Playwright – for integration, RPA, UI testing and mor...
We come in peace hybrid development with web assembly - Maayan Hanin
How to Build ToDo App with Vue 3 + TypeScript
Disrupting the application eco system with progressive web applications
Maurice de Beijer
Vue presentation

Viewers also liked (20)

PPTX
Collaboration with Design Data
PDF
2017 02-fitc-amz-public
PDF
Forge - DevCon 2016: Bringing BIM to Facility Management with Forge – Collabo...
PPTX
Forge - DevCon 2016: Hsbcad from Acad to Revit to Cloud
PPTX
Employment situation report (aka labor report)
PDF
Valerio Fatatis Curriculum Vitae
PPTX
20 golden rules for presenting final
PPTX
Velvettttt power point
RTF
15 apr'15
PPT
Paying attention
PPTX
Big Bear Cool Cabins
PPTX
Big Bear Cool Cabins
PPTX
Household sport
PDF
Observation lab presentation
DOC
Adam Olkon 2014 highlights
PPTX
Who We Are - NSHMBA Boston Chapter
PDF
lamellendak folder (1) (1)
PPTX
CLIL - From Myths to Modules
Collaboration with Design Data
2017 02-fitc-amz-public
Forge - DevCon 2016: Bringing BIM to Facility Management with Forge – Collabo...
Forge - DevCon 2016: Hsbcad from Acad to Revit to Cloud
Employment situation report (aka labor report)
Valerio Fatatis Curriculum Vitae
20 golden rules for presenting final
Velvettttt power point
15 apr'15
Paying attention
Big Bear Cool Cabins
Big Bear Cool Cabins
Household sport
Observation lab presentation
Adam Olkon 2014 highlights
Who We Are - NSHMBA Boston Chapter
lamellendak folder (1) (1)
CLIL - From Myths to Modules

Similar to Make the Web 3D (20)

PDF
Using the new WordPress REST API
PPTX
Single Page Web Applications with WordPress REST API
PDF
HTML5 tutorial: canvas, offfline & sockets
PDF
Progressive web apps
PPTX
Nodejs.meetup
PDF
Building applications with Serverless Framework and AWS Lambda - JavaZone 2019
PDF
Introduction of webpack 4
PDF
High quality ap is with api platform
PDF
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
PPTX
PHP on Windows
PPTX
PHP on Windows
PPTX
WP REST API - Building a simple Web Application
PPTX
Alfresco Development Framework Basic
PDF
WordPress and Client Side Web Applications WCTO
PPT
Developing Plugins For WordPress
PDF
Mobile, web and cloud - the triple crown of modern applications
PDF
Wordcamp Toronto Presentation
PDF
ContainerDayVietnam2016: Docker for JS Developer
PPS
Web Development in Perl
PPT
nodejs_at_a_glance, understanding java script
Using the new WordPress REST API
Single Page Web Applications with WordPress REST API
HTML5 tutorial: canvas, offfline & sockets
Progressive web apps
Nodejs.meetup
Building applications with Serverless Framework and AWS Lambda - JavaZone 2019
Introduction of webpack 4
High quality ap is with api platform
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
PHP on Windows
PHP on Windows
WP REST API - Building a simple Web Application
Alfresco Development Framework Basic
WordPress and Client Side Web Applications WCTO
Developing Plugins For WordPress
Mobile, web and cloud - the triple crown of modern applications
Wordcamp Toronto Presentation
ContainerDayVietnam2016: Docker for JS Developer
Web Development in Perl
nodejs_at_a_glance, understanding java script

Recently uploaded (20)

PDF
OpenEXR Virtual Town Hall - August 2025
PDF
OpenAssetIO Virtual Town Hall - August 2025.pdf
PDF
Canva Desktop App With Crack Free Download 2025?
PDF
Mobile App for Guard Tour and Reporting.pdf
PPTX
FLIGHT TICKET API | API INTEGRATION PLATFORM
PDF
Top 10 Project Management Software for Small Teams in 2025.pdf
PDF
IObit Driver Booster Pro Crack Latest Version Download
PDF
OpenImageIO Virtual Town Hall - August 2025
PDF
SBOM Document Quality Guide - OpenChain SBOM Study Group
PDF
WhatsApp Chatbots The Key to Scalable Customer Support.pdf
PDF
How to Write Automated Test Scripts Using Selenium.pdf
PDF
C language slides for c programming book by ANSI
PPTX
oracle_ebs_12.2_project_cutoveroutage.pptx
PDF
DOWNLOAD—IOBit Uninstaller Pro Crack Download Free
PDF
OpenTimelineIO Virtual Town Hall - August 2025
PPTX
Relevance Tuning with Genetic Algorithms
PDF
Module 1 - Introduction to Generative AI.pdf
PPTX
MCP empowers AI Agents from Zero to Production
PDF
MaterialX Virtual Town Hall - August 2025
PPTX
Streamlining Project Management in the AV Industry with D-Tools for Zoho CRM ...
OpenEXR Virtual Town Hall - August 2025
OpenAssetIO Virtual Town Hall - August 2025.pdf
Canva Desktop App With Crack Free Download 2025?
Mobile App for Guard Tour and Reporting.pdf
FLIGHT TICKET API | API INTEGRATION PLATFORM
Top 10 Project Management Software for Small Teams in 2025.pdf
IObit Driver Booster Pro Crack Latest Version Download
OpenImageIO Virtual Town Hall - August 2025
SBOM Document Quality Guide - OpenChain SBOM Study Group
WhatsApp Chatbots The Key to Scalable Customer Support.pdf
How to Write Automated Test Scripts Using Selenium.pdf
C language slides for c programming book by ANSI
oracle_ebs_12.2_project_cutoveroutage.pptx
DOWNLOAD—IOBit Uninstaller Pro Crack Download Free
OpenTimelineIO Virtual Town Hall - August 2025
Relevance Tuning with Genetic Algorithms
Module 1 - Introduction to Generative AI.pdf
MCP empowers AI Agents from Zero to Production
MaterialX Virtual Town Hall - August 2025
Streamlining Project Management in the AV Industry with D-Tools for Zoho CRM ...

Make the Web 3D

  • 1. PHP Hampshire – Portsmouth Make the Web 3D Adam Nagy Senior Developer Evangelist Autodesk @AdamTheNagy
  • 2. PHP Hampshire – Portsmouth
  • 3. PHP Hampshire – Portsmouth 2d and/or 3d
  • 4. PHP Hampshire – Portsmouth WebGL and three.js
  • 5. PHP Hampshire – Portsmouth Autodesk Large Model Viewer Add 3D viewing to your web application http://autode.sk/m3w
  • 6. PHP Hampshire – Portsmouth Autodesk View & Data API
  • 7. PHP Hampshire – Portsmouth  Server & management API  Upload and Translate files  Access rights  oAuth 2.0 - REST API  WEB Client API  Viewing technology based on THREE.js  Embed and control the viewer into HTML5 applications  Access document, manipulate objects, camera, …  JavaScript API 2 API available
  • 8. PHP Hampshire – Portsmouth  ipt, neu, stla, stl, jt, skp, prt, dwf, sldasm, step, dwg, zip, nwc, model, sim, stp, ste, f3d, iges, dwt, catproduct, igs, sldprt, cgr, 3dm, sab, obj, cam360, exp, wire, ige, rcp, dae, x_b, 3ds, rvt, g, sim360, iam, asm, dlv3, x_t, session, xas, xpr, catpart, stlb, nwd, sat, fbx, smb, smt, dwfx.  More coming … Supported formats
  • 9. PHP Hampshire – Portsmouth Getting Started Server side
  • 10. PHP Hampshire – Portsmouth  http://developer.autodesk.com Getting Started
  • 11. PHP Hampshire – Portsmouth
  • 12. PHP Hampshire – Portsmouth Getting Started – Server/Management Workflow
  • 13. PHP Hampshire – Portsmouth  Header Content-Type: application/x-www-form-urlencoded  Body client_id=xxxxxxxxxxxx &client_secret=xxxxxxxxxxxx &grant_type=client_credentials  POST https://developer.api.autodesk.com/authentication/v1/authenticate Step 2: Get your access token
  • 14. PHP Hampshire – Portsmouth  Header  "Content-Type: application/json"  "Authorization: Bearer xxxxxxxxxxxx"  Body '{"bucketKey":"mybucket","policy":"transient"}'  POST https://developer.api.autodesk.com/oss/v1/buckets Step 3: Create a bucket
  • 15. PHP Hampshire – Portsmouth  Transient: persists for only 24 hours  Temporary: persists for 30 days  Persistent: persists until it’s deleted Bucket policy
  • 16. PHP Hampshire – Portsmouth  Header  "Authorization: Bearer xxxxxxxxxxxxxxxx"  "Content-Length: 308331"  "Content-Type: application/octet-stream"  Body  File content  PUT https://developer.api.autodesk.com/oss/v1/buckets/{buc ketkey}/objects/{objectkey} Step 4: Upload a file
  • 17. PHP Hampshire – Portsmouth  Get the URN  URN = Base64 encoded id Upload response
  • 18. PHP Hampshire – Portsmouth  Header  "Content-Type: application/json "  "Authorization:Bearer xxxxxxxxxxxx“  Body  "{"urn":“{base64 encoded id in previous step}"}“  POST https://developer.api.autodesk.com/viewingservice/v1/r egister Step 5: Register your file for viewing
  • 19. PHP Hampshire – Portsmouth  Header  "Authorization: Bearer xxxxxxxxxxxx"  GET https://developer.api.autodesk.com/viewingservice/v1/{URN}  Note that even if only some parts have a status of “complete”, you can still start viewing the object in the viewer. Check progress
  • 20. PHP Hampshire – Portsmouth  Header  "Authorization: Bearer xxxxxxxxxxxx"  GET https://developer.api.autodesk.com/viewingservice/v1/t humbnails/{URN} Thumbnail
  • 21. PHP Hampshire – Portsmouth http://fast-shelf-9177.herokuapp.com/
  • 22. PHP Hampshire – Portsmouth Getting Started Client side
  • 23. PHP Hampshire – Portsmouth  The A360 Viewer requires a WebGL canvas compatible browser, such as:  Chrome 18.0+  Opera 15.0+  Firefox 4.0+  Safari 8.0+  Internet Explorer 11.0+  iOS 8.0 started supporting it too Compatibility
  • 24. PHP Hampshire – Portsmouth http://caniuse.com/#feat=webgl The numbers in the boxes are the version numbers of given product
  • 25. PHP Hampshire – Portsmouth  Create a html5 page or web application  Add reference to CSS & JavaScript <link rel="stylesheet" href="https://developer.api.autodesk.com/viewingservice/v1/viewers /style.css" type="text/css"> <script src="https://developer.api.autodesk.com/viewingservice/v1/viewers/ viewer3D.min.js"></script> Load URN in JavaScript viewer
  • 26. PHP Hampshire – Portsmouth  Add a html container <body onload="initialize()"> <div id="viewer"></div> </body>  Must be a div Load URN in JavaScript viewer
  • 27. PHP Hampshire – Portsmouth  Initialize Viewer Load URN in JavaScript viewer function initialize () { var options = { "document" : "urn:XXXXXXXXXX“ } ; var viewerElement = document.getElementById ("viewer") ; var viewer = new Autodesk.Viewing.Viewer3D (viewerElement, {}) ; viewer.initialize () ; Autodesk.Viewing.Initializer (options, function () { loadDocument ( viewer, getURLParameterByName ("accessToken"), options.document) ; }) ; }
  • 28. PHP Hampshire – Portsmouth Extend Client side API
  • 29. PHP Hampshire – Portsmouth  Model hierarchy  Metadata / Properties  Events  Camera / Zoom / Navigation  Access to geometry, textures, …  …  http://developer.api.autodesk.com/documentation/v1/viewers/index.html Client side API
  • 30. PHP Hampshire – Portsmouth  Following tutorial uses Node.js as the server side technology, but it could be anything else  You’ll need the urn/id of a file uploaded to the Autodesk server - e.g. by using http://fast-shelf-9177.herokuapp.com/ Step-by-step tutorial
  • 31. PHP Hampshire – Portsmouth  Install Node.js on your platform:  http://nodejs.org/download  Grab an HTML/JavaScript IDE:  http://brackets.io - FREE  Some other non-free editors:  Visual Studio  https://www.jetbrains.com/webstorm  Get cloud credentials for View & Data API  https://developer.autodesk.com Pre-requisites
  • 32. PHP Hampshire – Portsmouth  Pick a model saved in one of the supported format by the View & Data API  Create a bucket, upload model and start translation  This step can be achieved using existing samples  Once your model is successfully translated, grab its URN Step 1: Upload a model
  • 33. PHP Hampshire – Portsmouth Step 2: Create a node.js server  Create server.js script file: var api = require('./routes/api'); var express = require('express'); var app = express(); app.use('/node/basic', express.static(__dirname + '/www/views')); app.use('/node/basic/api', api); app.set('port', process.env.PORT || 3000); var server = app.listen(app.get('port'), function() { console.log('Server listening on port ' + server.address().port); });
  • 34. PHP Hampshire – Portsmouth Step 3: Add a REST API to your server  Create api.js script file: var express = require('express'); var request = require('request'); var router = express.Router(); // Generates access token router.get('/token', function (req, res) { var params = { client_id: <your client id>, client_secret: <your client secret>, grant_type: 'client_credentials' } request.post('https://developer.api.autodesk.com/authentication/v1/authenticate', { form: params }, function (error, response, body) { if (!error && response.statusCode == 200) { var authResponse = JSON.parse(body); res.send(authResponse.access_token); } }); }); module.exports = router;
  • 35. PHP Hampshire – Portsmouth Step 4: Resolve package dependencies  Create package.json file: { "name": “DevDaysViewer", "version": “1.0.0", "dependencies": { "express": "*", "request": "*" } }  Run npm install in the command line
  • 36. PHP Hampshire – Portsmouth Step 5: Add an HTML page  Create index.html file: <html> <head> <title>ADN DevDays Viewer</title> <script> </script> </head> <body style="margin:0"> <div id="viewerDiv"> </div> </body> </html>
  • 37. PHP Hampshire – Portsmouth Step 5: Include required script/css dependencies  Add in the <head> section <!-- jquery --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <!-- Viewer --> <link type="text/css" rel="stylesheet" href="https://viewing.api.autodesk.com/viewingservice/v1/viewers/style.css"/> <script src="https://developer.api.autodesk.com/viewingservice/v1/viewers/viewer3D.min.js"></sc ript>
  • 38. PHP Hampshire – Portsmouth Step 6: Add some JavaScript code  Add in the <script> section $(document).ready(function () { var getToken = function() { var xhr = new XMLHttpRequest(); xhr.open("GET", 'http://' + window.location.host + '/api/token', false); xhr.send(null); return xhr.responseText; } function initializeViewer(containerId, documentId, role) { var viewerContainer = document.getElementById(containerId); var viewer = new Autodesk.Viewing.Private.GuiViewer3D( viewerContainer); viewer.start(); Autodesk.Viewing.Document.load(documentId, function (document) { var rootItem = document.getRootItem(); var geometryItems = Autodesk.Viewing.Document.getSubItemsWithProperties( rootItem, { 'type': 'geometry', 'role': role }, true); viewer.load(document.getViewablePath(geometryItems[0])); }, // onErrorCallback function (msg) { console.log("Error loading document: " + msg); } ); } function initialize() { var options = { env: "AutodeskProduction", getAccessToken: getToken, refreshToken: getToken }; Autodesk.Viewing.Initializer(options, function () { initializeViewer('viewerDiv', urn, '3d'); }); } initialize(); });
  • 39. PHP Hampshire – Portsmouth Step 7: Run your server locally  Tidy things using proper folder hierarchy  Run node server.js from command line
  • 40. PHP Hampshire – Portsmouth Step 8: Connect to your local server  Using a WebGL-compatible browser
  • 41. PHP Hampshire – Portsmouth Step 9: Create a viewer extension  Create an extension script:  Company.Viewing.Extension.MyFirstExtension.js AutodeskNamespace("Autodesk.ADN.Viewing.Extension"); Autodesk.ADN.Viewing.Extension.Basic = function (viewer, options) { Autodesk.Viewing.Extension.call(this, viewer, options); _self = this; _self.load = function () { alert('Autodesk.ADN.Viewing.Extension.Basic loaded'); return true; }; _self.unload = function () { console.log('Autodesk.ADN.Viewing.Extension.Basic unloaded'); return true; }; }; Autodesk.ADN.Viewing.Extension.Basic.prototype = Object.create(Autodesk.Viewing.Extension.prototype); Autodesk.ADN.Viewing.Extension.Basic.prototype.constructor = Autodesk.ADN.Viewing.Extension.Basic; Autodesk.Viewing.theExtensionManager.registerExtension( 'Autodesk.ADN.Viewing.Extension.Basic', Autodesk.ADN.Viewing.Extension.Basic);
  • 42. PHP Hampshire – Portsmouth Step 10: Load your extension in the viewer function initializeViewer(containerId, documentId, role) { var viewerContainer = document.getElementById(containerId); var viewer = new Autodesk.Viewing.Private.GuiViewer3D( viewerContainer); viewer.start(); viewer.loadExtension('Autodesk.ADN.Viewing.Extension.Basic');
  • 43. PHP Hampshire – Portsmouth Resources
  • 44. PHP Hampshire – Portsmouth  http://developer.autodesk.com/ Resource & Documents
  • 45. PHP Hampshire – Portsmouth http://autodesk360.com
  • 46. PHP Hampshire – Portsmouth  GitHub repos Resource & Documents
  • 47. PHP Hampshire – Portsmouth  API Console: https://developer.autodesk.com/api-console Test the API online
  • 48. PHP Hampshire – Portsmouth  http://adndevblog.typepad.com/cloud_and_mobile/  http://adndevblog.typepad.com/cloud_and_mobile/2015/01/what-is-this-view-data-api-thing- anyway.html Blog
  • 49. PHP Hampshire – Portsmouth  Blog embedding: http://through-the-interface.typepad.com/through_the_interface/2014/05/a-sneak-peek-at-the-new- autodesk-360-viewer.html  Facebook: https://www.facebook.com/a360viewer  TypePad: http://adndevblog.typepad.com/cloud_and_mobile/stephens-test-page.html  Gallery: http://gallery.autodesk.io  Database Integration: http://sapdemo.autodesk.io  3rd party: https://bldng360.nl Demos
  • 50. PHP Hampshire – Portsmouth Virtual reality  http://autode.sk/gcbv  http://vr.autodesk.io
  • 51. PHP Hampshire – Portsmouth https://bldng360.nl/
  • 52. PHP Hampshire – Portsmouth http://www.3dwebfest.com
  • 53. PHP Hampshire – Portsmouth