Grasshopper

algorithmic modeling for Rhino

Hi all!, someone know how i can store data in a component? because i need the first data for use in the second execution. i maked in a Script Component like in the screenshot, but i need it in a component.

Exactly i need to know where i have to write the line in the red square...

thanks all.

Views: 1584

Attachments:

Replies to This Discussion

The way you're doing it now is correct. By declaring your list as a class level variable it will stick around between consecutive calls to RunScript() or SolveInstance(). There's no difference here between Script components and regular components.

I would recommend always prefixing your variable declarations with a scope, even though C# always assumes a default one:

private List<double> _stickyData = new List<double>();

Hi david thanks for your reply. i write this, but when i connect the output to a panel no have data

protected override void SolveInstance(IGH_DataAccess DA)
{
double num = 0;
DA.GetData(0, ref num);
l.Add(num);
DA.SetData(0, l);
}
public List<double> l = new List<double>();

Try using SetDataList instead of SetData :)

yes, of course i forget to put DA.setDataList. thanks Long Nguyen!

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service