在 Revit 2017 中获取房间的邻居 API

Get a room's neighbours within Revit 2017 API

我正在尝试浏览建筑物的所有房间(或者实际上是所有 空间 ),以便获得相邻 空间的列表 这些 个空间 中的每一个。我读过一些关于它的很老的帖子 here and here,但是这些使用了 BoundarySegment 对象的 "Element" 属性,例如:

foreach( BoundarySegment s in b )
...
Element neighbour = s.Element;

如果我没记错的话,这不再可能从 BoundarySegment 访问墙对象(?)有替代方法吗?

谢谢,

阿尔诺。

已达到 http://www.revitapidocs.com

搜索 BoundarySegment class。

我收到消息:“2017 | 活动 API 年资源不可用...资源仅适用于 2015”。

查看 Revit 2017 中的新增功能API:

http://thebuildingcoder.typepad.com/blog/2016/04/whats-new-in-the-revit-2017-api.html

已过时的 API 删除列表 Autodesk.Revit.DB.BoundarySegment.Element。

你上面提到的两个帖子是:

http://thebuildingcoder.typepad.com/blog/2013/09/room-neighbours.html

http://thebuildingcoder.typepad.com/blog/2009/01/room-and-wall-adjacency.html

它们中提供的所有代码都包含在 The Building Coder 示例中:

https://github.com/jeremytammik/the_building_coder_samples

Building Coder 示例在 GitHub 上维护,并在出现时迁移到新版本的 Revit API。因此,您可以在 GitHub、

上查看如何在 Revit 2017 中实现相同的功能

https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdRoomWallAdjacency.cs

https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdRoomNeighbours.cs