简体   繁体   中英

Properties of first model get erased when loading a secod model

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.

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:

在此处输入图片说明 在此处输入图片说明

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);
    });
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM