Message 1 of 2
How to get the bounding segments of a room?

Not applicable
08-07-2017
06:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am using the following code: I am trying to get all the bounding segments of each room. But the list is not getting populated by the method of the Rooms class.
room.GetBoundarySegments(boundaryOptions);
private List<int> GetElementIdsOfWallsEnclosingRooms() { List<int> elementIdsOfWalls = new List<int>(); Document doc = commandData.Application.ActiveUIDocument.Document; FilteredElementCollector collector = new FilteredElementCollector(doc); collector.OfCategory(BuiltInCategory.OST_Rooms); IList<IList<BoundarySegment>> boundarySegments; foreach (Room room in collector) { SpatialElementBoundaryOptions boundaryOptions = new SpatialElementBoundaryOptions(); boundaryOptions.SpatialElementBoundaryLocation = SpatialElementBoundaryLocation.CoreCenter; boundaryOptions.StoreFreeBoundaryFaces = true;
boundarySegments = room.GetBoundarySegments(boundaryOptions); IList<BoundarySegment> boundarySegmentList = boundarySegments.ElementAt(0); foreach (BoundarySegment boundarySegment in boundarySegmentList) { elementIdsOfWalls.Add(boundarySegment.ElementId.IntegerValue); } } return elementIdsOfWalls; }
Is there any problem with SpecialElementBoundaryOptions?
The value inside boundarySegments has 0 lists.