You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A sample demonstrating how to view a model in a web application with the Autodesk View & Data API. This web application has a basic Node.js
6
+
server and JavaScript/HTML5 client. This sample does not demonstrate how to upload a model to the Autodesk server for translation. See instructions below
7
+
to prepare a model to be consumed in this sample.
8
+
9
+
10
+
## Dependencies
11
+
Install Node.js on your machine and clone this repo. Download the project dependencies using npm before running the app by running
12
+
the following command in the project root directory
13
+
```
14
+
npm install
15
+
```
16
+
on the node.js console. This will install the following node.js modules in the project:
17
+
- express
18
+
- request
19
+
- serve-favicon
20
+
21
+
This sample does not include the workflow of uploading models. on the server It depends on other workflow samples to upload models and
22
+
get model URNs - as explained in the Setup/Usage Instructions.
23
+
24
+
25
+
## Setup/Usage Instructions
26
+
27
+
* Apply for your own credentials (API keys) from [http://developer.autodesk.com](http://developer.autodesk.com)
28
+
* From the sample root folder, rename or copy the ./credentials_.js file into ./credentials.js <br />
29
+
* Windows <br />
30
+
```
31
+
copy credentials_.js credentials.js
32
+
```
33
+
* OSX/Linux <br />
34
+
```
35
+
cp credentials_.js credentials.js
36
+
```
37
+
* Replace the placeholder with your own keys in credentials.js, line #29 and #30 <br />
* The [upload tool](http://still-spire-1606.herokuapp.com) provides some existing models. Choose any one of them, or upload one of your own
44
+
models with [upload tool](http://still-spire-1606.herokuapp.com). The [upload tool](http://still-spire-1606.herokuapp.com) will generate a URN of the model that you need later.
45
+
* Copy the URN which was generated in the previous step in file /www/index.js at line #18 <br />
46
+
```
47
+
var defaultUrn = '<replacewithyourencodedurn>';
48
+
```
49
+
* In /www/index.js, at line #21, replace the entire line by the following code: <br />
50
+
```
51
+
var tokenurl ='http://still-spire-1606.herokuapp.com/api/rawtoken';
52
+
```
53
+
* Run the server from the Node.js console, by running the following command: <br />
54
+
```
55
+
node server.js
56
+
```
57
+
* Connect to you local server using a WebGL-compatible browser: [http://localhost:3000/](http://localhost:3000/)
58
+
59
+
60
+
## License
61
+
62
+
That samples are licensed under the terms of the [MIT License](http://opensource.org/licenses/MIT). Please see the [LICENSE](LICENSE) file for full details.
63
+
64
+
65
+
## Written by
66
+
67
+
Written by [Philippe Leefsma](http://adndevblog.typepad.com/cloud_and_mobile/philippe-leefsma.html) <br />
This setup is only available for people having access to the staging server. If you do not have credentials for the staging server, do not use these instructions.
4
+
5
+
6
+
## Description
7
+
A sample demonstrating how to view a model in a web application with the Autodesk View & Data API. This web application has a basic Node.js
8
+
server and JavaScript/HTML5 client. This sample does not demonstrate how to upload a model to the Autodesk server for translation. See instructions below
9
+
to prepare a model to be consumed in this sample.
10
+
11
+
This README explains how to setup the sample to use the Staging environment vs Production.
12
+
13
+
14
+
## Dependencies
15
+
Install Node.js on your machine and clone this repo. Download the project dependencies using npm before running the app by running
16
+
the following command in the project root directory
17
+
```
18
+
npm install
19
+
```
20
+
on the node.js console. This will install the following node.js modules in the project:
21
+
- express
22
+
- request
23
+
- serve-favicon
24
+
25
+
This sample does not include the workflow of uploading models. on the server It depends on other workflow samples to upload models and
26
+
get model URNs - as explained in the Setup/Usage Instructions.
27
+
28
+
29
+
## Setup/Usage Instructions
30
+
31
+
* Apply for your own credentials (API keys) from [http://developer-stg.autodesk.com](http://developer-stg.autodesk.com)
32
+
* From the sample root folder, rename or copy the ./credentials_.js file into ./credentials.js <br />
33
+
* Windows <br />
34
+
```
35
+
copy credentials_.js credentials.js
36
+
```
37
+
* OSX/Linux <br />
38
+
```
39
+
cp credentials_.js credentials.js
40
+
```
41
+
* Replace the placeholder with your own keys in credentials.js, line #29 and #30 <br />
* In file credentials.js, comment out line #23, and uncomment line #24
48
+
* Upload one of your models to your account and get its URN using another workflow sample, for example,
49
+
- [this workflow sample in .net winform application](https://github.com/Developer-Autodesk/workflow-dotnet-winform-view.and.data.api/) if you are using windows
50
+
- or [this workflow sample in Mac OS Swift](https://github.com/Developer-Autodesk/workflow-macos-swift-view.and.data.api) if you are using Mac
51
+
- or this [WEB page](http://javalmvwalkthrough-vq2mmximxb.elasticbeanstalk.com/)
52
+
* Copy the URN which was generated in the previous step in file /www/index.js at line #18 <br />
53
+
```
54
+
var defaultUrn = '<replacewithyourencodedurn>';
55
+
```
56
+
* In file /www/index.html (line #33 and #34), use the viewer3D.min.js and style.css files from the staging server, but using the code below <br />
* In file /www/index.js, comment out line #23, and uncomment line #24
63
+
* Run the server from the Node.js console, by running the following command: <br />
64
+
```
65
+
node server.js
66
+
```
67
+
* Connect to you local server using a WebGL-compatible browser: [http://localhost:3000/](http://localhost:3000/)
68
+
69
+
70
+
## License
71
+
72
+
That samples are licensed under the terms of the [MIT License](http://opensource.org/licenses/MIT). Please see the [LICENSE](LICENSE) file for full details.
73
+
74
+
75
+
## Written by
76
+
77
+
Written by [Philippe Leefsma](http://adndevblog.typepad.com/cloud_and_mobile/philippe-leefsma.html) <br />
Copy file name to clipboardExpand all lines: README.md
+30-51Lines changed: 30 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,14 @@
2
2
3
3
4
4
## Description
5
-
A sample demonstrating how to view a model in a web application with the Autodesk View & Data API. This web application has a basic Node.js server and JavaScript/HTML5 client. This sample does not demonstrate how to upload a model to the Autodesk server for translation.
5
+
A sample demonstrating how to view a model in a web application with the Autodesk View & Data API. This web application has a basic Node.js
6
+
server and JavaScript/HTML5 client. This sample does not demonstrate how to upload a model to the Autodesk server for translation. See instructions below
7
+
to prepare a model to be consumed in this sample.
8
+
6
9
7
10
## Dependencies
8
-
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
11
+
Install Node.js on your machine and clone this repo. Download the project dependencies using npm before running the app by running
12
+
the following command in the project root directory
9
13
```
10
14
npm install
11
15
```
@@ -14,25 +18,35 @@ on the node.js console. This will install the following node.js modules in the p
14
18
- request
15
19
- serve-favicon
16
20
17
-
This sample does not include the workflow of uploading models. It depends on other workflow samples to upload models and get model URNs - as explained in the Setup/Usage Instructions.
21
+
This sample does not include the workflow of uploading models. on the server It depends on other workflow samples to upload models and
22
+
get model URNs - as explained in the Setup/Usage Instructions.
23
+
18
24
19
25
## Setup/Usage Instructions
20
-
Use your own credentials to upload models to your account
21
26
22
27
* Apply for your own credentials (API keys) from [http://developer.autodesk.com](http://developer.autodesk.com)
23
-
* Replace the placeholder with your own keys in credentials.js, line #23 and #25 <br />
24
-
```
25
-
credentials.ClientId = '<replace with clientId>';
28
+
* From the sample root folder, rename or copy the ./credentials_.js file into ./credentials.js <br />
29
+
* Windows <br />
30
+
```
31
+
copy credentials_.js credentials.js
32
+
```
33
+
* OSX/Linux <br />
34
+
```
35
+
cp credentials_.js credentials.js
36
+
```
37
+
* Replace the placeholder with your own keys in credentials.js, line #29 and #30 <br />
* Upload one of your models to your account and get its URN using another workflow sample, for example,
30
44
- [this workflow sample in .net winform application](https://github.com/Developer-Autodesk/workflow-dotnet-winform-view.and.data.api/) if you are using windows
31
45
- or [this workflow sample in Mac OS Swift](https://github.com/Developer-Autodesk/workflow-macos-swift-view.and.data.api) if you are using Mac
32
46
- or this [WEB page](http://javalmvwalkthrough-vq2mmximxb.elasticbeanstalk.com/)
33
-
* Copy this URN in /www/views/index.js at line #18 <br />
47
+
* Copy the URN which was generated in the previous step in file /www/index.js at line #18 <br />
34
48
```
35
-
var urnprod = 'your_urn_here';
49
+
var defaultUrn = '<replacewithyourencodedurn>';
36
50
```
37
51
* Run the server from the Node.js console, by running the following command: <br />
38
52
```
@@ -48,56 +62,21 @@ By default, the project is setup with the production server, and use your own cr
48
62
49
63
You can work with production or staging Autodesk View and Data environments. By default, the project is setup with the production server.
50
64
51
-
### Option A: Production server option: Use [upload tool](http://still-spire-1606.herokuapp.com) online service to upload model.
65
+
* Instructions to setup this sample to use the Autodesk View & Data staging server are [here](https://github.com/Developer-Autodesk/workflow-node.js-view.and.data.api/blob/master/README-stg.md)
52
66
53
-
* The [upload tool](http://still-spire-1606.herokuapp.com) provides some existing models. Choose any one of them, or upload one of your own models with [upload tool](http://still-spire-1606.herokuapp.com). The [upload tool](http://still-spire-1606.herokuapp.com) will generate a URN of the model that you need later.
54
-
* Copy this URN in /www/views/index.js at line #18 <br />
55
-
```
56
-
var urnprod = 'your_urn_here';
57
-
```
58
-
* In /www/views/index.js, at line #36, change value of tokenurl to the access token you can generate from 'http://still-spire-1606.herokuapp.com/api/rawtoken'
59
-
* Run the server from the Node.js console, by running the following command: <br />
60
-
```
61
-
node server.js
62
-
```
63
-
* Connect to your local server using a WebGL-compatible browser: [http://localhost:3000/](http://localhost:3000/)
64
67
68
+
You can also use someone else credentials to view models using this sample.
65
69
66
-
### Option B: To work with the staging environment, you need to use your own credentials vs the option above.
67
-
* Apply your own credentials from [http://developer-stg.autodesk.com](http://developer-stg.autodesk.com)
68
-
* Replace the place holder with your own keys in credentials-stg.js, line #23 and #25 <br />
69
-
```
70
-
credentials.ClientId = '<replace with clientId>';
71
-
72
-
credentials.ClientSecret = '<replace with clientSecret>';
73
-
```
74
-
* Upload one of your models to your account and get its URN using another workflow sample, for example,
75
-
-[this workflow sample in .net winform application](https://github.com/Developer-Autodesk/workflow-dotnet-winform-view.and.data.api/) if you are using windows
76
-
- or [this workflow sample in Mac OS Swift](https://github.com/Developer-Autodesk/workflow-macos-swift-view.and.data.api) if you are using Mac <br />
77
-
But please use [staging URL](https://developer-stg.api.autodesk.com) to proceed with the workflows.
78
-
* Copy this URN in /www/views/index.js at line #19 <br />
79
-
```
80
-
var urnstg = 'your_urn_here';
81
-
```
82
-
* In /www/views/index.js, around line #24, make sure the variable staging is true.
83
-
* In /www/views/index.html (line $33 and #34), use viewer3D.min.js and style.css from the staging environment <br />
* Run the server from the Node.js console, by running the following command: <br />
90
-
```
91
-
node server.js
92
-
```
93
-
* Connect to you local server using a WebGL-compatible browser: [http://localhost:3000/](http://localhost:3000/)
70
+
* Instructions to setup this sample using someone else credentials are available [here](https://github.com/Developer-Autodesk/workflow-node.js-view.and.data.api/blob/master/README-option.md)
94
71
95
72
96
73
## License
97
74
98
75
That samples are licensed under the terms of the [MIT License](http://opensource.org/licenses/MIT). Please see the [LICENSE](LICENSE) file for full details.
99
76
77
+
100
78
## Written by
101
79
102
-
Written by [Philippe Leefsma](http://adndevblog.typepad.com/cloud_and_mobile/philippe-leefsma.html)
80
+
Written by [Philippe Leefsma](http://adndevblog.typepad.com/cloud_and_mobile/philippe-leefsma.html) <br />
0 commit comments