algorithmic modeling for Rhino
You can't, code inside components is typically not usable from within other components. Luckily the mComp component doesn't do anything tricky, it just gets a list of all mesh vertices, faces, normals and colours from a Rhino.Geometry.Mesh instance.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
thank you :)
even if I compile on visual studio I can not ,
my goal is just I wanted to decrease the number of input
Hi David help me :))
Here I define an input:
pManager.AddLineParameter ("Line", "elt", "list of Line" GH_ParamAccess.list);
then
protected override void SolveInstance (IGH_DataAccess DA)
{
/ / Declaration of variable inputs
List <line> elts = new List <line> ();
if (! DA.GetData (0, ref elts))
{
return;
}
.....
}
when I assign input component turns red
there is a problem here
if (! DA.GetData (0, ref elts))
{
return;
}
I don't know what's the problem?
if (! DA.GetData (0, ref elts))
If an input has GH_ParamAccess.list access, then you need to use DA.GetDataList() instead of DA.GetData(). The same is true for DA.GetDataTree() and also DA.SetData(), DA.SetDataList() and DA.SetDataTree().
There should have been an error that sort of explained this:
Did you not get this error?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Again, if you've set your output parameter access GH_ParamAccess.list, then you cannot use DA.SetData(), you have to use DA.SetDataList().
You can wrap up a two-dimensional array of doubles into a GH_ObjectWrapper, but then you have to change your output access from list to item:
pManager.Register_DoubleParam("table", "A", "tabelts", H_ParamAccess.item);
--
David Rutten
david@mcneel.com
Poprad, Slovakia
David, I can't assigned to the output table.
output is still empty :/ I don't know what is the problem I even tested it:
tabelts [1,1] = 6;
DA.SetData List (1 tabelts];
but output still empty: (
tabelts [1,1] = 6;
DA.SetData List (1 tabelts];
There's 4 bugs in that second line. There's no way that compiled. You can't have spaces in method names, it either has to be
DA.SetData
or
DA.SetDataList
but
DA.SetData List
is not valid C# code. You must use the same brackets, you can't open with a parenthesis and close with a square bracket. Arguments must be separated by commas,
(1 tabelts];
should be
(1, tabelts);
If you want to output a multi-dimensional array, do the following:
GH_ObjectWrapper wrap = new GH_ObjectWrapper(tabelts);
DA.SetData(1, wrap);
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by