Autodesk.Revit.UI.ExternalApplicationArrayIterator
是针对 Revit 的一个类,用于枚举 Revit 外部应用程序的集合。
使用 Autodesk.Revit.UI.ExternalApplicationArrayIterator
可以枚举 Revit 中加载的所有外部应用程序。该类的构造函数需要一个 IList<ExternalApplication>
类型的参数,该参数是一个包含 Revit 所加载的所有外部应用程序的集合。
// 获取 Revit 中所有的外部应用程序
var externalApps = ExternalApplicationRegistry.ExternalApplications;
// 创建 ExternalApplicationArrayIterator 实例
var externalAppIterator = new ExternalApplicationArrayIterator(externalApps);
// 遍历外部应用程序集合
while (externalAppIterator.MoveNext())
{
var externalApp = externalAppIterator.Current;
// 对外部应用程序进行处理
}
在枚举外部应用程序集合后,需要对每一个外部应用程序进行处理,处理的方式取决于具体的业务需求和外部应用程序的功能。在处理一些涉及到 Revit 对象的操作时,需要调用 Autodesk.Revit.UI.ExternalCommandData
类。
var externalCommandData = new ExternalCommandData(RevitApp.Application,
RevitApp.ActiveUIDocument.Document, null);
// 调用外部应用程序的操作
externalApp.Execute(externalCommandData);
Autodesk.Revit.UI.ExternalApplicationArrayIterator
需要先获取 Revit 中加载的所有外部应用程序集合。ExternalCommandData
类来处理 Revit 对象。