Unfortunately, the setThemingColor function only works after the geometries have been loaded. Geometry loading occurs after object tree loading is complete by default. Therefore, it's not supported to set theming colors before the object tree loading is complete.
However, here are approaches you can consider.
- Only load partial model contents using selective loading: Viewer can do selective loading for SVF2 models. Therefore, we can load the objects of interest into the viewer to minimize the viewer's workload. See https://aps.autodesk.com/en/docs/viewer/v7/developers_guide/advanced_options/selective-loading/
const viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('viewer'));
Autodesk.Viewing.Initializer(options, () => {
viewer.start();
Autodesk.Viewing.Document.load(documentID, onDocumentLoadSuccess,
() => console.error('Failed to fetch the manifest.'));
});
function onDocumentLoadSuccess(viewerDocument) {
const defaultModel = viewerDocument.getRoot().getDefaultGeometry();
viewer.loadDocumentNode(viewerDocument, defaultModel, { // ...options
filter: {
"spatial_query": {
"$encloses": [ { "aabox": [ -21.0, 37.0, -4.0, 46.0, 59.0, 21.0 ] } ]
},
"property_query": [
{ "s.props.p4735026f": "'VALV'" },
{ "s.props.p4735026f": "'FBLI'" },
{ "s.props.p4735026f": "'TUBI'" },
{ "s.props.p4735026f": "'INST'" },
{ "s.props.p4735026f": "'ELBO'" },
{ "s.props.p4735026f": "'REDU'" },
{ "s.props.p4735026f": "'ATTA'" },
{ "s.props.p4735026f": "'FLAN'" } ]
}
});
}
- Skip loading properties (including object tree): We can tell the viewer not to load the properties and object tree. But there are some viewer functions that will stop working. You can find more explanations at https://aps.autodesk.com/blog/mimicking-viewer-fit-view-without-properties-database
viewer.loadDocumentNode(doc, viewables, { skipPropertyDb: true })