private bool isCheckedSystemType(Autodesk.Revit.DB.MEPSystemType mepSysType) { for (int ii = 0; ii < checkedSystemType.Count; ++ii) { if (mepSysType.Id == checkedSystemType[ii].Id) { return(true); } } return(false); }
private void addItemsToCheckList(PressureLossReportHelper helper, ICollection <Autodesk.Revit.DB.Element> founds) { //get the selected systems first ElementSet selSystems = new ElementSet(); helper.getSelectedSystems(selSystems); List <string> checkedItems = new List <string>(); foreach (Element elem in selSystems) { MEPSystem mepSys = elem as MEPSystem; if (mepSys == null) { continue; } checkedItems.Add(mepSys.Name); } List <MEPSystemType> selSystemTypes = helper.getSelectedSystemTypes(true); if ((selSystemTypes == null || selSystemTypes.Count < 1) && (checkedItems == null || checkedItems.Count < 1)) { bool bCheckAll = true; if (helper.isSelectInValidSystemType()) { bCheckAll = false; } addItemsToCheckList(helper, founds, null, bCheckAll); } else { foreach (Autodesk.Revit.DB.Element elem in founds) { Autodesk.Revit.DB.MEPSystem mepSysElem = elem as Autodesk.Revit.DB.MEPSystem; Autodesk.Revit.DB.MEPSystemType mepSysType = helper.getSystemType(helper.Doc, mepSysElem); if (isCheckedSystemType(mepSysType) && helper.isValidSystem(helper.Doc, mepSysElem, helper.Domain) && isCalculationOn(helper.Doc, mepSysElem)) { if (selSystemTypes != null && PressureLossReportHelper.isSystemTypeInList(selSystemTypes, mepSysType)) { checkedItems.Add(mepSysElem.Name); } } } addItemsToCheckList(helper, founds, checkedItems); } }
private void addItemsToCheckList(PressureLossReportHelper helper, ICollection <Autodesk.Revit.DB.Element> founds, List <string> checkedItems, bool bCheckAll = false) { SortedDictionary <string, bool> systemList = new SortedDictionary <string, bool>(); foreach (Autodesk.Revit.DB.Element elem in founds) { Autodesk.Revit.DB.MEPSystem mepSysElem = elem as Autodesk.Revit.DB.MEPSystem; Autodesk.Revit.DB.MEPSystemType mepSysType = helper.getSystemType(helper.Doc, mepSysElem); if (isCheckedSystemType(mepSysType) && helper.isValidSystem(helper.Doc, mepSysElem, helper.Domain) && isCalculationOn(helper.Doc, mepSysElem)) { if (bCheckAll || (checkedItems != null && checkedItems.Contains(mepSysElem.Name))) { systemList.Add(mepSysElem.Name, true); } else { systemList.Add(mepSysElem.Name, false); } allElementItems.Add(mepSysElem); } } bool bDisabled = true; foreach (KeyValuePair <string, bool> kvp in systemList) { SystemCheckList.Items.Add(kvp.Key, kvp.Value); if (bDisabled && kvp.Value == true) { bDisabled = false; } } btnOK.Enabled = !bDisabled; SortSystemByNameCamparer systemCompare = new SortSystemByNameCamparer(); allElementItems.Sort(systemCompare); }
static public bool isSystemTypeInList(List <Autodesk.Revit.DB.MEPSystemType> mepSysTypes, Autodesk.Revit.DB.MEPSystemType mepSysType) { for (int ii = 0; ii < mepSysTypes.Count; ++ii) { if (mepSysType.Id == mepSysTypes[ii].Id) { return(true); } } return(false); }