Get FamilyInstance from room

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to get all the instances from the room with the following code. But he behaves differently. Sometimes he does not see the door, sometimes he sees a door, sometimes he finds an element of a door. Why is this happening?
foreach (Face face in geomsolidfaceslist)
{
List<Element> listelementfromwall = new List<Element>();
IList<SpatialElementBoundarySubface> subfaceList1 = results.GetBoundaryFaceInfo(face); // get the sub-faces for the face of the room
foreach (SpatialElementBoundarySubface subface in subfaceList1)
{
ElementId elemid = subface.SpatialBoundaryElement.HostElementId;
Element elem = doc.GetElement(elemid);
if (elem is Wall)
{
Wall wall = elem as Wall;
IList<ElementId> op = wall.FindInserts(true, true, true, true);
foreach (ElementId elementId in op)
{
listelementfromwall.Add(doc.GetElement(elementId));
}
}
}}