簡體   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