コード例 #1
0
        public bool isValidSystem(Document doc, MEPSystem mepSys, string strDomain)
        {
            if (mepSys == null || doc == null)
            {
                return(false);
            }

            if (mepSys.IsEmpty || !mepSys.IsValid)
            {
                return(false);
            }

            Category        category     = mepSys.Category;
            BuiltInCategory enumCategory = (BuiltInCategory)category.Id.IntegerValue;

            if (strDomain == ReportResource.pipeDomain && enumCategory != BuiltInCategory.OST_PipingSystem)
            {
                return(false);
            }

            if (strDomain == ReportResource.ductDomain && enumCategory != BuiltInCategory.OST_DuctSystem)
            {
                return(false);
            }

            MEPSystemType sysType = doc.GetElement(mepSys.GetTypeId()) as MEPSystemType;

            if (sysType == null)
            {
                return(false);
            }

            return(isValidSystemType(sysType));
        }
コード例 #2
0
        private static int getCalculationElemSet(Document doc, string strDomain, ElementSet caculationOnElems, ElementSet elems)
        {
            if (doc == null)
            {
                return(0);
            }
            int nTotalCount = 0;

            foreach (Element elem in elems)
            {
                MEPSystem mepSys = elem as MEPSystem;
                if (mepSys == null)
                {
                    continue;
                }
                Category        category     = mepSys.Category;
                BuiltInCategory enumCategory = (BuiltInCategory)category.Id.IntegerValue;

                if ((strDomain == ReportResource.pipeDomain && enumCategory == BuiltInCategory.OST_PipingSystem) ||
                    (strDomain == ReportResource.ductDomain && enumCategory == BuiltInCategory.OST_DuctSystem))
                {
                    ++nTotalCount;
                    MEPSystemType sysType = doc.GetElement(mepSys.GetTypeId()) as MEPSystemType;
                    if (sysType != null && sysType.CalculationLevel == SystemCalculationLevel.All)
                    {
                        caculationOnElems.Insert(mepSys);
                    }
                }
            }
            return(nTotalCount);
        }
コード例 #3
0
        public void getInfoDataTable(DataTable systemTB)
        {
            if (systemTB == null || system == null)
            {
                return;
            }

            systemTB.Columns.Add("SystemInfoName");
            systemTB.Columns.Add("SystemInfoValue");

            PressureLossReportHelper helper = PressureLossReportHelper.instance;

            if (helper == null)
            {
                return;
            }

            MEPSystemType sysType = helper.Doc.GetElement(system.GetTypeId()) as MEPSystemType;

            if (sysType != null)
            {
                systemTB.Rows.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_SYSTEM_CLASSIFICATION_PARAM), system.get_Parameter(BuiltInParameter.RBS_SYSTEM_CLASSIFICATION_PARAM).AsString());

                if (helper.Domain == ReportResource.ductDomain)
                {
                    systemTB.Rows.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_DUCT_SYSTEM_TYPE_PARAM), sysType.Name);
                }
                else
                {
                    systemTB.Rows.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPING_SYSTEM_TYPE_PARAM), sysType.Name);
                }
                systemTB.Rows.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_SYSTEM_NAME_PARAM), system.Name);
                systemTB.Rows.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_SYSTEM_ABBREVIATION_PARAM), sysType.Abbreviation);

                if (helper.Domain == ReportResource.pipeDomain) // need to list fluid info
                {
                    //Fluid type is an element id
                    ElementId elemId       = sysType.get_Parameter(BuiltInParameter.RBS_PIPE_FLUID_TYPE_PARAM).AsElementId();
                    string    strFluidType = "";
                    if (elemId != null)
                    {
                        Element elem = helper.Doc.GetElement(elemId);
                        if (elem != null)
                        {
                            strFluidType = elem.Name;
                        }
                    }
                    systemTB.Rows.Add(sysType.get_Parameter(BuiltInParameter.RBS_PIPE_FLUID_TYPE_PARAM).Definition.Name, strFluidType);
                    helper.addParameterNameAndValueToTable(systemTB, sysType.get_Parameter(BuiltInParameter.RBS_PIPE_FLUID_TEMPERATURE_PARAM), false);
                    helper.addParameterNameAndValueToTable(systemTB, sysType.get_Parameter(BuiltInParameter.RBS_PIPE_FLUID_VISCOSITY_PARAM), false);
                    helper.addParameterNameAndValueToTable(systemTB, sysType.get_Parameter(BuiltInParameter.RBS_PIPE_FLUID_DENSITY_PARAM), false);
                }
            }

            return;
        }
コード例 #4
0
        private bool isCalculationOn(Document doc, Autodesk.Revit.DB.MEPSystem mepSys)
        {
            if (mepSys == null)
            {
                return(false);
            }
            MEPSystemType sysType = doc.GetElement(mepSys.GetTypeId()) as MEPSystemType;

            if (sysType == null)
            {
                return(false);
            }

            return(sysType.CalculationLevel == Autodesk.Revit.DB.Mechanical.SystemCalculationLevel.All);
        }
コード例 #5
0
        public List <MEPSystemType> getSelectedSystemTypes(bool bOnlySelectedSystemType = false)
        {
            if (doc == null)
            {
                return(null);
            }

            if (selElems.Size > 0)
            {
                List <MEPSystemType> sysTypes = new List <MEPSystemType>();
                foreach (Element elem in selElems)
                {
                    if (elem == null)
                    {
                        continue;
                    }

                    MEPSystemType mepSysType = null;

                    if (!bOnlySelectedSystemType)
                    {
                        MEPSystem mepSys = elem as MEPSystem;
                        if (mepSys != null && isValidSystem(doc, mepSys, Domain))
                        {
                            mepSysType = doc.GetElement(mepSys.GetTypeId()) as MEPSystemType;
                        }
                    }

                    if (mepSysType == null)
                    {
                        mepSysType = elem as MEPSystemType;
                    }
                    if (mepSysType == null || !isValidSystemType(mepSysType))
                    {
                        continue;
                    }

                    if (!isSystemTypeInList(sysTypes, mepSysType))
                    {
                        sysTypes.Add(mepSysType);
                    }
                }

                return(sysTypes);
            }

            return(null);
        }
コード例 #6
0
        public bool isValidSystemType(MEPSystemType sysType)
        {
            if (sysType == null)
            {
                return(false);
            }

            if (sysType.SystemClassification == MEPSystemClassification.OtherPipe ||
                sysType.SystemClassification == MEPSystemClassification.Vent ||
                sysType.SystemClassification == MEPSystemClassification.FireProtectWet || sysType.SystemClassification == MEPSystemClassification.FireProtectDry ||
                sysType.SystemClassification == MEPSystemClassification.FireProtectPreaction || sysType.SystemClassification == MEPSystemClassification.FireProtectOther ||
                sysType.SystemClassification == MEPSystemClassification.Sanitary)
            {
                return(false);
            }
            return(true);
        }
コード例 #7
0
        public bool isSelectInValidSystemType()
        {
            if (doc == null)
            {
                return(false);
            }

            if (selElems.Size > 0)
            {
                MEPSystemType mepSysType = null;
                foreach (Element elem in selElems)
                {
                    if (elem == null)
                    {
                        continue;
                    }

                    mepSysType = null;

                    MEPSystem mepSys = elem as MEPSystem;
                    if (mepSys != null && isValidSystem(doc, mepSys, Domain))
                    {
                        mepSysType = doc.GetElement(mepSys.GetTypeId()) as MEPSystemType;
                    }

                    if (mepSysType == null)
                    {
                        mepSysType = elem as MEPSystemType;
                    }
                    if (mepSysType == null)
                    {
                        continue;
                    }
                    if (!isValidSystemType(mepSysType))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
コード例 #8
0
        //
        // Summary:
        //     "Запись приоритетного наименования типа системы в параметр СЭ_Имя системы"
        public static void SetSESysNameParam(Document doc, Element element)
        {
            Parameter         sESysNameParam = element.get_Parameter(SE_SYSNAME);
            IList <MEPSystem> mEPSystems     = GetSystemListFromElement(doc, element);
            List <string[]>   names          = new List <string[]>();
            string            paramValue     = "";

            foreach (MEPSystem mEPSystem in mEPSystems)
            {
                if (mEPSystem != null)
                {
                    MEPSystemType mEPSystemType = (MEPSystemType)doc.GetElement(mEPSystem.GetTypeId());

                    string sysDescription = mEPSystemType.get_Parameter(BuiltInParameter.ALL_MODEL_DESCRIPTION).AsString(); //Встроенный параметр Описание
                    //string sysAbbreviation = mEPSystemType.get_Parameter(BuiltInParameter.RBS_SYSTEM_ABBREVIATION_PARAM).AsString(); //Встроенный параметр Сокращение !!! Сокращение на данный момент не используется
                    Parameter sysClassKeyparam = mEPSystemType.LookupParameter("Код по классификатору");
                    //string sysClassKey = mEPSystemType.get_Parameter(BuiltInParameter.UNIFORMAT_CODE).AsString(); //Встроенный параметр Код по классификатору !!! отсутствует в категории
                    string sysClassKey = sysClassKeyparam?.AsString();
                    names.Add(new string[] { sysClassKey, sysDescription });
                }
            }

            if (names.Count > 0)
            {
                names = names.OrderBy(x => x[0]).ThenBy(x => x[1]).ToList();
                string[] name = names.First();
                paramValue = name[1];
                if (names.Count > 1 && ((BuiltInCategory)element.Category.Id.IntegerValue == BuiltInCategory.OST_PlumbingFixtures))
                {
                    paramValue = "Cанитарно-технические приборы";
                }
            }
            else
            {
                paramValue = "";
            }

            if (sESysNameParam != null && !sESysNameParam.IsReadOnly)
            {
                ParameterManager.SetParameterValue(sESysNameParam, paramValue);
            }
        }
コード例 #9
0
ファイル: Util.cs プロジェクト: yangbing007/AdnRme
        public static bool IsSupplyAir(FamilyInstance terminal)
        {
            Parameter p = terminal.get_Parameter(Bip.SystemType);

            if (null == p)
            {
                throw new TerminalParameterException(Bip.SystemType.ToString(), terminal);
            }
            bool rc = p.AsString().Equals(ParameterValue.SupplyAir);

#if DEBUG
            ElementId     typeId = terminal.GetTypeId();
            ElementType   t      = terminal.Document.get_Element(typeId) as ElementType;
            MEPSystemType t2     = terminal.Document.get_Element(typeId) as MEPSystemType;
            Debug.Assert((MEPSystemClassification.SupplyAir == t2.SystemClassification) == rc,
                         "expected parameter check to return correct system classification");
#endif // DEBUG

            return(rc);
        }
コード例 #10
0
        public MEPSystemInfo(MEPSystem systemElem)
        {
            system = systemElem;
            if (system == null)
            {
                return;
            }

            PressureLossReportHelper helper = PressureLossReportHelper.instance;

            if (helper == null)
            {
                return;
            }

            MEPSystemType sysType = helper.Doc.GetElement(system.GetTypeId()) as MEPSystemType;

            if (sysType != null)
            {
                helper.SystemClassification = sysType.SystemClassification;
            }
        }
コード例 #11
0
        public MEPSystemType getSystemType(Document doc, MEPSystem mepSys)
        {
            MEPSystemType sysType = doc.GetElement(mepSys.GetTypeId()) as MEPSystemType;

            return(sysType);
        }