简体   繁体   English

加载第二个模型时,第一个模型的属性被删除

[英]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.然后我们在后面加载带有 viewer.loadModel(...) 的第二个模式。 The following options we set.我们设置了以下选项。 return { placementTransform: mat, globalOffset: globalOffset, sharedPropertyDbPath: bubbleNode.getViewableRootPath(), applyScaling: displayUnit, };返回 {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. Forge 的 api 指南中没有关于设置某些属性以工作的信息。 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.我已经尝试将 forge-viewer 从 7.53.0 更新到 7.55.0,没有进一步的进展。

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:我只是尝试在此博客文章之后在一个简单的 Forge 应用程序(使用 Forge Viewer 7.55 版)中加载两个模型,并且所有元素的属性都显示出来:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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