Esempio n. 1
0
        public static MaterialComposition MaterialComposition(this SolidBulk solidBulk)
        {
            if (solidBulk == null)
            {
                return(null);
            }

            if (solidBulk.MaterialComposition == null)
            {
                Engine.Reflection.Compute.RecordError("The SolidBulk MaterialComposition could not be queried as no Materials have been assigned to at least one of the layers of the Construction.");
                return(null);
            }
            return(solidBulk.MaterialComposition);
        }
Esempio n. 2
0
        public static double SolidVolume(this SolidBulk solidBulk)
        {
            if (solidBulk == null || solidBulk.Geometry == null)
            {
                Engine.Reflection.Compute.RecordError("No valid SolidBulk objects have been provided. Returning NaN.");
                return(double.NaN);
            }

            double solidVolume = solidBulk.Geometry.Select(x => x.IVolume()).Sum();

            if (solidVolume <= 0)
            {
                Engine.Reflection.Compute.RecordError("The queried volume has been nonpositive. Returning zero instead.");
                return(0);
            }

            return(solidVolume);
        }