//get specificaions regarding the dia and spacing public static List <FEMS_Specs> GetFEMS_Specs(specificationData configFileData) { List <FEMS_Specs> specList = new List <FEMS_Specs>(); FEMS_Specs specs = new FEMS_Specs(); try { if (File.Exists(configFileData.specsFile)) { //read all the contents of the file into a string array string[] fileContents = File.ReadAllLines(configFileData.specsFile); string[] splitLines = null; for (int i = 0; i < fileContents.Count(); i++) { splitLines = fileContents[i].Split(' '); if (splitLines[0] != "" && splitLines[1] != "") { specs.dia = double.Parse(splitLines[0].Trim()); specs.spacing = double.Parse(splitLines[1].Trim()); specList.Add(specs); } } } } catch { return(null); } return(specList); }
//method to make choice for placing family instances based on the pipe diameter public static double GetSpacing(Element ele, List <FEMS_Specs> specList) { double dia = 0; Curve pipeCurve = null; FEMS_Specs diaAndSpacing = new FEMS_Specs(); try { diaAndSpacing.dia = 0.0; diaAndSpacing.spacing = 0.0; List <XYZ> points = new List <XYZ>(); if (Math.Round(((LocationCurve)ele.Location).Curve.GetEndPoint(0).Z, 5) == Math.Round(((LocationCurve)ele.Location).Curve.GetEndPoint(1).Z, 5)) { pipeCurve = ((LocationCurve)ele.Location).Curve; //converting dia dn length into millimeters dia = 304.8 * ele.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM).AsDouble(); foreach (FEMS_Specs specs in specList) { if (specs.dia == dia) { diaAndSpacing = specs; break; } } } } catch { return(-1); } return(diaAndSpacing.spacing); }