public static WireSegment WireSegment(Line line, double flowRate = 0, WireSectionProperty sectionProperty = null) { if (line == null) { BH.Engine.Reflection.Compute.RecordError("Cannot create a wire segment from an empty line."); return(null); } return(new WireSegment { StartPoint = line.Start, EndPoint = line.End, SectionProperty = sectionProperty, }); }
public static WireSectionProperty WireSectionProperty(SectionProfile sectionProfile, Material conductiveMaterial = null, Material insulationMaterial = null, string name = "") { if (sectionProfile == null) { BH.Engine.Reflection.Compute.RecordError("Cannot create a wire section property with a null section profile."); return(null); } double elementSolidArea = sectionProfile.ElementProfile.Area(); double elementVoidArea = sectionProfile.ElementProfile.VoidArea(); double liningSolidArea = 0; double liningVoidArea = double.NaN; double insulationSolidArea = 0; double insulationVoidArea = double.NaN; if (sectionProfile.LiningProfile != null) { liningSolidArea = sectionProfile.LiningProfile.Area(); liningVoidArea = sectionProfile.LiningProfile.VoidArea(); } if (sectionProfile.InsulationProfile != null) { insulationSolidArea = sectionProfile.InsulationProfile.Area(); insulationVoidArea = sectionProfile.InsulationProfile.VoidArea(); } WireSectionProperty property = new WireSectionProperty(sectionProfile, elementSolidArea, liningSolidArea, insulationSolidArea, elementVoidArea, liningVoidArea, insulationVoidArea); property.ConductiveMaterial = conductiveMaterial; property.InsulationMaterial = insulationMaterial; property.Name = name; if (property == null) { BH.Engine.Reflection.Compute.RecordError("Insufficient information to create a WireSectionProperty. Please ensure you have all required inputs."); } return(property); }