【发布时间】:2018-10-02 18:19:32
【问题描述】:
引用此链接... https://forums.autodesk.com/t5/revit-api-forum/door-host-wall/td-p/6951682
考虑到以下 C# sn-p,d 没有 ``d.Host` 属性。
ICollection<Element> doors = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Doors).ToElements();
foreach (Element d in doors)
{
}
但是,在 Python 中...
doors = FilteredElementCollector(self.Document).OfCategory( BuiltInCategory.OST_Doors ).WhereElementIsNotElementType().ToElements()
...
t = Transaction(self.Document, 'This is my new transaction')
t.Start()
for d in doors:
...
wallTypeId = d.Host.GetTypeId()
wall = doc.GetElement(wallTypeId)
我没有问题得到d的主人。
查看 Revit API,我没有看到对元素的主机方法或属性的引用,但是,使用 RevitLookUp 并窥探一扇门,主机是可以清楚地确定的。
为什么我不能在 C# 中收集主机?为什么它可以在 Python 中工作,即使 Element 似乎没有名为 Host 的属性?
【问题讨论】: