Exemple #1
0
        /***************************************************/
        /****               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);
        }