autodesk forge,加载图形显示黑色
加载模型,容器变黑色了.
一开始以为是我的程序的问题.但是用例子的代码试了一下,也一样.
是服务端出问题了吗?
下面是例子的源码.以前是可以的.现在不行了.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="https://developer.api.autodesk.com/viewingservice/v1/viewers/three.min.css"></script>
<link rel="stylesheet" href="https://developer.api.autodesk.com/viewingservice/v1/viewers/style.min.css" />
<script src="https://developer.api.autodesk.com/viewingservice/v1/viewers/viewer3D.min.js"></script>
</head>
<body onload="initialize()">
<div id="viewer" style="position:absolute; width:90%; height:90%;"></div>
<script>
function authMe () { return ('eyJhbGciOiJIUzI1NiIsImtpZCI6Imp3dF9zeW1tZXRyaWNfa2V5In0.eyJjbGllbnRfaWQiOiJIalFGcGpyU0JIM3EyMkJETVZGUGdZYjdzVkFZRmFiSiIsImV4cCI6MTUyMDI1OTMzNywic2NvcGUiOlsiZGF0YTpyZWFkIiwiZGF0YTp3cml0ZSIsImJ1Y2tldDpjcmVhdGUiLCJidWNrZXQ6cmVhZCJdLCJhdWQiOiJodHRwczovL2F1dG9kZXNrLmNvbS9hdWQvand0ZXhwNjAiLCJqdGkiOiJhc294RjJQU3Q3VGVORkh1TXVDWWV3b052cnFpRWU5VjREbkxCZUhFeVZDcnJSWnZ3V1FwbW83M0tDYzM1NzBEIn0.0mkXxMhJ-JRYjD7qjLcM3IOinShEV-kqLJMzQhvDVzA') ; }
function initialize () {
var options ={
'document' : "urn:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Zm9yZ2UtY3NoYXJwLXNhbXBsZS1hcHAtaGpxZnBqcnNiaDNxMjJiZG12ZnBneWI3c3ZheWZhYmovbXktZWxlcGhhbnQub2Jq",
'env': 'AutodeskProduction',
'getAccessToken': authMe
} ;
var viewerElement =document.getElementById ('viewer') ;
//var viewer =new Autodesk.Viewing.Viewer3D (viewerElement, {}) ; / No toolbar
var viewer =new Autodesk.Viewing.Private.GuiViewer3D (viewerElement, {}) ; // With toolbar
Autodesk.Viewing.Initializer (options, function () {
viewer.initialize () ;
loadDocument (viewer, options.document) ;
}) ;
}
function loadDocument (viewer, documentId) {
// Find the first 3d geometry and load that.
Autodesk.Viewing.Document.load (
documentId,
function (doc) { // onLoadCallback
var geometryItems =[] ;
geometryItems =Autodesk.Viewing.Document.getSubItemsWithProperties (
doc.getRootItem (),
{ 'type' : 'geometry', 'role' : '3d' },
true
) ;
if ( geometryItems.length <= 0 ) {
geometryItems =Autodesk.Viewing.Document.getSubItemsWithProperties (
doc.getRootItem (),
{ 'type': 'geometry', 'role': '2d' },
true
) ;
}
if ( geometryItems.length > 0 )
viewer.load (
doc.getViewablePath (geometryItems [0])//,
//null, null, null,
//doc.acmSessionId /*session for DM*/
) ;
},
function (errorMsg) { // onErrorCallback
alert("Load Error: " + errorMsg) ;
}//,
//{
// 'oauth2AccessToken': authMe (),
// 'x-ads-acm-namespace': 'WIPDM',
// 'x-ads-acm-check-groups': 'true',
//}
) ;
}
</script>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
建议您发一个不含个人或公司机敏信息的测试工程(含模型)到 forge.help@autodesk.com,这需要调试后才能知道发生了什么事,谢谢