Message 1 of 11
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm using the following code to try to get all exterior Walls using GetBoundarySegments .
Specifically I'm creating a huge room at the model extents, then identifying walls inside that room. (see image)
def GetWallsFromRoomBoundaries(doc, room):
ids = []
loops = room.GetBoundarySegments( SpatialElementBoundaryOptions() )
for loop in loops:
for segment in loop:
print(segment)
neighbor= doc.GetElement(segment.ElementId)
print(neighbor)
if neighbor.GetType().ToString() == "Autodesk.Revit.DB.Wall":
ids.Add(neighbor.Id)
return ids
print(segments) outputs 2 loops;
- the 4 outside room boundaries
- an array of all the boundary segments of the walls (image above)
But print(neighbor) outputs only 2 wall elements.
I'm confused as to why doc.GetElement(segment.ElementId) doesn't work as expected.
I'm using Revit 2019, and I understood from the Revit API Documentation that segment.Element is deprecated so I can't use that directly to get the element touching the room boundary.
Any ideas?
Thanks
Solved! Go to Solution.