Grasshopper

algorithmic modeling for Rhino

I am working on a project where the data tree structure is very important. I'm bringing some data into a python component. I'm kind of new to using trees, but i've managed to extract the information from the tree and work with it in the script. I'm then able to output new information as a data tree. My only issue is that I'm not sure how to make the paths of my new data tree match those the input tree(in the image, the input path on the left is {19:0}, {19;1} etc. and the output is {0;0},{1;0} etc (this was an arbitrary path i made in the script when adding items to the tree. I basically want the circled parts to match each other).I've been able to fix this by using the "match tree" component, but I'm wondering if there is a way to do this within the python script itself, so I don't have to have Match tree components all over. Thanks!

Views: 1476

Attachments:

Replies to This Discussion

A simple approach would be to assign/update/set the items in the DataTree Branches "in place" and then output the same DataTree (or a copy of it, or assign it to a new output parameter name). See attached file.

Attachments:

Anders,

Thanks for the response. I don't think that that file is doing what I'm looking for. I'm not trying to change the data IN the branches, but rather, I'm trying to change the numbering of the branches in the output tree to match the input tree. In my original image, I'm trying to make the {0,0} output branch match the {19,0} branch in the input. The data contained in each branch is fine, I don't want to change that. 

hi. i'm also new for scripting in phyton. so i was looking for some topics(discussions) and i believe this answer in another discussion will give you way for what you seeking :)

http://www.grasshopper3d.com/forum/topics/tree-structure-in-python?...

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service