Esempio n. 1
0
        public static double SolidVolume(this WireSegment wireSegment)
        {
            double length              = wireSegment.Length();
            double elementSolidArea    = wireSegment.SectionProperty.ElementSolidArea;
            double insulationSolidArea = wireSegment.SectionProperty.InsulationSolidArea;
            double liningSolidArea     = wireSegment.SectionProperty.LiningSolidArea;

            if (length <= 0)
            {
                Engine.Reflection.Compute.RecordError("Cannot query SolidVolume from zero length members.");
                return(double.NaN);
            }

            if (wireSegment.SectionProperty.SectionProfile.ElementProfile == null)
            {
                Engine.Reflection.Compute.RecordWarning("No ElementProfile detected for object " + wireSegment.BHoM_Guid);
            }

            if (wireSegment.SectionProperty.SectionProfile.InsulationProfile == null)
            {
                Engine.Reflection.Compute.RecordWarning("No InsulationProfile detected for object " + wireSegment.BHoM_Guid);
            }

            if (wireSegment.SectionProperty.SectionProfile.LiningProfile == null)
            {
                Engine.Reflection.Compute.RecordWarning("No LiningProfile detected for object " + wireSegment.BHoM_Guid);
            }

            if (elementSolidArea <= 0)
            {
                Engine.Reflection.Compute.RecordNote("ElementSolidArea is 0. Returning 0 for ElementSolidVolume.");
            }

            if (insulationSolidArea <= 0)
            {
                Engine.Reflection.Compute.RecordNote("InsulationSolidArea is 0. Returning 0 for LiningSolidVolume.");
            }

            if (liningSolidArea <= 0)
            {
                Engine.Reflection.Compute.RecordNote("LiningSolidArea is 0. Returning 0 for InsulationSolidVolume.");
            }

            return((length * elementSolidArea) + (length * insulationSolidArea) + (length * liningSolidArea));
        }
Esempio n. 2
0
        public static Output <double, double, double> CompositeSolidVolumes(this WireSegment wire)
        {
            double length                = wire.Length();
            double elementSolidVolume    = wire.SectionProperty.ElementSolidArea * length;
            double insulationSolidVolume = wire.SectionProperty.InsulationSolidArea * length;
            double liningSolidVolume     = wire.SectionProperty.LiningSolidArea * length;

            if (wire.SectionProperty == null)
            {
                Engine.Reflection.Compute.RecordError("No section property defined.");
                return(null);
            }

            //Negative LiningThickness Warning
            if (wire.SectionProperty.LiningSolidArea < 0)
            {
                Engine.Reflection.Compute.RecordWarning("LiningSolidArea is a negative value, and will result in incorrect SolidVolume results. Try adjusting LiningThickness to produce a positive value for SolidArea.");
            }

            //SolidArea = 0 user feedback.
            if (wire.SectionProperty.ElementSolidArea <= 0)
            {
                Engine.Reflection.Compute.RecordNote("ElementSolidArea is 0. Returning 0 for ElementSolidVolume.");
            }

            if (wire.SectionProperty.LiningSolidArea <= 0)
            {
                Engine.Reflection.Compute.RecordNote("LiningSolidArea is 0. Returning 0 for LiningSolidVolume.");
            }

            if (wire.SectionProperty.InsulationSolidArea <= 0)
            {
                Engine.Reflection.Compute.RecordNote("InsulationSolidArea is 0. Returning 0 for InsulationSolidVolume.");
            }

            Output <double, double, double> output = new Output <double, double, double>
            {
                Item1 = elementSolidVolume,
                Item2 = insulationSolidVolume,
                Item3 = liningSolidVolume,
            };

            return(output);
        }