/***************************************************/ /**** Private Methods ****/ /***************************************************/ private static oM.Physical.Elements.Roof SolidRoofFromRevit(this RoofBase roof, RevitSettings settings = null, Dictionary <string, List <IBHoMObject> > refObjects = null) { ISurface location = null; List <BH.oM.Physical.Elements.IOpening> openings = new List <oM.Physical.Elements.IOpening>(); Dictionary <PlanarSurface, List <PlanarSurface> > surfaces = null; BoundingBoxXYZ bbox = roof.get_BoundingBox(null); if (bbox != null) { BoundingBoxIntersectsFilter bbif = new BoundingBoxIntersectsFilter(new Outline(bbox.Min, bbox.Max)); IList <ElementId> insertIds = (roof as HostObject).FindInserts(true, true, true, true); List <Element> inserts; if (insertIds.Count == 0) { inserts = new List <Element>(); } else { inserts = new FilteredElementCollector(roof.Document, insertIds).WherePasses(bbif).ToList(); } List <FamilyInstance> windows = inserts.Where(x => x is FamilyInstance && x.Category.Id.IntegerValue == (int)BuiltInCategory.OST_Windows).Cast <FamilyInstance>().ToList(); List <FamilyInstance> doors = inserts.Where(x => x is FamilyInstance && x.Category.Id.IntegerValue == (int)BuiltInCategory.OST_Doors).Cast <FamilyInstance>().ToList(); surfaces = roof.PanelSurfaces(windows.Union(doors).Select(x => x.Id), settings); if (surfaces != null) { List <ISurface> locations = new List <ISurface>(surfaces.Keys); if (locations.Count == 1) { location = locations[0]; } else { location = new PolySurface { Surfaces = locations } }; foreach (List <PlanarSurface> ps in surfaces.Values) { openings.AddRange(ps.Select(x => new BH.oM.Physical.Elements.Void { Location = x })); } foreach (FamilyInstance window in windows) { BH.oM.Physical.Elements.Window bHoMWindow = window.WindowFromRevit(roof, settings, refObjects); if (bHoMWindow != null) { openings.Add(bHoMWindow); } } foreach (FamilyInstance door in doors) { BH.oM.Physical.Elements.Door bHoMDoor = door.DoorFromRevit(roof, settings, refObjects); if (bHoMDoor != null) { openings.Add(bHoMDoor); } } } } if (surfaces == null || surfaces.Count == 0) { roof.NoPanelLocationError(); } return(new oM.Physical.Elements.Roof { Location = location, Openings = openings }); }