Message 1 of 4

Not applicable
05-27-2020
05:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there,
I am trying to get all elements that exist(intersects) in a Room that is defined in another(linked) Model.
So in the linked model, I have rooms, and I get their geometry with SpatialElementGeometryCalculator and try to intersect with all elements(FamilyInstance) using ElementIntersectsSolidFilter.
I am able to retrieve some elements that intersect with the roomSolid, but not all elements. For example, I can get duct fittings but not ducts. Can anybody help me if I'm missing out something? I tried to use Element instead of FamilyInstance, which returned nothing.
public List<FamilyInstance> getElementsInTheRoom(Room room)
{
List<FamilyInstance> elementsInTheRoom = new List<FamilyInstance>();
SpatialElementGeometryCalculator calculator = new SpatialElementGeometryCalculator(Global.doc());
SpatialElementGeometryResults results = calculator.CalculateSpatialElementGeometry(room); // compute the room geometry
Solid roomSolid = results.GetGeometry(); // get the solid representing the room's geometry
elementsInTheRoom = new FilteredElementCollector(Global.doc()). OfClass(typeof(FamilyInstance)).WherePasses(new ElementIntersectsSolidFilter(roomSolid)).Cast<FamilyInstance>().ToList();
}
Solved! Go to Solution.