public static BH.oM.MEP.System.SectionProperties.PipeSectionProperty PipeSectionProperty(this Autodesk.Revit.DB.Plumbing.Pipe pipe, RevitSettings settings = null) { settings = settings.DefaultIfNull(); IProfile profile = pipe.Profile(settings); double liningThickness = pipe.LookupParameterDouble(BuiltInParameter.RBS_REFERENCE_LINING_THICKNESS); // Extract the lining thk from Duct element if (liningThickness == double.NaN) { liningThickness = 0; } double insulationThickness = pipe.LookupParameterDouble(BuiltInParameter.RBS_REFERENCE_INSULATION_THICKNESS); // Extract the lining thk from Duct element if (insulationThickness == double.NaN) { insulationThickness = 0; } SectionProfile sectionProfile = BH.Engine.MEP.Create.SectionProfile((TubeProfile)profile, liningThickness, insulationThickness); PipeSectionProperty result = BH.Engine.MEP.Create.PipeSectionProperty(sectionProfile); return(result); }
public static IProfile Profile(this Autodesk.Revit.DB.Plumbing.Pipe pipe, RevitSettings settings = null) { settings = settings.DefaultIfNull(); List <ICurve> edges = new List <ICurve>(); double diameter = pipe.Diameter.ToSI(UnitType.UT_PipeSize); // Thickness double outsideDiameter = pipe.LookupParameterDouble(BuiltInParameter.RBS_PIPE_OUTER_DIAMETER); double insideDiameter = pipe.LookupParameterDouble(BuiltInParameter.RBS_PIPE_INNER_DIAM_PARAM); double thickness = (outsideDiameter - insideDiameter) / 2; return(BH.Engine.Spatial.Create.TubeProfile(diameter, thickness)); }
public static List <BH.oM.MEP.System.Pipe> PipeFromRevit(this Autodesk.Revit.DB.Plumbing.Pipe revitPipe, RevitSettings settings = null, Dictionary <string, List <IBHoMObject> > refObjects = null) { settings = settings.DefaultIfNull(); // Reuse a BHoM duct from refObjects if it has been converted before List <BH.oM.MEP.System.Pipe> bhomPipes = refObjects.GetValues <BH.oM.MEP.System.Pipe>(revitPipe.Id); if (bhomPipes != null) { return(bhomPipes); } else { bhomPipes = new List <BH.oM.MEP.System.Pipe>(); } List <BH.oM.Geometry.Line> queried = Query.LocationCurveMEP(revitPipe, settings); // Flow rate double flowRate = revitPipe.LookupParameterDouble(BuiltInParameter.RBS_PIPE_FLOW_PARAM); // Flow rate // Pipe section property BH.oM.MEP.System.SectionProperties.PipeSectionProperty sectionProperty = revitPipe.PipeSectionProperty(settings); for (int i = 0; i < queried.Count; i++) { BH.oM.Geometry.Line segment = queried[i]; BH.oM.MEP.System.Pipe thisSegment = new Pipe { StartPoint = segment.StartPoint(), EndPoint = segment.EndPoint(), FlowRate = flowRate, SectionProperty = sectionProperty }; //Set identifiers, parameters & custom data thisSegment.SetIdentifiers(revitPipe); thisSegment.CopyParameters(revitPipe, settings.ParameterSettings); thisSegment.SetProperties(revitPipe, settings.ParameterSettings); bhomPipes.Add(thisSegment); } refObjects.AddOrReplace(revitPipe.Id, bhomPipes); return(bhomPipes); }