-
Notifications
You must be signed in to change notification settings - Fork 1
/
index - Copy.js
40 lines (33 loc) · 1.1 KB
/
index - Copy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"use strict";
// global viewer
var viewer;
// setup a new model in the viewer
function viewit(modelName, lightPreset) {
var options = {
'document' : modelName,
'env':'Local',
};
var viewerElement = document.getElementById('viewer3D');
viewer = new Autodesk.Viewing.Viewer3D(viewerElement, {});
Autodesk.Viewing.Initializer(options,function() {
viewer.initialize();
//viewer.addEventListener (Autodesk.Viewing.GEOMETRY_LOADED_EVENT, function (event) {
// setTimeout (function () { orient_view(); }, 100) ;
// }) ;
viewer.load(options.document);
viewer.setLightPreset(lightPreset);
});
}
// tell the viewer to fit the geometry to the view extents.
function orient_view () {
if (viewer != null) {
var front = new THREE.Vector3(0, -1, 0);
viewer.navigation.setPosition(front);
viewer.fitToView (true) ;
viewer.createViewCube();
viewer.displayViewCube(true);
} else{
console.log("viewer is null");
}
}
viewit( "https://kevinvandecar.github.io/assets/forge_logo/forge.SVF", 7);