Hi all,
can someone tell me how to access a tree as an input in visual studio.
I tried
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
pManager.AddGenericParameter("Tree", "Tr", "Tree", GH_ParamAccess.tree);
}
Output:
protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
pManager.AddGenericParameter("T", "T", "Tree", GH_ParamAccess.tree);
}
but if i try to output the tree a error appears that ‘object’ cant be used as a type parameter ‘T’.
The Type should be strings ,doubles or integers so i thought generic is a good idea but there is no Grasshopper.Kernel.Types.GH_Generic.
As a python noob and c# supernoob all these type things are really confusing.
protected override void SolveInstance(IGH_DataAccess DA)
{
Grasshopper.DataTree<object> tr = new Grasshopper.DataTree<object>();
if(!DA.GetDataTree<object>(0, out tr))return;
Grasshopper.DataTree<object> tr_out = tr;
DA.SetDataTree(0, tr_out);
}
Is there any example code of a component where the input is a data tree ?.
If the c# script component is used there is no problem
Any tip how the datatree input can be accesses and outpouted as a component would be great.