使用Autodesk Large Model Viewer查看从ACC创建的点云的ReCap文件。
代码示例:
var lmvDocumentId;
function viewPointCloud (reCapFileUrl) {
Autodesk.Viewing.Initializer({ env: 'AutodeskProduction' }, () => {
const options = {
env: 'AutodeskProduction',
accessToken: '
Autodesk.Viewing.Document.load(documentId, (doc) => {
const rootItem = doc.getRootItem();
const geometryItems = Autodesk.Viewing.Document.getSubItemsWithProperties(rootItem, {
'type': 'geometry',
'role': '3d'
}, true);
if (geometryItems.length === 0) {
console.error('No 3D geometry found in file');
return;
}
lmvDocumentId = doc.getDocumentNode().getDocumentId();
const viewerDiv = document.getElementById('viewer');
const viewer = new Autodesk.Viewing.Private.GuiViewer3D(viewerDiv);
viewer.start();
const modelUrl = doc.getViewablePath(geometryItems[0]);
Autodesk.Viewing.Document.load(modelUrl, (modelDoc) => {
const viewables = modelDoc.getRoot().search({
'type': 'geometry',
'role': '3d'
});
viewer.loadDocumentNode(modelDoc, viewables[0], {
keepCurrentModels: true
});
}, (err) => {
console.error('Error loading model');
console.error(err);
});
}, (err) => {
console.error('Error loading ReCap file');
console.error(err);
});
}); }
// Example usage:
viewPointCloud('https://developer.api.autodesk.com/project/v1/buckets/