Grasshopper

algorithmic modeling for Rhino

simple question, what's the syntax for reading from a data tree?

normally I would use an integer of each item in a list in brackets as in list(i)

when i have a tree where each branch has two forks...as in:
[0:0][0:1][0:2], [1:0][1:1][1:2], [2:0][2:1][2:2]...and so on

how do I read each branch? I am kind of lost here...the first two branches will only have one item while the third will have a few. If anyone can point in the direction of some documentation or tutorial I would really appreciate it...

thanks!

Views: 3700

Replies to This Discussion

i do, except i have separated out the first boolean into its own path

(0}{ 0){1,4,5,2,7,2,5,2}
(0}{1){6,8,2,5,2,3}
(0}{2){0,4,5,2,7,2,5,2}
(0}{ 3){4,88}
(0}{4){0,7,2,5,2}
(0}{ 5){6,5,8,2,5,2,3}

do it doesn't matter whether i make a datatree with eh_paths or whether i go with plain arraylists? what about accessing its fields and changing values - am i going about things the right way?
Can you hook a tree viewer to your tree (coming out of your VB component) and post the image?

Do you need to navigate your tree inside your VB component, using GH components or using another VB component?
need to navigate tree inside vb...tree is constructed in the same vb

i'll post image

rajaa, i'm pretty sure a custom class would solve this in an instant - 1d array of objects wth fields, one for each of the items - integers, booleans, and lists of integers...any reference materials for creating classes in vb? I know how to do it in java...
nevermind. figured out class stuff. this opens a world of possibilities...
rajaa - rhino keeps crashing in my vb script where i have a new list(of list(of integer))

is this not possible? in vb you can definitely do this - is there an alternative way i should be making lists of lists?
Hi Gabriel,
If you are navigating the tree inside your VB component, there is no need to use tree structure. Using lists is probably a better choice.

List of lists should work. Also you can use ArrayList. You probably already checked the primer (second edition) for samples. You are probably crashng somewhere else.

If you have complex script, it might be a good idea to debug it using Visual Studio Express.
YEAH, it was a problem with my recursive function and not giving the program a way out - i found the solution in the end...

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service