【发布时间】:2020-04-18 15:15:38
【问题描述】:
如何使用 C# 语言中的宏从链接模型列表中获取某个类别的元素到我的项目中?我应用了 FilteredElementCollector 并获取了链接,但是我无法让 GetLinkedDocument 对其进行迭代并获取我想要获取的元素。 希望我的问题很清楚。
//Get Document:
Document doc = this.Document;
//Get links:
FilteredElementCollector links = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_RvtLinks);
//Get elements:
string names = "";
foreach (Element e in links)
{
FilteredElementCollector coll = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_PlumbingFixtures);
names += coll + "\n" + "\n";
}
//Mostrar resultado:
TaskDialog.Show("Document", "Document Name " + "\n" + "\n" + names);
【问题讨论】: