Grasshopper

algorithmic modeling for Rhino

Hi All,

I find myself stumped on something I am trying to do with a data tree.

I want to retrieve the last part of a path, per item in the data tree i.e.

{0;1}

OBJECT - Return 1

OBJECT - Return 1

{0;2}

OBJECT - Return 2

{1;1}

OBJECT - Return 1

{1;2}

EMPTY

{1;3}

OBJECT - Return 3

OBJECT - Return 3

So I want to run the above tree and return

{0} 1

{1} 1

{2} 2

{3} 1

{4} 3

{5} 3

I have tried with tree statistics and deconstruct path - but this does not return the path per item - it returns the path per branch. I.e. if a branch has 3 items it only returns the path once, rather than three times.

If anyone could advise how this could be done I would be most appreciative.

Regards

Lyndon 

Views: 622

Replies to This Discussion

As is always the way, you search for hours, find nothing, post and find the solution within minutes.

A component out of tree-frog basically does this:

http://www.grasshopper3d.com/forum/topics/retrieve-path-of-all-item...

Though funny enough the way i was doing it originally with the tree statistics and deconstruct path actually gives me the data I need (due to duplicates in the data).

Thanks!

Uh...  Looks like 'Flatten' to me?  Would help (as ALWAYS!) to post GH code/data.

Hi Joseph,

It was a conscious decision not to upload the GH code - what i was looking for above is a small part of large and pretty badly arranged circuit - which i am in the process of re-writing. I didn't want to bog people down.

Flatten wasn't what I was looking for, I didn't want the objects themselves, rather i was looking for the second part of the tree path per object.

Cheers

Lyndon

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service