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 static void invokeCommand(Document doc, PressureLossReportHelper helper, bool bForAllSystems) { //upgrade the formats ReportFormatUpgrades.Instance.executeUpgrades(); //post warning if some systems' calculation is not ALL ElementSet selSystems = new ElementSet(); if (!bForAllSystems && helper.getSelectedSystems(selSystems)) { WholeReportSettingsDlg settingsDlg = new WholeReportSettingsDlg(); settingsDlg.ShowDialog(); } else //post system filter { ReportSystemSelectorDlg rssDlg = new ReportSystemSelectorDlg(); if (rssDlg.ShowDialog() == DialogResult.OK) { UserPressureLossReportApplication.beginCommand(PressureLossReportHelper.instance.Doc, rssDlg.CheckedElements); } } }