Exemplo n.º 1
0
        public static GH_Dict create(object key, object num)
        {
            GH_Dict dict = new GH_Dict();

            dict.val.Add(key, num);

            return(dict);
        }
Exemplo n.º 2
0
        public static GH_Dict create(object key, object num)
        {
            GH_Dict dict = new GH_Dict();

            dict.val.Add(key, num);

            return dict;
        }
Exemplo n.º 3
0
        private double EvaluateCell(int cell_index, double cur_val, List <double> n_vals)
        {
            //Dictionary<string, double> h_dict;
            var   t      = Type.GetType("IronPython.Runtime.List,IronPython");
            IList n_list = Activator.CreateInstance(t) as IList;

            foreach (double d in n_vals)
            {
                object cast = d;
                n_list.Add(cast);
            }

            Dictionary <string, double> h_dict = new Dictionary <string, double>();

            h_dict.Add("a", 1.0);

            GH_Dict test = GH_Dict.create("a", cur_val);


            _py.SetVariable("n_vals", n_list);
            _py.SetVariable("h_val", cur_val);
            _py.SetVariable("h_idx", cell_index);
            _py.SetVariable("h_dict", h_dict);
            _py.SetVariable("test", test);

            try {
                _compiled_py.Execute(_py);
            } catch (Exception ex) {
                AddErrorNicely(m_py_output, ex);
            }
            //object o = _py.GetVariable("h_val");
            GH_Dict out_dict = (GH_Dict)_py.GetVariable("test");
            var     o        = out_dict.val["b"];

            return(System.Convert.ToDouble(o));
        }