Autodesk Revit MEP 2010 .NET API C# 房间到门的关系
在 C# 中使用 VS 2008 和 Autodesk Revit MEP 2010 我试图查明门是否连接到房间:
ElementSetIterator elementsetiteratorBIMDoors =
bimdoors.getBIMDoors().ForwardIterator();
while (elementsetiteratorBIMDoors.MoveNext())
{
Autodesk.Revit.Element elementDoor =
elementsetiteratorBIMDoors.Current as Autodesk.Revit.Element;
if ((null != elementDoor.get_Parameter(BuiltInParameter.FROM_ROOM_ID)) &&
(null != elementDoor.get_Parameter(BuiltInParameter.TO_ROOM_ID)))
{
string sDoorFromRoomID =
elementDoor.get_Parameter(BuiltInParameter.FROM_ROOM_ID).ToString();
string sDoorToRoomID =
elementDoor.get_Parameter(BuiltInParameter.TO_ROOM_ID).ToString();
graph.addLink(new Link(sDoorFromRoomID, sDoorToRoomID));
}
}
此方法不起作用,因为 elementDoor.get_Parameter(BuiltInParameter.FROM_ROOM_ID) 的返回值
始终为null
。
我在 Building Coder 博客上读到
内置参数不是 API 的官方支持部分。在 未来我们预计它将被正确公开的数据所取代 属性。
这种说法属实吗?谁能指出一种有效的方法来获取门和房间之间的关系?
Working with VS 2008 and Autodesk Revit MEP 2010 in C# I am trying to find out if a door is connecting to rooms:
ElementSetIterator elementsetiteratorBIMDoors =
bimdoors.getBIMDoors().ForwardIterator();
while (elementsetiteratorBIMDoors.MoveNext())
{
Autodesk.Revit.Element elementDoor =
elementsetiteratorBIMDoors.Current as Autodesk.Revit.Element;
if ((null != elementDoor.get_Parameter(BuiltInParameter.FROM_ROOM_ID)) &&
(null != elementDoor.get_Parameter(BuiltInParameter.TO_ROOM_ID)))
{
string sDoorFromRoomID =
elementDoor.get_Parameter(BuiltInParameter.FROM_ROOM_ID).ToString();
string sDoorToRoomID =
elementDoor.get_Parameter(BuiltInParameter.TO_ROOM_ID).ToString();
graph.addLink(new Link(sDoorFromRoomID, sDoorToRoomID));
}
}
This approach does not work because the return value of elementDoor.get_Parameter(BuiltInParameter.FROM_ROOM_ID)
is always null
.
I have read on the Building Coder blog that
Built-in parameters are not an officially supported portion of API. In
future we expect it will be replaced by data being properly exposed as
a property.
Is that statement true? Can anyone point me to an efficient way to get the relation between doors and rooms?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
门是家庭实例,因此
应该适用于此。
Doors are family instances, so
should work for this.