【问题标题】:Viewing Revit Drafting Views with the Forge API's使用 Forge API 查看 Revit 绘图视图
【发布时间】:2019-11-06 04:33:10
【问题描述】:

似乎可以使用 Forge API 查看和导航 Revit Drafting View(s) 图形,基于 BIM 360 Document Management Web 浏览器界面如何与我们自己的 Revit (.rvt) 模型一起发布 Drafting Views 其中它在左侧面板中列出了 2D 绘图视图(缩略图),并在右侧查看器中列出了所选绘图视图的实际细节。我们确实有一个较新的 Forge API Viewer 示例设置和工作,并尝试修改它的一些代码,但似乎被设计为仅适用于左侧面板中的模型 (.rvt) 组件,它在哪里并不明显以及需要修改哪些代码才能将其更改为像 Document Manager 那样列出 2D 图纸/视图。我们很难找到一个展示如何使用 Forge API 执行此操作的 Forge API 示例,并且希望获得一个说明如何使用 Forge API 执行此操作的工作示例?

尝试更改 ViewingApplication.bubble.search 以包含角色 2d 类型视图

function onDocumentLoadSuccess(doc) {
// We could still make use of Document.getSubItemsWithProperties()
// However, when using a ViewingApplication, we have access to the 

*bubble** 属性, // 它引用了一个图表的根节点,该图表包装了 Manifest JSON 中的每个对象。 //var viewables = viewerApp.bubble.search({ 'type': 'geometry' }); var viewables = viewerApp.bubble.search({ 'role': '2d', 'type': 'view' }); if (viewables.length === 0) { console.error('文档不包含任何可视项。'); 返回; }

【问题讨论】:

    标签: autodesk-forge


    【解决方案1】:

    绘图视图是一种二维角色几何体,因此您可以使用与二维视图相同的方式加载它。

    const rootItem = doc.getRoot();
    const filter = { type: 'geometry', role: '2d' };
    const viewables = rootItem.search( filter );
    
    if( viewables.length === 0 ) {
        return onLoadModelError( 'Document contains no viewables.' );
    }
    
    // Take the first viewable out as the loading target
    const initialViewable = viewables[0];
    
    const loadOptions = {
        sharedPropertyDbPath: doc.getPropertyDbPath()
    };
    
    viewer.loadDocumentNode(doc, initialViewable.data, modelOptions).then(onItemLoadSuccess).catch(onItemLoadFail); 
    

    要显示像 BIM360 Docs 这样的视图列表,您可以加载 Autodesk.DocumentBrowser 扩展。它将在其上显示可查看的项目,只需单击它即可切换。见下图:

    【讨论】:

      猜你喜欢
      • 2017-09-23
      • 1970-01-01
      • 2017-01-14
      • 2019-12-10
      • 2018-07-16
      • 2015-04-04
      • 2019-01-17
      • 2020-11-02
      • 2021-06-27
      相关资源
      最近更新 更多