public bool getSectionInfo(MEPSection section, DataTable sectionTB, bool forHTML = false) { if (section == null || sectionTB == null) return false; PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null) return false; PressureLossReportData reportData = helper.ReportData; if (reportData == null) return false; List<string> sectionFields = new List<string>(); getFields(sectionFields); getSectionTable(section, sectionTB, sectionFields, reportData, forHTML); return true; }
public static string getSectionInfoByParamName(MEPSection section, string paramName, int nGetFrom, ElementId id) { string paramVal = ""; if (section == null || paramName == null || (nGetFrom & (int)SectionMemberType.Section) == 0) return paramVal; PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null) return paramVal; if (paramName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_PRESSURE_DROP) || paramName == ReportResource.pressureLoss) { double dVal = section.GetPressureDrop(id); if (helper.Domain == ReportResource.pipeDomain) paramVal = FormatUtils.Format(helper.Doc, UnitType.UT_Piping_Pressure, dVal); else paramVal = FormatUtils.Format(helper.Doc, UnitType.UT_HVAC_Pressure, dVal); return paramVal; } else if (paramName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_LOSS_COEFFICIENT) || paramName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FITTING_LOSS_KFACTOR_PARAM)) { double dVal = section.GetCoefficient(id); paramVal = FormatUtils.Format(helper.Doc, UnitType.UT_Number, dVal); return paramVal; } else if (paramName == LabelUtils.GetLabelFor(BuiltInParameter.CURVE_ELEM_LENGTH)) { double dVal = section.GetSegmentLength(id); paramVal = FormatUtils.Format(helper.Doc, UnitType.UT_Length, dVal); return paramVal; } Dictionary<string, string> fieldAndValue = new Dictionary<string, string>(); SectionsInfo.getSectionCommonInfo(section, fieldAndValue); if (fieldAndValue.ContainsKey(paramName)) return fieldAndValue[paramName]; return paramVal; }
public static void getSectionElements(MEPSection section, List<MEPCurve> curves, List<FamilyInstance> fittings, List<FamilyInstance> airterminals, List<FamilyInstance> equipments) { if (section == null) return; PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null) return; IList<ElementId> ids = new List<ElementId>(); ids = section.GetElementIds(); foreach (ElementId id in ids) { Element sectionMemElem = helper.Doc.GetElement(id); if (sectionMemElem is MEPCurve) { MEPCurve crv = sectionMemElem as MEPCurve; if (crv != null && curves != null) curves.Add(crv); } else if ((sectionMemElem is FamilyInstance) && (fittings != null || airterminals != null || equipments != null)) { FamilyInstance famInst = sectionMemElem as FamilyInstance; if (famInst == null) continue; if (((BuiltInCategory)famInst.Category.Id.IntegerValue == BuiltInCategory.OST_DuctFitting || (BuiltInCategory)famInst.Category.Id.IntegerValue == BuiltInCategory.OST_PipeFitting || (BuiltInCategory)famInst.Category.Id.IntegerValue == BuiltInCategory.OST_DuctAccessory || (BuiltInCategory)famInst.Category.Id.IntegerValue == BuiltInCategory.OST_PipeAccessory)) { if (fittings != null) fittings.Add(famInst); } else if ((BuiltInCategory)famInst.Category.Id.IntegerValue == BuiltInCategory.OST_DuctTerminal || (BuiltInCategory)famInst.Category.Id.IntegerValue == BuiltInCategory.OST_PlumbingFixtures) { if (airterminals != null) airterminals.Add(famInst); } else { if (equipments != null) equipments.Add(famInst); } } } }
public string getTotalPressureLossByType(MEPSection section, SectionMemberType eType) { string strVal = ""; if (section != null) { double dVal = 0.0; if (eType == SectionMemberType.Segment) { List <MEPCurve> curves = new List <MEPCurve>(); SectionsInfo.getSectionElements(section, curves, null, null, null); foreach (MEPCurve crv in curves) { dVal += section.GetPressureDrop(crv.Id); } } else if (eType == SectionMemberType.Fitting) { List <FamilyInstance> fittings = new List <FamilyInstance>(); SectionsInfo.getSectionElements(section, null, fittings, null, null); foreach (FamilyInstance famInst in fittings) { dVal += section.GetPressureDrop(famInst.Id); } } else if (eType == SectionMemberType.AirTerminal) { List <FamilyInstance> airTerminals = new List <FamilyInstance>(); SectionsInfo.getSectionElements(section, null, null, airTerminals, null); foreach (FamilyInstance famInst in airTerminals) { dVal += section.GetPressureDrop(famInst.Id); } } else if (eType == SectionMemberType.Equipment) { List <FamilyInstance> equipments = new List <FamilyInstance>(); SectionsInfo.getSectionElements(section, null, null, null, equipments); foreach (FamilyInstance famInst in equipments) { dVal += section.GetPressureDrop(famInst.Id); } } if (eType == SectionMemberType.Section) { dVal = section.TotalPressureLoss; } if (domain == ReportResource.pipeDomain) { strVal = FormatUtils.Format(doc, UnitType.UT_Piping_Pressure, dVal); } else { strVal = FormatUtils.Format(doc, UnitType.UT_HVAC_Pressure, dVal); } } return(strVal); }
public bool getSectionInfo(MEPSection section, DataTable sectionTB, bool forHTML = false) { if (section == null || sectionTB == null) { return(false); } PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null) { return(false); } PressureLossReportData reportData = helper.ReportData; if (reportData == null) { return(false); } List <string> sectionFields = new List <string>(); getFields(sectionFields); getSectionTable(section, sectionTB, sectionFields, reportData, forHTML); return(true); }
static public void getSectionCommonInfo(MEPSection section, Dictionary <string, string> fieldAndValue) { if (fieldAndValue == null) { return; } PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null) { return; } Document doc = helper.Doc; if (doc == null) { return; } if (helper.Domain == ReportResource.ductDomain) { fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_DUCT_FLOW_PARAM), FormatUtils.Format(doc, UnitType.UT_HVAC_Airflow, section.Flow)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_FRICTION), FormatUtils.Format(doc, UnitType.UT_HVAC_Friction, section.Friction)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_VELOCITY), FormatUtils.Format(doc, UnitType.UT_HVAC_Velocity, section.Velocity)); fieldAndValue.Add(ReportResource.sectionPressureLoss, FormatUtils.Format(doc, UnitType.UT_HVAC_Pressure, section.TotalPressureLoss)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_VELOCITY_PRESSURE), FormatUtils.Format(doc, UnitType.UT_HVAC_Pressure, section.VelocityPressure)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_REYNOLDSNUMBER_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, section.ReynoldsNumber)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_LOSS_COEFFICIENT), FormatUtils.Format(doc, UnitType.UT_Number, getFittingsLossCoefficient(section))); } else { fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FLOW_PARAM), FormatUtils.Format(doc, UnitType.UT_Piping_Flow, section.Flow)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_FRICTION), FormatUtils.Format(doc, UnitType.UT_Piping_Friction, section.Friction)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_VELOCITY), FormatUtils.Format(doc, UnitType.UT_Piping_Velocity, section.Velocity)); fieldAndValue.Add(ReportResource.sectionPressureLoss, FormatUtils.Format(doc, UnitType.UT_Piping_Pressure, section.TotalPressureLoss)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_VELOCITY_PRESSURE), FormatUtils.Format(doc, UnitType.UT_Piping_Pressure, section.VelocityPressure)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_REYNOLDS_NUMBER_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, section.ReynoldsNumber)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FRICTION_FACTOR_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, section.FrictionFactor)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FITTING_LOSS_KFACTOR_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, getFittingsLossCoefficient(section))); //need to check system type if (helper.SystemClassification == MEPSystemClassification.DomesticColdWater || helper.SystemClassification == MEPSystemClassification.DomesticHotWater || helper.SystemClassification == MEPSystemClassification.Sanitary) { fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FIXTURE_UNITS_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, section.FixtureUnit)); } else { fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FIXTURE_UNITS_PARAM), ReportConstants.emptyValue); } } fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_ROUGHNESS_PARAM), FormatUtils.Format(doc, UnitType.UT_Piping_Roughness, section.Roughness)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.CURVE_ELEM_LENGTH), FormatUtils.Format(doc, UnitType.UT_Length, section.TotalCurveLength)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_SECTION), section.Number.ToString()); }
static public string getSectionInfoByParamName(MEPSection section, string paramName, int nGetFrom, ElementId id) { string paramVal = ""; if (section == null || paramName == null || (nGetFrom & (int)SectionMemberType.Section) == 0) { return(paramVal); } PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null) { return(paramVal); } if (paramName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_PRESSURE_DROP) || paramName == ReportResource.pressureLoss) { double dVal = section.GetPressureDrop(id); if (helper.Domain == ReportResource.pipeDomain) { paramVal = FormatUtils.Format(helper.Doc, UnitType.UT_Piping_Pressure, dVal); } else { paramVal = FormatUtils.Format(helper.Doc, UnitType.UT_HVAC_Pressure, dVal); } return(paramVal); } else if (paramName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_LOSS_COEFFICIENT) || paramName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FITTING_LOSS_KFACTOR_PARAM)) { double dVal = section.GetCoefficient(id); paramVal = FormatUtils.Format(helper.Doc, UnitType.UT_Number, dVal); return(paramVal); } else if (paramName == LabelUtils.GetLabelFor(BuiltInParameter.CURVE_ELEM_LENGTH)) { double dVal = section.GetSegmentLength(id); paramVal = FormatUtils.Format(helper.Doc, UnitType.UT_Length, dVal); return(paramVal); } Dictionary <string, string> fieldAndValue = new Dictionary <string, string>(); SectionsInfo.getSectionCommonInfo(section, fieldAndValue); if (fieldAndValue.ContainsKey(paramName)) { return(fieldAndValue[paramName]); } return(paramVal); }
static public double getFittingsLossCoefficient(MEPSection section) { double dVal = 0.0; List <FamilyInstance> fittings = new List <FamilyInstance>(); SectionsInfo.getSectionElements(section, null, fittings, null, null); foreach (FamilyInstance famInst in fittings) { dVal += section.GetCoefficient(famInst.Id); } return(dVal); }
static public void getSectionsFromSystem(MEPSystem system, List <MEPSection> sections) { if (system == null || sections == null) { return; } int nSection = system.SectionsCount; if (nSection > 0) { for (int ii = 1; ii < nSection + 1; ++ii) //section number start from 1 { MEPSection section = system.GetSectionByNumber(ii); if (section == null) { continue; } sections.Add(section); } } }
static public void getSectionElements(MEPSection section, List <MEPCurve> curves, List <FamilyInstance> fittings, List <FamilyInstance> airterminals, List <FamilyInstance> equipments) { if (section == null) { return; } PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null) { return; } IList <ElementId> ids = new List <ElementId>(); ids = section.GetElementIds(); foreach (ElementId id in ids) { Element sectionMemElem = helper.Doc.GetElement(id); if (sectionMemElem is MEPCurve) { MEPCurve crv = sectionMemElem as MEPCurve; if (crv != null && curves != null) { curves.Add(crv); } } else if ((sectionMemElem is FamilyInstance) && (fittings != null || airterminals != null || equipments != null)) { FamilyInstance famInst = sectionMemElem as FamilyInstance; if (famInst == null) { continue; } if (((BuiltInCategory)famInst.Category.Id.IntegerValue == BuiltInCategory.OST_DuctFitting || (BuiltInCategory)famInst.Category.Id.IntegerValue == BuiltInCategory.OST_PipeFitting || (BuiltInCategory)famInst.Category.Id.IntegerValue == BuiltInCategory.OST_DuctAccessory || (BuiltInCategory)famInst.Category.Id.IntegerValue == BuiltInCategory.OST_PipeAccessory)) { if (fittings != null) { fittings.Add(famInst); } } else if ((BuiltInCategory)famInst.Category.Id.IntegerValue == BuiltInCategory.OST_DuctTerminal || (BuiltInCategory)famInst.Category.Id.IntegerValue == BuiltInCategory.OST_PlumbingFixtures) { if (airterminals != null) { airterminals.Add(famInst); } } else { if (equipments != null) { equipments.Add(famInst); } } } } }
private void getSectionTable(MEPSection section, DataTable tb, List <string> fileds, PressureLossReportData reportData, bool bForHtml = false) { if (tb == null || fileds == null || section == null || reportData == null) { return; } List <MEPCurve> curves = new List <MEPCurve>(); List <FamilyInstance> fittings = new List <FamilyInstance>(); List <FamilyInstance> airTerminals = new List <FamilyInstance>(); List <FamilyInstance> equipments = new List <FamilyInstance>(); PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null) { return; } getSectionElements(section, curves, fittings, airTerminals, equipments); Dictionary <string, string> fieldAndValue = new Dictionary <string, string>(); getSectionCommonInfo(section, fieldAndValue); if (bForHtml) { helper.addColumns(tb, fileds.Count); } else { helper.addColumns(tb, fileds.Count + 2); } List <string> segmentVals = new List <string>(); //segment row List <string> fittingVals = new List <string>(); //fitting row List <string> airTerminalVals = new List <string>(); //air terminal row List <string> equipmentsVals = new List <string>(); //equipment row if (!bForHtml) //for csv, the first column is the section number { segmentVals.Add(section.Number.ToString()); if (curves.Count < 1) { fittingVals.Add(section.Number.ToString()); } else { fittingVals.Add(" "); } if (curves.Count < 1 && fittings.Count < 1) { airTerminalVals.Add(section.Number.ToString()); } else { airTerminalVals.Add(" "); } if (curves.Count < 1 && fittings.Count < 1 && airTerminals.Count < 1) { equipmentsVals.Add(section.Number.ToString()); } else { equipmentsVals.Add(" "); } } segmentVals.Add(helper.Domain); fittingVals.Add(ReportResource.fittings); if (helper.Domain == ReportResource.pipeDomain) { airTerminalVals.Add(ReportResource.plumbingFixtures); } else { airTerminalVals.Add(ReportResource.airTerminals); } equipmentsVals.Add(ReportResource.equipments); foreach (string fieldName in fileds) { PressureLossParameter PLParam = helper.getPressureLossParamByName(reportData.AvailableFields, fieldName); if (PLParam == null) { continue; } if (fieldAndValue.ContainsKey(fieldName)) //section info { if ((PLParam.GetFrom & (int)SectionMemberType.Segment) > 0) { segmentVals.Add(fieldAndValue[fieldName]); } else { segmentVals.Add(ReportConstants.emptyValue); } if ((PLParam.GetFrom & (int)SectionMemberType.Fitting) > 0) { fittingVals.Add(fieldAndValue[fieldName]); } else { fittingVals.Add(ReportConstants.emptyValue); } if ((PLParam.GetFrom & (int)SectionMemberType.AirTerminal) > 0) { airTerminalVals.Add(fieldAndValue[fieldName]); } else { airTerminalVals.Add(ReportConstants.emptyValue); } if ((PLParam.GetFrom & (int)SectionMemberType.Equipment) > 0) { equipmentsVals.Add(fieldAndValue[fieldName]); } else { equipmentsVals.Add(ReportConstants.emptyValue); } } else if (curves.Count > 0 && (PLParam.GetFrom & (int)SectionMemberType.Segment) > 0) //read the value from first segment { MEPCurve firstCrv = curves[0]; if (firstCrv == null) { continue; } string strVal = helper.getParamValue(firstCrv.get_Parameter(fieldName)); segmentVals.Add(strVal); fittingVals.Add(ReportConstants.emptyValue); airTerminalVals.Add(ReportConstants.emptyValue); equipmentsVals.Add(ReportConstants.emptyValue); } else { segmentVals.Add(ReportConstants.emptyValue); fittingVals.Add(ReportConstants.emptyValue); airTerminalVals.Add(ReportConstants.emptyValue); equipmentsVals.Add(ReportConstants.emptyValue); } } //add total pressure loss segmentVals.Add(helper.getTotalPressureLossByType(section, SectionMemberType.Segment)); fittingVals.Add(helper.getTotalPressureLossByType(section, SectionMemberType.Fitting)); airTerminalVals.Add(helper.getTotalPressureLossByType(section, SectionMemberType.AirTerminal)); equipmentsVals.Add(helper.getTotalPressureLossByType(section, SectionMemberType.Equipment)); //add section pressure loss if (!bForHtml) //for csv, the last column is section pressure loss report { string sectionPL = fieldAndValue[ReportResource.sectionPressureLoss]; segmentVals.Add(sectionPL); if (curves.Count < 1) { fittingVals.Add(sectionPL); } else { fittingVals.Add(ReportConstants.mergeValue); } if (curves.Count < 1 && fittings.Count < 1) { airTerminalVals.Add(sectionPL); } else { airTerminalVals.Add(ReportConstants.mergeValue); } if (curves.Count < 1 && fittings.Count < 1 && airTerminals.Count < 1) { equipmentsVals.Add(sectionPL); } else { equipmentsVals.Add(ReportConstants.mergeValue); } } if (curves.Count > 0) { helper.addRow(tb, segmentVals); } if (fittings.Count > 0) { helper.addRow(tb, fittingVals); } if (airTerminals.Count > 0) { helper.addRow(tb, airTerminalVals); } if (equipments.Count > 0) { helper.addRow(tb, equipmentsVals); } }
public static double getFittingsLossCoefficient(MEPSection section) { double dVal = 0.0; List<FamilyInstance> fittings = new List<FamilyInstance>(); SectionsInfo.getSectionElements(section, null, fittings, null, null); foreach (FamilyInstance famInst in fittings) dVal += section.GetCoefficient(famInst.Id); return dVal; }
private bool getFittingInfo(MEPSection section, DataTable fittingTB, bool forHTML = false) { if (fittingTB == null || section == null) return false; PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null || helper.ReportData == null) return false; List<string> fittingFields = new List<string>(); if (helper.ReportData.FittingFields != null) getFields(fittingFields); if (forHTML) helper.addColumns(fittingTB, fittingFields.Count); else helper.addColumns(fittingTB, fittingFields.Count+2); List<FamilyInstance> fittings = new List<FamilyInstance>(); SectionsInfo.getSectionElements(section, null, fittings, null, null); if (fittings.Count < 1) return false; int nIndex = 0; foreach (FamilyInstance fitting in fittings) { List<string> paramVals = new List<string>(); if (!forHTML) { if (nIndex == 0) paramVals.Add(section.Number.ToString()); else paramVals.Add(" "); } foreach (string fieldName in fittingFields) { try { PressureLossParameter PLParam = helper.getPressureLossParamByName(helper.ReportData.FittingFields, fieldName); if (PLParam == null) continue; string strVal = ReportConstants.emptyValue; if ((PLParam.GetFrom & (int)SectionMemberType.Section) > 0) strVal = SectionsInfo.getSectionInfoByParamName(section, fieldName, PLParam.GetFrom, fitting.Id); else if ((PLParam.GetFrom & (int)SectionMemberType.Fitting) > 0) { if (helper.Domain == ReportResource.pipeDomain && fieldName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FITTING_LOSS_METHOD_SERVER_PARAM)) { string strValGUID = fitting.get_Parameter(fieldName).AsString(); Guid serverGUID = new Guid(strValGUID); //convert the GUID to server name //get the service first, and then get the server MultiServerService service = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.PipeFittingAndAccessoryPressureDropService) as MultiServerService; if (service != null && serverGUID != null) { IExternalServer server = service.GetServer(new Guid(strValGUID)); if (server != null) strVal = server.GetName(); } } else if (helper.Domain == ReportResource.ductDomain && fieldName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_DUCT_FITTING_LOSS_METHOD_SERVER_PARAM)) { string strValGUID = fitting.get_Parameter(fieldName).AsString(); Guid serverGUID = new Guid(strValGUID); //convert the GUID to server name //get the service first, and then get the server MultiServerService service = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.DuctFittingAndAccessoryPressureDropService) as MultiServerService; if (service != null && serverGUID != null) { IExternalServer server = service.GetServer(new Guid(strValGUID)); if (server != null) strVal = server.GetName(); } } else if (fieldName == ReportResource.elementId) strVal = fitting.Id.ToString(); else strVal = helper.getParamValue(fitting.get_Parameter(fieldName)); } else if ((PLParam.GetFrom & (int)SectionMemberType.Type) > 0) strVal = getFittingSymbolInfoByParamName(fitting, fieldName); paramVals.Add(strVal); } catch { //... } } if (!forHTML) //for csv, the last column is section pressure loss report { string strVal = ReportConstants.mergeValue; if (nIndex == 0) strVal = helper.getTotalPressureLossByType(section, SectionMemberType.Fitting); paramVals.Add(strVal); } nIndex++; helper.addRow(fittingTB, paramVals); } return true; }
private void getSectionTable(MEPSection section, DataTable tb, List<string> fileds, PressureLossReportData reportData, bool bForHtml = false) { if (tb == null || fileds == null || section == null || reportData == null) return; List<MEPCurve> curves = new List<MEPCurve>(); List<FamilyInstance> fittings = new List<FamilyInstance>(); List<FamilyInstance> airTerminals = new List<FamilyInstance>(); List<FamilyInstance> equipments = new List<FamilyInstance>(); PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null) return; getSectionElements(section, curves, fittings, airTerminals, equipments); Dictionary<string, string> fieldAndValue = new Dictionary<string, string>(); getSectionCommonInfo(section, fieldAndValue); if (bForHtml) helper.addColumns(tb, fileds.Count); else helper.addColumns(tb, fileds.Count+2); List<string> segmentVals = new List<string>();//segment row List<string> fittingVals = new List<string>();//fitting row List<string> airTerminalVals = new List<string>();//air terminal row List<string> equipmentsVals = new List<string>();//equipment row if (!bForHtml) //for csv, the first column is the section number { segmentVals.Add(section.Number.ToString()); if (curves.Count < 1) fittingVals.Add(section.Number.ToString()); else fittingVals.Add(" "); if (curves.Count < 1 && fittings.Count < 1) airTerminalVals.Add(section.Number.ToString()); else airTerminalVals.Add(" "); if (curves.Count < 1 && fittings.Count < 1 && airTerminals.Count < 1) equipmentsVals.Add(section.Number.ToString()); else equipmentsVals.Add(" "); } segmentVals.Add(helper.Domain); fittingVals.Add(ReportResource.fittings); if (helper.Domain == ReportResource.pipeDomain) airTerminalVals.Add(ReportResource.plumbingFixtures); else airTerminalVals.Add(ReportResource.airTerminals); equipmentsVals.Add(ReportResource.equipments); foreach (string fieldName in fileds) { PressureLossParameter PLParam = helper.getPressureLossParamByName(reportData.AvailableFields, fieldName); if (PLParam == null) continue; if (fieldAndValue.ContainsKey(fieldName)) //section info { if ((PLParam.GetFrom & (int)SectionMemberType.Segment) > 0) segmentVals.Add(fieldAndValue[fieldName]); else segmentVals.Add(ReportConstants.emptyValue); if ((PLParam.GetFrom & (int)SectionMemberType.Fitting) > 0) fittingVals.Add(fieldAndValue[fieldName]); else fittingVals.Add(ReportConstants.emptyValue); if ((PLParam.GetFrom & (int)SectionMemberType.AirTerminal) > 0) airTerminalVals.Add(fieldAndValue[fieldName]); else airTerminalVals.Add(ReportConstants.emptyValue); if ((PLParam.GetFrom & (int)SectionMemberType.Equipment) > 0) equipmentsVals.Add(fieldAndValue[fieldName]); else equipmentsVals.Add(ReportConstants.emptyValue); } else if (curves.Count > 0 && (PLParam.GetFrom & (int)SectionMemberType.Segment) > 0) //read the value from first segment { MEPCurve firstCrv = curves[0]; if (firstCrv == null) continue; string strVal = helper.getParamValue(firstCrv.get_Parameter(fieldName)); segmentVals.Add(strVal); fittingVals.Add(ReportConstants.emptyValue); airTerminalVals.Add(ReportConstants.emptyValue); equipmentsVals.Add(ReportConstants.emptyValue); } else { segmentVals.Add(ReportConstants.emptyValue); fittingVals.Add(ReportConstants.emptyValue); airTerminalVals.Add(ReportConstants.emptyValue); equipmentsVals.Add(ReportConstants.emptyValue); } } //add total pressure loss segmentVals.Add(helper.getTotalPressureLossByType(section, SectionMemberType.Segment)); fittingVals.Add(helper.getTotalPressureLossByType(section, SectionMemberType.Fitting)); airTerminalVals.Add(helper.getTotalPressureLossByType(section, SectionMemberType.AirTerminal)); equipmentsVals.Add(helper.getTotalPressureLossByType(section, SectionMemberType.Equipment)); //add section pressure loss if (!bForHtml) //for csv, the last column is section pressure loss report { string sectionPL = fieldAndValue[ReportResource.sectionPressureLoss]; segmentVals.Add(sectionPL); if (curves.Count < 1) fittingVals.Add(sectionPL); else fittingVals.Add(ReportConstants.mergeValue); if (curves.Count < 1 && fittings.Count < 1) airTerminalVals.Add(sectionPL); else airTerminalVals.Add(ReportConstants.mergeValue); if (curves.Count < 1 && fittings.Count < 1 && airTerminals.Count < 1) equipmentsVals.Add(sectionPL); else equipmentsVals.Add(ReportConstants.mergeValue); } if (curves.Count > 0) helper.addRow(tb, segmentVals); if (fittings.Count > 0) helper.addRow(tb, fittingVals); if (airTerminals.Count > 0) helper.addRow(tb, airTerminalVals); if (equipments.Count > 0) helper.addRow(tb, equipmentsVals); }
public static void getSectionCommonInfo(MEPSection section, Dictionary<string, string> fieldAndValue) { if (fieldAndValue == null) return; PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null) return; Document doc = helper.Doc; if (doc == null) return; if (helper.Domain == ReportResource.ductDomain) { fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_DUCT_FLOW_PARAM), FormatUtils.Format(doc, UnitType.UT_HVAC_Airflow, section.Flow)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_FRICTION), FormatUtils.Format(doc, UnitType.UT_HVAC_Friction, section.Friction)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_VELOCITY), FormatUtils.Format(doc, UnitType.UT_HVAC_Velocity, section.Velocity)); fieldAndValue.Add(ReportResource.sectionPressureLoss, FormatUtils.Format(doc, UnitType.UT_HVAC_Pressure, section.TotalPressureLoss)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_VELOCITY_PRESSURE), FormatUtils.Format(doc, UnitType.UT_HVAC_Pressure, section.VelocityPressure)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_REYNOLDSNUMBER_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, section.ReynoldsNumber)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_LOSS_COEFFICIENT), FormatUtils.Format(doc, UnitType.UT_Number, getFittingsLossCoefficient(section))); } else { fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FLOW_PARAM), FormatUtils.Format(doc, UnitType.UT_Piping_Flow, section.Flow)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_FRICTION), FormatUtils.Format(doc, UnitType.UT_Piping_Friction, section.Friction)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_VELOCITY), FormatUtils.Format(doc, UnitType.UT_Piping_Velocity, section.Velocity)); fieldAndValue.Add(ReportResource.sectionPressureLoss, FormatUtils.Format(doc, UnitType.UT_Piping_Pressure, section.TotalPressureLoss)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_VELOCITY_PRESSURE), FormatUtils.Format(doc, UnitType.UT_Piping_Pressure, section.VelocityPressure)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_REYNOLDS_NUMBER_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, section.ReynoldsNumber)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FRICTION_FACTOR_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, section.FrictionFactor)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FITTING_LOSS_KFACTOR_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, getFittingsLossCoefficient(section))); //need to check system type if ( helper.SystemClassification == MEPSystemClassification.DomesticColdWater || helper.SystemClassification == MEPSystemClassification.DomesticHotWater || helper.SystemClassification == MEPSystemClassification.Sanitary) fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FIXTURE_UNITS_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, section.FixtureUnit)); else fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FIXTURE_UNITS_PARAM), ReportConstants.emptyValue); } fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_ROUGHNESS_PARAM), FormatUtils.Format(doc, UnitType.UT_Piping_Roughness, section.Roughness)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.CURVE_ELEM_LENGTH), FormatUtils.Format(doc, UnitType.UT_Length, section.TotalCurveLength)); fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_SECTION), section.Number.ToString()); }
private bool getFittingInfo(MEPSection section, DataTable fittingTB, bool forHTML = false) { if (fittingTB == null || section == null) { return(false); } PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null || helper.ReportData == null) { return(false); } List <string> fittingFields = new List <string>(); if (helper.ReportData.FittingFields != null) { getFields(fittingFields); } if (forHTML) { helper.addColumns(fittingTB, fittingFields.Count); } else { helper.addColumns(fittingTB, fittingFields.Count + 2); } List <FamilyInstance> fittings = new List <FamilyInstance>(); SectionsInfo.getSectionElements(section, null, fittings, null, null); if (fittings.Count < 1) { return(false); } int nIndex = 0; foreach (FamilyInstance fitting in fittings) { List <string> paramVals = new List <string>(); if (!forHTML) { if (nIndex == 0) { paramVals.Add(section.Number.ToString()); } else { paramVals.Add(" "); } } foreach (string fieldName in fittingFields) { try { PressureLossParameter PLParam = helper.getPressureLossParamByName(helper.ReportData.FittingFields, fieldName); if (PLParam == null) { continue; } string strVal = ReportConstants.emptyValue; if ((PLParam.GetFrom & (int)SectionMemberType.Section) > 0) { strVal = SectionsInfo.getSectionInfoByParamName(section, fieldName, PLParam.GetFrom, fitting.Id); } else if ((PLParam.GetFrom & (int)SectionMemberType.Fitting) > 0) { if (helper.Domain == ReportResource.pipeDomain && fieldName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FITTING_LOSS_METHOD_SERVER_PARAM)) { string strValGUID = fitting.get_Parameter(fieldName).AsString(); Guid serverGUID = new Guid(strValGUID); //convert the GUID to server name //get the service first, and then get the server MultiServerService service = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.PipeFittingAndAccessoryPressureDropService) as MultiServerService; if (service != null && serverGUID != null) { IExternalServer server = service.GetServer(new Guid(strValGUID)); if (server != null) { strVal = server.GetName(); } } } else if (helper.Domain == ReportResource.ductDomain && fieldName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_DUCT_FITTING_LOSS_METHOD_SERVER_PARAM)) { string strValGUID = fitting.get_Parameter(fieldName).AsString(); Guid serverGUID = new Guid(strValGUID); //convert the GUID to server name //get the service first, and then get the server MultiServerService service = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.DuctFittingAndAccessoryPressureDropService) as MultiServerService; if (service != null && serverGUID != null) { IExternalServer server = service.GetServer(new Guid(strValGUID)); if (server != null) { strVal = server.GetName(); } } } else if (fieldName == ReportResource.elementId) { strVal = fitting.Id.ToString(); } else { strVal = helper.getParamValue(fitting.get_Parameter(fieldName)); } } else if ((PLParam.GetFrom & (int)SectionMemberType.Type) > 0) { strVal = getFittingSymbolInfoByParamName(fitting, fieldName); } paramVals.Add(strVal); } catch { //... } } if (!forHTML) //for csv, the last column is section pressure loss report { string strVal = ReportConstants.mergeValue; if (nIndex == 0) { strVal = helper.getTotalPressureLossByType(section, SectionMemberType.Fitting); } paramVals.Add(strVal); } nIndex++; helper.addRow(fittingTB, paramVals); } return(true); }
private bool getSegmentInfo(MEPSection section, DataTable segmentTB, bool forHTML = false) { if (segmentTB == null || section == null) return false; PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null || helper.ReportData == null) return false; //get fields from reportData List<string> segmentFields = new List<string>(); getFields(segmentFields); if (forHTML) helper.addColumns(segmentTB, segmentFields.Count); else helper.addColumns(segmentTB, segmentFields.Count+2); List<MEPCurve> curves = new List<MEPCurve>(); SectionsInfo.getSectionElements(section, curves, null, null, null); if (curves.Count < 1) return false; int nIndex = 0; foreach (MEPCurve crv in curves) { List<string> paramVals = new List<string>(); if (!forHTML) { if (nIndex == 0) paramVals.Add(section.Number.ToString()); else paramVals.Add(" "); } foreach (string fieldName in segmentFields) { PressureLossParameter PLParam = helper.getPressureLossParamByName(helper.ReportData.StraightSegFields, fieldName); if (PLParam == null) continue; string strVal = ReportConstants.emptyValue; if (((PLParam.GetFrom & (int)SectionMemberType.Section) > 0)) { strVal = SectionsInfo.getSectionInfoByParamName(section, fieldName, PLParam.GetFrom, crv.Id); } else if ((PLParam.GetFrom & (int)SectionMemberType.Segment) > 0) { if (helper.Domain == ReportResource.pipeDomain && fieldName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FLOW_STATE_PARAM)) { int nVal = crv.get_Parameter(fieldName).AsInteger(); strVal = LabelUtils.GetLabelFor((Autodesk.Revit.DB.Plumbing.PipeFlowState)nVal, helper.Doc); } else if ((fieldName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_SIZE_FORMATTED_PARAM) || fieldName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_DUCT_SIZE_FORMATTED_PARAM)) && ((BuiltInCategory)crv.Category.Id.IntegerValue == BuiltInCategory.OST_FlexDuctCurves || (BuiltInCategory)crv.Category.Id.IntegerValue == BuiltInCategory.OST_FlexPipeCurves)) { //for flex duct/pipe, no size parameter, using diameter? if (helper.Domain == ReportResource.pipeDomain) strVal = helper.getParamValue(crv.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM)); else { //TBD: need to check round or rect strVal = helper.getParamValue(crv.get_Parameter(BuiltInParameter.RBS_CURVE_DIAMETER_PARAM)); } } else if (fieldName == ReportResource.elementId) strVal = crv.Id.ToString(); else strVal = helper.getParamValue(crv.get_Parameter(fieldName)); } else if ((PLParam.GetFrom & (int)SectionMemberType.Type) > 0) strVal = getSegmentTypeInfoByParamName(crv, fieldName); paramVals.Add(strVal); } if (!forHTML) //for csv, the last column is section pressure loss report { string strVal = ReportConstants.mergeValue; if (nIndex == 0) strVal = helper.getTotalPressureLossByType(section, SectionMemberType.Segment); paramVals.Add(strVal); } nIndex++; helper.addRow(segmentTB, paramVals); } return true; }
private bool getSegmentInfo(MEPSection section, DataTable segmentTB, bool forHTML = false) { if (segmentTB == null || section == null) { return(false); } PressureLossReportHelper helper = PressureLossReportHelper.instance; if (helper == null || helper.ReportData == null) { return(false); } //get fields from reportData List <string> segmentFields = new List <string>(); getFields(segmentFields); if (forHTML) { helper.addColumns(segmentTB, segmentFields.Count); } else { helper.addColumns(segmentTB, segmentFields.Count + 2); } List <MEPCurve> curves = new List <MEPCurve>(); SectionsInfo.getSectionElements(section, curves, null, null, null); if (curves.Count < 1) { return(false); } int nIndex = 0; foreach (MEPCurve crv in curves) { List <string> paramVals = new List <string>(); if (!forHTML) { if (nIndex == 0) { paramVals.Add(section.Number.ToString()); } else { paramVals.Add(" "); } } foreach (string fieldName in segmentFields) { PressureLossParameter PLParam = helper.getPressureLossParamByName(helper.ReportData.StraightSegFields, fieldName); if (PLParam == null) { continue; } string strVal = ReportConstants.emptyValue; if (((PLParam.GetFrom & (int)SectionMemberType.Section) > 0)) { strVal = SectionsInfo.getSectionInfoByParamName(section, fieldName, PLParam.GetFrom, crv.Id); } else if ((PLParam.GetFrom & (int)SectionMemberType.Segment) > 0) { if (helper.Domain == ReportResource.pipeDomain && fieldName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FLOW_STATE_PARAM)) { int nVal = crv.get_Parameter(fieldName).AsInteger(); strVal = LabelUtils.GetLabelFor((Autodesk.Revit.DB.Plumbing.PipeFlowState)nVal, helper.Doc); } else if ((fieldName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_SIZE_FORMATTED_PARAM) || fieldName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_DUCT_SIZE_FORMATTED_PARAM)) && ((BuiltInCategory)crv.Category.Id.IntegerValue == BuiltInCategory.OST_FlexDuctCurves || (BuiltInCategory)crv.Category.Id.IntegerValue == BuiltInCategory.OST_FlexPipeCurves)) { //for flex duct/pipe, no size parameter, using diameter? if (helper.Domain == ReportResource.pipeDomain) { strVal = helper.getParamValue(crv.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM)); } else { //TBD: need to check round or rect strVal = helper.getParamValue(crv.get_Parameter(BuiltInParameter.RBS_CURVE_DIAMETER_PARAM)); } } else if (fieldName == ReportResource.elementId) { strVal = crv.Id.ToString(); } else { strVal = helper.getParamValue(crv.get_Parameter(fieldName)); } } else if ((PLParam.GetFrom & (int)SectionMemberType.Type) > 0) { strVal = getSegmentTypeInfoByParamName(crv, fieldName); } paramVals.Add(strVal); } if (!forHTML) //for csv, the last column is section pressure loss report { string strVal = ReportConstants.mergeValue; if (nIndex == 0) { strVal = helper.getTotalPressureLossByType(section, SectionMemberType.Segment); } paramVals.Add(strVal); } nIndex++; helper.addRow(segmentTB, paramVals); } return(true); }