Grasshopper

algorithmic modeling for Rhino

Within a scripted component I am creating a set of points (in a data tree) and a set of doubles (in a matching data tree); the script works fine. I want to use the doubles in a TextTag3d located at the points. However, some of the points will not have a corresponding tag (in the jpg example the first two points should have no value), I thought that by making a tree structure I could be sure that the values would line up with the correct points, but you can see that it instead it acts a lot like two flat lists compared by Longest-List (and repeats the last value until the point tree is full).

I realized that within the script I could add  'myDatatree.add(Nothing, path)' for the points I want empty, but I've had this issue before with non-scripted operations and it's a fundamental confusion I still have about Trees and their frequently unpredictable (to me) behavior.
If anyone can explain why this happens or a better way to fill in empty branches (dynamically) I'd appreciate it, thanks.

Views: 228

Attachments:

Replies to This Discussion

Hi Trevor,

so if I understand correctly you're building two DataTrees with different amounts of branches. However, the branches that do exist have a matching branch on the other tree?

Components (at this point in space-time) are not particularly aware of exact data paths. They will simply combine the first branch in parameter A with the first branch in parameter B, regardless of whether they are called {0;0} and {0;2} respectively. This is something that probably needs tuning up but I don't really know how yet. I've had a few ideas about this but none of them hold up under scrutiny (other ideas welcome).

If you're creating two trees that are supposed to be 'matched', then I strongly suggest you either add empty branches (or branches containing null data) to the B tree, or omit the corresponding branches on the A tree.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
That explains a lot. I've always assumed they were rigid matrices of exact data paths.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service