【问题标题】:What is the difference between viewableID and guid?viewableID 和 guid 有什么区别?
【发布时间】:2019-03-20 08:22:33
【问题描述】:

在 Forge 查看器中,对于 Revit 转换文件,进行气泡搜索时: viewerApp.bubble.search({ 'type': 'geometry', 'role': '3d' }); 要么 viewerApp.getSelectedItem()

我得到一个元素节点,例如:

children: (2) [a, a]
data: {guid: "a21582db-704b-df51-dd71-dbf8c12bcc1a", type: "geometry", role: "3d", name: "{3D}", viewableID: "6104055e-60d9-4037-9adc-cd38e10fcfba-00139c8e", …}
id: 8
isLeaf: true
parent: a {parent: a, id: 7, data: {…}, isLeaf: false, children: Array(14)}

我有节点的 guid 和一个 viewableID。 然后,为了显示一个模型,我可以调用 viewerApp.selectItemById(guid/viewableID),结束显示相同的模型。

如果我想指向我当前在查看器中看到的 3D 视图,以供将来参考(例如,在 revit 文件更新之后),它的最佳属性是 guid 还是 viewableID?

谢谢,

【问题讨论】:

    标签: autodesk-forge autodesk-viewer


    【解决方案1】:

    可视id代表Revit API中Revit视图的唯一ID作为我的研究,但是我在可视气泡节点中找不到Revit视图和guid之间的关系。我正在与我们的工程团队核实他们是否有一些见解。

    viewerApp.selectItemById() 用于通过其'guid 查询气泡节点,因此您不能将可视 id 传递给它。否则,它不会作为我的调查返回任何内容。

    要通过可查看的 id 归档选择,我建议您改用以下方法:

    const bubbles = viewerApp.bubble.search({ 'viewableID': '6104055e-60d9-4037-9adc-cd38e10fcfba-00139c8e' });
    
    viewerApp.selectItemById( bubbles[0].guid );
    

    或扩展您自己的方法(使用 v6.2 测试):

    LMV.BubbleNode.prototype.findByViewableId = function (viewableId) {
        let item = null;
    
        this.traverse(function (node) {
            if (node.data.viewableID === viewableId) {
                item = node;
                return true;
            }
        });
    
        return item;
    };
    
    LMV.ViewingApplication.prototype.selectItemViewableId = function (viewableId, onItemSelectedCallback, onItemFailedToSelectCallback) {
        let item = this.myDocument.getRoot().findByViewableId(viewableId);
        if (item) {
            return this.selectItem(item, onItemSelectedCallback, onItemFailedToSelectCallback);
        }
        return false;
    };
    
    // -- You codes where you create the ViewingApplication instance
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-17
      • 2011-10-18
      • 2010-10-02
      • 2011-12-12
      • 2010-09-16
      • 2012-03-14
      • 2012-02-06
      • 2011-02-25
      相关资源
      最近更新 更多