Grasshopper

algorithmic modeling for Rhino

Hi,

In GH component, I am having trouble using input of type "double" with GH_ParamAccess.tree. Help is appreciated.

It worked fine for me when using a point tree structure:

-------------

pManager.Register_PointParam("Points", "P", "PointTree", GH_ParamAccess.tree);

..

//then declare it as a GH_Structure inside SolveInstance::

GH_Structure<GH_Point> pt_tree = new GH_Structure<GH_Point>();

..

//then read it:

if (!DA.GetDataTree("Points", out in_grid)) { return; }

--------------

But when using double, I am trying the following:

pManager.Register_DoubleParam("Weight", "W", "DoubleTree", GH_ParamAccess.tree);

//declare inside SolveInstance:

List<double[]> w_tree = new List<double[]>();

//then read it

if (!DA.GetDataTree("Weight", out w_tree )) { return; }

>>This last line gives error:

"The type arguments for method 'Grasshopper.Kernel.IGH_DataAccess.GetDataTree<T>(int, out Grasshopper.Kernel.Data.GH_Structure<T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly."

This does not work either:

GH_Structure<double> w_tree = new GH_Structure<double>();

Views: 674

Replies to This Discussion

Hi Rajaa,

Try using the type GH_Number instead of double in your GH_Structure within the solve instance method.

Cheers,  Jon

Hi Jon,

That worked... Thanks.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service