/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static oM.Physical.Elements.Roof RoofFromRevit(this RoofBase roof, RevitSettings settings = null, Dictionary <string, List <IBHoMObject> > refObjects = null) { if (roof == null) { return(null); } settings = settings.DefaultIfNull(); oM.Physical.Elements.Roof bHoMRoof = refObjects.GetValue <oM.Physical.Elements.Roof>(roof.Id); if (bHoMRoof != null) { return(bHoMRoof); } List <CurtainGrid> curtainGrids = roof.ICurtainGrids(); if (curtainGrids.Count != 0) { bHoMRoof = roof.CurtainRoofFromRevit(settings, refObjects); } else { bHoMRoof = roof.SolidRoofFromRevit(settings, refObjects); } if (bHoMRoof == null) { return(null); } HostObjAttributes hostObjAttributes = roof.Document.GetElement(roof.GetTypeId()) as HostObjAttributes; string materialGrade = roof.MaterialGrade(settings); oM.Physical.Constructions.Construction construction = hostObjAttributes.ConstructionFromRevit(materialGrade, settings, refObjects); bHoMRoof.Construction = construction; bHoMRoof.Name = roof.FamilyTypeFullName(); //Set identifiers, parameters & custom data bHoMRoof.SetIdentifiers(roof); bHoMRoof.CopyParameters(roof, settings.ParameterSettings); bHoMRoof.SetProperties(roof, settings.ParameterSettings); refObjects.AddOrReplace(roof.Id, bHoMRoof); return(bHoMRoof); }
/***************************************************/ public static List <oM.Environment.Elements.Panel> EnvironmentPanelsFromRevit(this RoofBase roofBase, RevitSettings settings = null, Dictionary <string, List <IBHoMObject> > refObjects = null) { settings = settings.DefaultIfNull(); List <oM.Environment.Elements.Panel> panels = refObjects.GetValues <oM.Environment.Elements.Panel>(roofBase.Id); if (panels != null && panels.Count > 0) { return(panels); } Dictionary <PlanarSurface, List <PlanarSurface> > surfaces = roofBase.PanelSurfaces(roofBase.FindInserts(true, true, true, true), settings); if (surfaces == null) { return(panels); } BH.oM.Physical.Constructions.Construction construction = roofBase.RoofType.ConstructionFromRevit(null, settings, refObjects); panels = new List <oM.Environment.Elements.Panel>(); foreach (PlanarSurface surface in surfaces.Keys) { //Create the BuildingElement oM.Environment.Elements.Panel panel = new oM.Environment.Elements.Panel() { ExternalEdges = surface.ExternalBoundary.ToEdges(), Name = roofBase.FamilyTypeFullName(), }; //Set ExtendedProperties OriginContextFragment originContext = new OriginContextFragment() { ElementID = roofBase.Id.IntegerValue.ToString(), TypeName = roofBase.FamilyTypeFullName() }; originContext.SetProperties(roofBase.RoofType, settings.ParameterSettings); originContext.SetProperties(roofBase, settings.ParameterSettings); panel.AddFragment(originContext); PanelAnalyticalFragment panelAnalytical = new PanelAnalyticalFragment(); panelAnalytical.SetProperties(roofBase.RoofType, settings.ParameterSettings); panelAnalytical.SetProperties(roofBase, settings.ParameterSettings); panel.AddFragment(panelAnalytical); PanelContextFragment panelContext = new PanelContextFragment(); panelContext.SetProperties(roofBase.RoofType, settings.ParameterSettings); panelContext.SetProperties(roofBase, settings.ParameterSettings); panel.AddFragment(panelContext); BuildingResultFragment buildingResults = new BuildingResultFragment(); buildingResults.SetProperties(roofBase.RoofType, settings.ParameterSettings); buildingResults.SetProperties(roofBase, settings.ParameterSettings); panel.AddFragment(buildingResults); panel.Construction = construction; panel.Type = oM.Environment.Elements.PanelType.Roof; //Set identifiers, parameters & custom data panel.SetIdentifiers(roofBase); panel.CopyParameters(roofBase, settings.ParameterSettings); panel.SetProperties(roofBase, settings.ParameterSettings); refObjects.AddOrReplace(roofBase.Id, panel); panels.Add(panel); } return(panels); }