Properties of first model get erased when loading a secod model

Viewed 37

We have a custom action in the forge viewer with loads an additonal into the viewer. We load at start an inital modal which works fine. The properties of the model we correctly shown. Than we load a second modal with viewer.loadModel(...) in behind. The following options we set. return { placementTransform: mat, globalOffset: globalOffset, sharedPropertyDbPath: bubbleNode.getViewableRootPath(), applyScaling: displayUnit, }; The second model is showed correctly togheter with the first one in the viewer. when clicking on a part in the second model, the properties of it will be showed. when clicking on a part in the first model. The properties are empty.

There were no information on the api guideline of forge regarding setting some properties to work. Is this at all working or is this case currently impossible?

I already have tried to update the forge-viewer from 7.53.0 to 7.55.0 with no further progess.

1 Answers

When aggregating multiple models in the scene, their properties can still be accessed as usual. I just tried loading two models in a simple Forge app (using Forge Viewer version 7.55) following this blog post, and the properties show up for all elements:

enter image description here enter image description here

This is how I'm loading the models:

function loadModel(viewer, urn, xform, offset) {
    return new Promise(function (resolve, reject) {
        function onDocumentLoadSuccess(doc) {
            const viewable = doc.getRoot().getDefaultGeometry();
            const options = {
                preserveView: true,
                keepCurrentModels: true
            };
            if (xform) {
                options.placementTransform = xform;
            }
            if (offset) {
                options.globalOffset = offset;
            }
            viewer.loadDocumentNode(doc, viewable, options)
                .then(resolve)
                .catch(reject);
        }
        function onDocumentLoadFailure(code, message) {
            reject(message);
        }
        Autodesk.Viewing.Document.load('urn:' + urn, onDocumentLoadSuccess, onDocumentLoadFailure);
    });
}
Related