示例#1
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var formula = DA.GetData <string>(0);
            var s       = DA.GetData <double>(1);

            if (string.IsNullOrEmpty(formula))
            {
                return;
            }

            var parser = new GH_ExpressionParser();

            parser.AddVariable("S", s);
            parser.AddVariable("Height", 1.0);

            var result = parser.Evaluate(formula);

            if (result != null && result.IsNumeric)
            {
                var t = result.Type;

                double res = result.Data <double>();

                DA.SetData(0, res);
            }
        }
示例#2
0
        public CustomAlgorithm(string[] expressionStrings)
        {
            parsers = new GH_ExpressionParser[expressionStrings.Length];

            for (int i = 0; i < expressionStrings.Length; i++)
            {
                parsers[i] = new GH_ExpressionParser();
                parsers[i].CacheSymbols(expressionStrings[i]);
            }
        }
示例#3
0
 public PointEvaluator()
 {
     _parser     = new GH_ExpressionParser();
     _geo_points = new Dictionary <string, Point3d>();
 }