Grasshopper

algorithmic modeling for Rhino

Hi guys, 

I have tree with n branches, in each branch I have  n sub branches. Then in each of those sub-branches I have n elements. I am making a component in c# where I need to manage all the data. Now if I do '' tree.Branch(y)" it gives me the y sub branch. Is there a way of controlling the branch number as well as the sub branch number using 2 variables( example: "tree.Branch(x;y)" which gives the sub branch number y in the branch number x) ? 

Thank you for your help. 

Views: 954

Replies to This Discussion

Hi Godjenka,

Use comma instead of semicolon when supplying a path to the Branch method:

tree.Branch(0,24,3)  # access the 0;24;3 branch

Thanks a lot for your help! 

Hi,

here is an example in C# syntax:

string result = string.Empty;

int j = 1; // <--- here you can choose the sub branch
for (int i = 0; i < Tree.Branches.Count; i++)
{
result = Tree.Branches[i][j].ToString();
}

A = result;

And speaking about trees and C#:

This counts subbranches, indices, cats, dogs ... whatever in variable (or not) trees. Useful when things are not "normalized" (rather the norm in most engineering cases, he he).

Attachments:

Thx

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service