public static double SolidVolume(this Duct duct) { double length = duct.Length(); double elementSolidArea = duct.SectionProperty.ElementSolidArea; double insulationSolidArea = duct.SectionProperty.InsulationSolidArea; double liningSolidArea = duct.SectionProperty.LiningSolidArea; if (length <= 0) { Engine.Reflection.Compute.RecordError("Cannot query SolidVolume from zero length members."); return(double.NaN); } if (duct.SectionProperty.SectionProfile.ElementProfile == null) { Engine.Reflection.Compute.RecordWarning("No ElementProfile detected for object " + duct.BHoM_Guid); } if (duct.SectionProperty.SectionProfile.InsulationProfile == null) { Engine.Reflection.Compute.RecordWarning("No InsulationProfile detected for object " + duct.BHoM_Guid); } if (duct.SectionProperty.SectionProfile.LiningProfile == null) { Engine.Reflection.Compute.RecordWarning("No LiningProfile detected for object " + duct.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)); }
public static Output <double, double, double> CompositeSolidVolumes(this Duct duct) { double length = duct.Length(); double elementSolidVolume = duct.SectionProperty.ElementSolidArea * length; double insulationSolidVolume = duct.SectionProperty.InsulationSolidArea * length; double liningSolidVolume = duct.SectionProperty.LiningSolidArea * length; if (duct.SectionProperty == null) { Engine.Reflection.Compute.RecordError("No section property defined."); return(null); } //Negative LiningThickness Warning if (duct.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 (duct.SectionProperty.ElementSolidArea <= 0) { Engine.Reflection.Compute.RecordNote("ElementSolidArea is 0. Returning 0 for ElementSolidVolume."); } if (duct.SectionProperty.LiningSolidArea <= 0) { Engine.Reflection.Compute.RecordNote("LiningSolidArea is 0. Returning 0 for LiningSolidVolume."); } if (duct.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); }