Beispiel #1
0
        public static MaterialComposition MaterialComposition(this IOpening opening)
        {
            MaterialComposition materialComposition = null;

            if (opening is Window)
            {
                if ((opening as Window).Construction == null)
                {
                    Engine.Reflection.Compute.RecordError("The IOpening MaterialComposition could not be calculated as no IConstruction has been assigned.");
                    return(null);
                }

                materialComposition = (opening as Window).Construction.IMaterialComposition();
            }

            if (opening is Door)
            {
                if ((opening as Door).Construction == null)
                {
                    Engine.Reflection.Compute.RecordError("The IOpening MaterialComposition could not be calculated as no IConstruction has been assigned.");
                    return(null);
                }

                materialComposition = (opening as Door).Construction.IMaterialComposition();
            }

            if (opening is BH.oM.Physical.Elements.Void)
            {
                Engine.Reflection.Compute.RecordError("Void's do not support constructions and therefore, contain no material composition. Returning null.");
                return(null);
            }

            return(materialComposition);
        }
        public static MaterialComposition MaterialComposition(this FrameEdge frameEdge)
        {
            if (frameEdge == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot query the material composition of a null frame edge.");
                return(null);
            }

            List <MaterialComposition> matComps = new List <MaterialComposition>();
            List <double> vols = new List <double>();

            if (frameEdge.FrameEdgeProperty == null)
            {
                Engine.Reflection.Compute.RecordWarning("The frame edge does not have a frame edge property assigned to get material composition from, material composition returned is empty.");
                return(null);
            }

            List <ConstantFramingProperty> props = frameEdge.FrameEdgeProperty.SectionProperties;

            foreach (ConstantFramingProperty prop in props)
            {
                double profVolume = prop.AverageProfileArea() * frameEdge.Length();
                vols.Add(profVolume);
                List <Material> mats = new List <Material> {
                    prop.Material
                };
                List <double> profVols = new List <double> {
                    1
                };
                MaterialComposition matComp = new MaterialComposition(mats, profVols);
                matComps.Add(matComp);
            }
            return(BH.Engine.Matter.Compute.AggregateMaterialComposition(matComps, vols));
        }
        public static MaterialComposition MaterialComposition(this Panel panel)
        {
            if (panel.Construction == null || panel.Construction.IThickness() < oM.Geometry.Tolerance.Distance)
            {
                BH.Engine.Reflection.Compute.RecordError("The Panel does not have a construction assigned");
                return(null);
            }
            MaterialComposition pMat = panel.Construction.IMaterialComposition();

            if (panel.Openings != null && panel.Openings.Count != 0)
            {
                List <MaterialComposition> matComps = new List <MaterialComposition>()
                {
                    pMat
                };
                List <double> volumes = new List <double>()
                {
                    panel.SolidVolume()
                };
                foreach (Opening opening in panel.Openings)
                {
                    matComps.Add(opening.MaterialComposition());

                    double tempVolume = opening.SolidVolume();
                    volumes.Add(tempVolume);
                    volumes[0] -= tempVolume;
                }
                return(Matter.Compute.AggregateMaterialComposition(matComps, volumes));
            }

            return(pMat);
        }
Beispiel #4
0
        public static double Mass(this IElementM elementM)
        {
            if (elementM == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot query the mass of a null element.");
                return(0);
            }

            MaterialComposition mat = elementM.IMaterialComposition();

            return(elementM.ISolidVolume() * mat.Materials.Zip(mat.Ratios, (m, r) => r * m.Density()).Sum());
        }
        public static MaterialComposition MaterialComposition(this CurtainWall curtainWall)
        {
            if (curtainWall == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot query the solid volume of a null curtain wall.");
                return(null);
            }

            if (curtainWall.Openings == null || curtainWall.Openings.Count == 0)
            {
                BH.Engine.Reflection.Compute.RecordError("CurtainWall has no openings. Please confirm the CurtainWall is valid and try again.");
                return(null);
            }

            List <MaterialComposition> matComps = new List <MaterialComposition>()
            {
            };
            List <double> volumes = new List <double>()
            {
            };

            foreach (Opening opening in curtainWall.Openings)
            {
                matComps.Add(opening.MaterialComposition());
                volumes.Add(opening.SolidVolume());
            }
            foreach (FrameEdge extEdge in curtainWall.ExternalEdges)
            {
                MaterialComposition matComp = extEdge.MaterialComposition();
                if (matComp != null)
                {
                    matComps.Add(matComp);
                    volumes.Add(extEdge.SolidVolume());
                }
            }

            return(Matter.Compute.AggregateMaterialComposition(matComps, volumes));
        }
Beispiel #6
0
        public static double Mass(this IOpening opening)
        {
            MaterialComposition mat = opening.IMaterialComposition();

            return(opening.SolidVolume() * mat.Materials.Zip(mat.Ratios, (m, r) => r * m.Density()).Sum());
        }
        /***************************************************/
        /****            Public Constructors            ****/
        /***************************************************/

        public RevitMaterialTakeOff(double totalVolume, MaterialComposition materialComposition)
        {
            TotalVolume         = totalVolume;
            MaterialComposition = materialComposition;
        }
Beispiel #8
0
        public static double Mass(this IElementM elementM)
        {
            MaterialComposition mat = elementM.IMaterialComposition();

            return(elementM.ISolidVolume() * mat.Materials.Zip(mat.Ratios, (m, r) => r * m.Density()).Sum());
        }