Esempio n. 1
0
        public static List <BH.oM.MEP.System.Duct> DuctFromRevit(this Autodesk.Revit.DB.Mechanical.Duct revitDuct, 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.Duct> bhomDucts = refObjects.GetValues <BH.oM.MEP.System.Duct>(revitDuct.Id);

            if (bhomDucts != null)
            {
                return(bhomDucts);
            }
            else
            {
                bhomDucts = new List <BH.oM.MEP.System.Duct>();
            }

            List <BH.oM.Geometry.Line> queried = Query.LocationCurveMEP(revitDuct, settings);

            // Flow rate
            double flowRate = revitDuct.LookupParameterDouble(BuiltInParameter.RBS_DUCT_FLOW_PARAM);

            BH.oM.MEP.System.SectionProperties.DuctSectionProperty sectionProperty = BH.Revit.Engine.Core.Query.DuctSectionProperty(revitDuct, settings);
            // Orientation angle
            double orientationAngle = revitDuct.OrientationAngle(settings); //ToDo - resolve in next issue, specific issue being raised

            for (int i = 0; i < queried.Count; i++)
            {
                BH.oM.Geometry.Line   segment     = queried[i];
                BH.oM.MEP.System.Duct thisSegment = new Duct
                {
                    StartPoint       = segment.StartPoint(),
                    EndPoint         = segment.EndPoint(),
                    FlowRate         = flowRate,
                    SectionProperty  = sectionProperty,
                    OrientationAngle = orientationAngle
                };
                //Set identifiers, parameters & custom data
                thisSegment.SetIdentifiers(revitDuct);
                thisSegment.CopyParameters(revitDuct, settings.ParameterSettings);
                thisSegment.SetProperties(revitDuct, settings.ParameterSettings);
                bhomDucts.Add(thisSegment);
            }

            refObjects.AddOrReplace(revitDuct.Id, bhomDucts);
            return(bhomDucts);
        }
Esempio n. 2
0
        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);
        }