import { getAccessToken } from 'https://aps-codepen.autodesk.io/utils.js';
const URN = 'dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6YXBzLWNvZGVwZW4tYmFja2VuZC8wMV9yYWNfYmFzaWNfc2FtcGxlX3Byb2plY3QucnZ0';
function loadModel(viewer, urn, options) {
Autodesk.Viewing.Document.load(
'urn:' + urn,
doc => viewer.loadDocumentNode(doc, doc.getRoot().getDefaultGeometry(), options),
(code, message, errors) => {
console.error(code, message, errors);
alert('Could not load model. See console for more details.');
}
);
}
Autodesk.Viewing.Initializer({ getAccessToken, api: 'streamingV2' }, function () {
const viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('viewer'));
viewer.start();
loadModel(viewer, URN, {
filter: {
property_query: {
'?Base Constraint': "'Level 1'", // "Base Constraint" is set to "Level 1"
// ... and ...
'$gt': ['?Volume', 5.0] // "Volume" is greater than 5.0 units
}
}
});
});