This commit is contained in:
dev01 2022-11-25 09:11:09 +08:00
commit f5a3e6af2a
2 changed files with 13 additions and 13 deletions

View File

@ -7,8 +7,8 @@
<body> <body>
<link rel="shortcut icon" href="https://github.com/Autodesk-Forge/learn.forge.viewmodels/raw/master/img/favicon.ico"> <link rel="shortcut icon" href="https://github.com/Autodesk-Forge/learn.forge.viewmodels/raw/master/img/favicon.ico">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jstree/3.3.7/themes/default/style.min.css" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.7/themes/default/style.min.css" />
<!-- Autodesk Forge Viewer files --> <!-- Autodesk Forge Viewer files -->
<link rel="stylesheet" href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.min.css" type="text/css"> <link rel="stylesheet" href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.min.css" type="text/css">
@ -31,24 +31,24 @@
<!--Base JS--> <!--Base JS-->
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>
<script src="lib//vendors.bundle.js"></script> <!--<script src="lib//vendors.bundle.js"></script>
<script src="lib//app.bundle.js"></script> <script src="lib//app.bundle.js"></script>-->
<!-- JQuery Validate --> <!-- JQuery Validate -->
<script src="lib/jquery-validation/dist/jquery.validate.js"></script> <!--<script src="lib/jquery-validation/dist/jquery.validate.js"></script>
<script src="lib/jquery-validation/dist/additional-methods.min.js"></script> <script src="lib/jquery-validation/dist/additional-methods.min.js"></script>
<script src="lib/jquery-validation/dist/localization/messages_zh_TW.js"></script> <script src="lib/jquery-validation/dist/localization/messages_zh_TW.js"></script>
<script src="lib/notifications/sweetalert2/sweetalert2.bundle.js"></script> <script src="lib/notifications/sweetalert2/sweetalert2.bundle.js"></script>
<script src="lib/notifications/toastr/toastr.js"></script> <script src="lib/notifications/toastr/toastr.js"></script>
<script src="js/toast.js"></script> <script src="js/toast.js"></script>-->
<script src="js/init.js"></script> <script src="js/init.js"></script>
<!-- Common packages: jQuery, Bootstrap, jsTree --> <!-- Common packages: jQuery, Bootstrap, jsTree -->
<!--<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>--> <!--<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>-->
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jstree/3.3.7/jstree.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.7/jstree.min.js"></script>
<script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.js"></script> <script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.js"></script>
<!-- <script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.16/viewer3D.js"></script> --> <!-- <script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.16/viewer3D.js"></script> -->
<script src="/js/forge/forgemodel.js"></script> <script src="js/forge/forgemodel.js"></script>
<script> <script>

View File

@ -64,13 +64,13 @@ function launchViewer(urn) {
//test //test
for (let i = 0; i < urns.length; i++) { for (let i = 0; i < urn.length; i++) {
Autodesk.Viewing.Document.load(urns[i]["urn"], async (doc) => { Autodesk.Viewing.Document.load(urn[i]["urn"], async (doc) => {
let viewables = doc.getRoot().getDefaultGeometry(); let viewables = doc.getRoot().getDefaultGeometry();
let model = await viewer.loadDocumentNode(doc, viewables, { let model = await viewer.loadDocumentNode(doc, viewables, {
preserveView: false, preserveView: false,
keepCurrentModels: true, keepCurrentModels: true,
placementTransform: (new THREE.Matrix4()).setPosition(urns[i]["xform"]), placementTransform: (new THREE.Matrix4()).setPosition(urn[i]["xform"]),
keepCurrentModels: true, keepCurrentModels: true,
globalOffset: { globalOffset: {
x: 0, x: 0,
@ -262,7 +262,7 @@ function onDocumentLoadFailure(viewerErrorCode) {
} }
function getForgeToken(callback) { function getForgeToken(callback) {
fetch('http://localhost:3604/api/forge/oauth/token').then(res => { fetch(baseApiUrl + '/api/forge/oauth/token').then(res => {
res.json().then(data => { res.json().then(data => {
callback(data.dictionary.access_token, data.dictionary.expires_in); callback(data.dictionary.access_token, data.dictionary.expires_in);
}); });