这个问题可以通过在加载模型时添加bubbleOverlays: true
参数来解决。例如:
var viewer;
var options = {
env: 'AutodeskProduction',
getAccessToken: function(onTokenReady) {
var accessToken = 'YOUR_ACCESS_TOKEN';
var expireTimeSeconds = 60 * 30;
onTokenReady(accessToken, expireTimeSeconds)
},
api: 'derivativeV2',
bubbleOverlays: true // 添加bubbleOverlays参数
};
Autodesk.Viewing.Initializer(options, function() {
viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('viewer'));
var documentId = 'YOUR_URN';
Autodesk.Viewing.Document.load(documentId, function(doc) {
var viewables = doc.getRoot().getDefaultGeometry();
viewer.loadDocumentNode(doc, viewables).then(function(result) {
console.log('加载完成');
});
}, function(error) {
console.log('加载失败');
});
});