[英]Get Linked Elements that Appear on Schedule Revit API
Using the Revit API (2017 and above), is there any way to get a list of linked elements that appear on the schedule (including filters, phase filters, etc). 使用Revit API(2017及更高版本),可以通过任何方式获取时间表中出现的链接元素的列表(包括过滤器,相位过滤器等)。
Currently, if you query a ViewSchedule using the FilteredElementCollector, it will return N Elements (eg Windows, Doors) and M RevitLinkInstances. 当前,如果您使用FilteredElementCollector查询ViewSchedule,它将返回N个元素(例如Windows,Doors)和M个RevitLinkInstances。 However, the RevitLinkInstance does not list out the actual Element that appears in the linked model.
但是,RevitLinkInstance不会列出链接模型中出现的实际元素。 Is there a way to query in RevitLinkInstance in the scope of the ViewSchedule?
在ViewSchedule范围内是否可以在RevitLinkInstance中进行查询? Or a similar solution?
或类似的解决方案?
I have managed to get it to work by passing the Schedule Id to a new fileteredElementCollector like this: 我设法通过将Schedule ID传递给新的fileteredElementCollector来使其工作,如下所示:
schedule = doc.ActiveView
scheduledElements = list(FilteredElementCollector(doc, schedule.Id))
allElements = []
for element in scheduledElements:
if element.Category.Name == 'RVT Links':
linkedElements = list(FilteredElementCollector(element.GetLinkDocument(), schedule.Id))
for linkedElement in linkedElements:
allElements.Add(linkedElement)
else:
allElements.Add(element)
for element in allElements:
print element
Let me know if that worked for you aswell 让我知道这是否对您也有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.