繁体   English   中英

如何使用带有 C# 的宏从 Revit 中的链接中获取元素?

[英]How to get elements from links in Revit using macros with C#?

如何使用 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);

这是一个关于访问 lined element的讨论,其中包含一些指向进一步相关讨论的指针。

暂无
暂无

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

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