Grasshopper

algorithmic modeling for Rhino

Hi everyone.

I am in the middle of making some components with visual studio in c#. I try to make a bunch of data list become split in every four data. I can do it normally with path mapper. But how to make this happen with c#?

For example: 1,2,3,4,5,6,7,8,9,10 become {0}1,2,3,4 ; {1}5,6,7,8 ; {2}9,10

Actually I want to make this on the input of component. So the component read it on separated branch of list.

Manually, visualized with those picture of path mapper.

Thanks for responding.

Views: 920

Attachments:

Replies to This Discussion

Hi Tom, thanks for your respond.

protected override void SolveInstance(IGH_DataAccess DA)
{
DataTree<object> entry = new DataTree<object>();
DataTree<object> entries = new DataTree<object>();

if (!DA.SetDataTree(0, entry)) { return; }

for (int i = 0; i < (entry.Branches.Count/4); i++)
{
entries.Add(entry, entry.Path(i));
}
DA.SetDataTree(0,entries);
}

Is it like that? But I still got empty generic data on output in grasshopper. Or did I have the wrong coding structure? (I am new to this c#)

SOLVED

Thank you very much Tom. I used the GH_Path increments and some for looping, with list count absolutely. As you said, and it worked.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service