예제 #1
0
        /***************************************************/

        public static oM.Physical.Constructions.Construction Construction(this string constructionName, string materialName)
        {
            if (string.IsNullOrEmpty(constructionName) || string.IsNullOrEmpty(materialName))
            {
                return(null);
            }

            string matName = null;

            if (!string.IsNullOrEmpty(materialName))
            {
                matName = string.Format("Default {0} Material", materialName);
            }
            else
            {
                matName = "Default Material";
            }

            SolidMaterial transparentMaterialProperties = new SolidMaterial();

            transparentMaterialProperties.Name = matName;

            oM.Physical.Materials.Material material = new oM.Physical.Materials.Material();
            material.Properties.Add(transparentMaterialProperties);

            oM.Physical.Constructions.Construction construction = new oM.Physical.Constructions.Construction();
            construction.Name = constructionName;

            oM.Physical.Constructions.Layer layer = new oM.Physical.Constructions.Layer();
            layer.Material = material;

            construction.Layers.Add(layer);

            return(construction);
        }
예제 #2
0
        /***************************************************/
        /****              Public methods               ****/
        /***************************************************/

        public static oM.Physical.Constructions.Layer Layer(this CompoundStructureLayer compoundStructureLayer, HostObjAttributes owner, string materialGrade = null, RevitSettings settings = null, Dictionary <string, List <IBHoMObject> > refObjects = null)
        {
            if (compoundStructureLayer == null)
            {
                return(null);
            }

            settings = settings.DefaultIfNull();

            oM.Physical.Constructions.Layer layer = new oM.Physical.Constructions.Layer();
            layer.Thickness = compoundStructureLayer.Width.ToSI(UnitType.UT_Length);

            Material revitMaterial = owner.Document.GetElement(compoundStructureLayer.MaterialId) as Material;

            if (revitMaterial == null)
            {
                revitMaterial = owner.Category.Material;
            }

            layer.Material = revitMaterial.MaterialFromRevit(materialGrade, settings, refObjects);
            return(layer);
        }