简体   繁体   English

如何使用Revit API拉动文档的初始视图

[英]How to pull the starting view for document using the Revit API

How can I use the Revit API to get the Starting View for a Document ? 如何使用Revit API获取Document的“起始视图Document The equivalent way to access it using the user interface is seen below: 使用用户界面访问它的等效方法如下所示:

开始检视

I used the Revit Lookup tool and browsed through the database to find a class called StartingViewSettings with the property ViewId that will get me the ElementId of the starting view. 我使用Revit查找工具,并在数据库中浏览,找到了一个名为StartingViewSettings的类,该类具有属性ViewId ,该类将使我获得起始视图的ElementId My actual code for getting the view is below 我获取视图的实际代码如下

FilteredElementCollector startingViewSettingsCollector = 
  new FilteredElementCollector(document);
startingViewSettingsCollector.OfClass(typeof(StartingViewSettings));

View startingView = null;

foreach(StartingViewSettings settings in startingViewSettingsCollector)
{
    startingView = (View)document.GetElement(settings.ViewId);
}

Revit查找-初始视图

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

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