I am loading a very large svf2 model and need to color its elements by a certain status.

The problem I’m having is that the object tree takes a very long time to download in the viewer.

Given that I identify the elements by a specific property and don’t know the objectids upfront, what’s the fastest way to get setThemingColor?

I’ve considered downloading the SQLite but that only works for svf1 objectids. FerchAllProperties endpoint fails for this model because it’s too large.

2 Replies 2

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.

  1. 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'" } ]
        }
    });
}
  1. 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 })

So the objectTree is not required to setThemingColor? The geometry_loaded event doesn't seem to fire when skipPropertyDb: true

Your Reply

By clicking “Post Your Reply”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.