使用Forge API的查看Revit绘图视图 [英] Viewing Revit Drafting Views with the Forge API's

查看:220
本文介绍了使用Forge API的查看Revit绘图视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎可以使用Forge API来查看和导航Revit Drafting View图形,这些图形基于BIM 360文档管理Web浏览器界面如何通过我们自己的Revit(.rvt)模型完成,并在其中发布了Drafting Views.它在左侧面板中列出2D制图视图(缩略图),并在右侧查看器中列出所选制图视图的实际详细信息.我们确实有一个较新的Forge API Viewer示例设置和工作示例,并尝试修改其一些代码,但似乎设计为仅与左侧面板中的Models(.rvt)组件一起使用,其位置不明显以及需要修改哪些代码才能将其更改为列出2D图纸/视图,就像文档管理器一样.我们很难找到一个Forge API示例,该示例说明了如何使用Forge API进行此操作,并且想获得一个工作示例,以说明如何使用Forge API进行此操作?

It seems to be possible to view and navigate Revit Drafting View(s) graphics using the Forge API's based on how the BIM 360 Document Management web browser interface does it with our own Revit (.rvt) model having published Drafting Views where it list the 2D Drafting Views (thumbnails) in the left panel and the actual detail of the selected Drafting View in the right viewer. We do have one of the more recent Forge API Viewer examples setup and working, and tried modifying some of its code, but is seems to be designed to only work with Models (.rvt) components in the left panel, and its not obvious where and what code needs to be modify to change it to list 2D sheets/views like the Document Manager does. We are having difficulty locating a Forge API example that shows how to do this using the Forge API's and would like to obtain a working example that illustrates how to do this using the Forge API's?

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

Tried changing the ViewingApplication.bubble.search to include role 2d type view

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'}); 如果(viewables.length === 0){ console.error('文档不包含可视对象.'); 返回; }

*bubble** attribute, // which references the root node of a graph that wraps each object from the Manifest JSON. //var viewables = viewerApp.bubble.search({ 'type': 'geometry' }); var viewables = viewerApp.bubble.search({ 'role': '2d', 'type': 'view' }); if (viewables.length === 0) { console.error('Document contains no viewables.'); return; }

推荐答案

草稿视图是一种2D角色几何图形,因此您可以以相同的方式将其加载到2D视图中.

The drafting view is kind of 2d role geometry, Therefore you can load it with the same way for the 2D view.

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扩展名.它将在其上显示可见的项目,只需单击它即可进行切换.参见下面的快照:

To show a list of views like the BIM360 Docs, you could load Autodesk.DocumentBrowser extension. It will show viewable items on it, and just click on it to switch. See below snapshot:

这篇关于使用Forge API的查看Revit绘图视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆