1

I'm working an application which requires knowledge about which room border which other. In this situation it's relevant to know if a room border is a wall or a room seperator.

 public FindsRoomSeperators(){
        SpatialElementBoundaryOptions options = new SpatialElementBoundaryOptions();
        options.SpatialElementBoundaryLocation = SpatialElementBoundaryLocation.Finish;

        foreach (IList<Autodesk.Revit.DB.BoundarySegment> boundSegList in room.GetBoundarySegments(options))
                {
                    foreach (Autodesk.Revit.DB.BoundarySegment boundSeg in boundSegList)
                            if ((BuiltInCategory)el.Category.Id.IntegerValue == BuiltInCategory.OST_RoomSeparationLines)
                                 //proccess el
                 }
   }

However as the of revit 2017 this code now throws the Method not found: 'Autodesk.Revit.DB.Element Autodesk.Revit.DB.BoundarySegment.get_Element()'. exception suggesting that this method has been removed.

      var geometry = (Solid)room.get_Geometry(new Options()).First();
      var faces = geometry.Faces;

And while this does allow me to judge stuff like whatever or not a floor is standing at an angle it does not tell me which of the edges come from walls and which from room sepeartors.

Ideally I would be able to take the faces we have and check to see if any of the edges of a face is a room seperator. I already have a list of all walls if that helps.

So how does one do this in revit 2017? Preferably without breaking compatability with 2015.

Thijser
  • 2,625
  • 1
  • 36
  • 71
  • the GetBoundarySegments() was not removed from the API on 2017, it still there (not even marked as 'deprecated'). Aren't you missing a reference? – Augusto Goncalves Jul 07 '16 at 12:35
  • The code throws an exception in the foreach loop when called in 2017 but works fine in 2016 . The above method throws the exception: Method not found: 'Autodesk.Revit.DB.Element Autodesk.Revit.DB.BoundarySegment.get_Element()'. – Thijser Jul 07 '16 at 12:42

2 Answers2

2

That's expected and documented on the Revit Platform API Changes and Additions file (see SDK), this method was marked as deprecated on 2016 and was removed on 2017.

Instead you should use ElementId or LinkElementId (see documentation).

foreach (Autodesk.Revit.DB.BoundarySegment boundSeg in boundSegList)
{
  Element el = doc.GetElement(boundSeg.ElementId); // or doc.GetElement(boundSeg.LinkElementId);
  if ((BuiltInCategory)el.Category.Id.IntegerValue == BuiltInCategory.OST_RoomSeparationLines)
  {

  }
}
Augusto Goncalves
  • 8,493
  • 2
  • 17
  • 44
2

The Revit Platform API Changes and Additions documentation that Augusto points to above is also available online:

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

Simply search for BoundarySegment. The get_Element method that you are missing is actually a wrapper for the Element property, which was removed in Revit 2017.

A sample demonstrating the use of the .NET Reflection library to support different functionality in different versions of Revit is provided by The Building Coder at

http://thebuildingcoder.typepad.com/blog/2012/07/multi-version-add-in.html

Jeremy Tammik
  • 7,333
  • 2
  • 12
  • 17