【问题标题】:Ascertaining a doors host in the Revit API在 Revit API 中确定门主机
【发布时间】: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 的属性?

【问题讨论】:

    标签: host revit


    【解决方案1】:

    每个门元素都是一个FamilyInstance 对象,并且具有Host 属性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-30
      • 1970-01-01
      • 2014-10-04
      • 2020-04-26
      • 2019-08-06
      • 2021-08-14
      • 2019-09-21
      • 2010-12-04
      相关资源
      最近更新 更多