public static List<MouldCurve> ExtractCurves(string eq, Sail sail) { List<MouldCurve> param = new List<MouldCurve>(); Expression ex = new Expression(eq); ex.EvaluateFunction += delegate(string name, FunctionArgs args) { if (name == "Length") param.Add(sail.FindCurve(args.Parameters[0].ToString())); args.Result = 1; }; ex.EvaluateParameter += delegate(string name, ParameterArgs args) { param.AddRange(ExtractCurves(name, sail)); args.Result = 1; }; ex.Evaluate(); return param; }
private static double EvaluteKeyWordOnCurve(string KeyWord, string curveName, Sail sail) { switch (KeyWord) { case "length": MouldCurve curve = sail.FindCurve(curveName); if (curve == null) return double.NaN; return curve.Length; default: return double.NaN; } }
private static double EvaluteKeyWordOnCurve(string KeyWord, string curveName, Sail sail, ref List<MouldCurve> curves) { switch (KeyWord) { case "length": MouldCurve curve = sail.FindCurve(curveName); if (curve == null) return double.NaN; if (!curves.Contains(curve)) curves.Add(curve); return curve.Length; default: return double.NaN; } }
public bool ReadScript(Sail sail, IList<string> txt) { if (txt.Count != 3) return false; //[1] = "\t\tCurve: Luff" m_curve = sail.FindCurve(txt[1].Split(new char[]{':'})[1].Trim()); txt[2] = txt[2].Trim('\t'); string[] split = txt[2].Split(new char[] { ':' }); S_Equ = new Equation(split[0], split[1]); return Update(sail); #region Old //string line; //double d; //foreach (string s in txt) //{ // line = s.TrimStart('\t'); // if (line.StartsWith("S-Cur: ")) // { // if (double.TryParse(line.Substring(7), out d)) // m_sCurve = d; // } // else if (line.StartsWith("Curve: ")) // { // string curlbl = line.Substring(7).Trim(); // m_curve = sail.FindCurve(curlbl); // } //} //return true; #endregion }