views:

259

answers:

1

Hello everyone,

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.FROM_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 http://thebuildingcoder.typepad.com/blog/2009/02/rvtmgddbg.html 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.

Thanks a lot.

+1  A: 

Doors are family instances, so

Autodesk.Revit.Elements.FamilyInstance elementDoor = elementsetiteratorBIMDoors.Current as Autodesk.Revit.Elements.FamilyInstance;

Room fromRoom = elementDoor.FromRoom;
Room toRoom = elementDoor.ToRoom;

should work for this.

Zoinks
Thanks a lot. I missed that approach.
da8