Grasshopper

algorithmic modeling for Rhino

Hello everyone,

I need some help with selecting multiple branches in a datatree.

Is it possible to do this with a domain component with sliders attached to it, like i can with items within a branch?

Thanks i advance

greetings Reinder Weenink

Views: 3645

Replies to This Discussion

Hi Reinder,

do you know the paths to these branches, or the indices of them, or...?

--

David Rutten

david@mcneel.com

Yes, you can construct the Mask yourself from text. Here's an example:

Attachments:

Another Variation

Hi David and Danny,

Thanks for the replies. I've added my grasshopper file to explain what im after.

Reinder Weenink

Attachments:

Without any geometry[1] it still makes it difficult to understand what it should look like. But the Theory remains the same.

[1] You can Internalise Geometry into a GH file By Right Clicking on the Parameter you have referenced Geometry from and selecting Internalise from the Context Menu

Attachments:

Here's the solution I generally use for that (also my #1 tool in debugging datatrees)

Which in essence is a extremely simple C# script, with one DataTree<object> input, one integer input, and the one line of code:

A = tree.Branches[i];

The code in the file contains a little bit more love, not to be thrown around with all kinds of null exceptions.

private void RunScript(DataTreetree, int i, bool keepPath, ref object A) {
if (tree == null || tree.BranchCount == 0)
{
return;
}
if (keepPath)
{
DataTreekp = new DataTree(); kp.AddRange(tree.Branches[i], tree.Path(i)); A = kp;
return;
}
A = tree.Branches[i];
}
Attachments:

Thanks so much!

Reinder Weenink

Hello everyone,

I have a similar problem, which I cannot solve by the advice already given.

I am trying to extract branches from a tree by indices from branches from another tree. 

So I have tree 1 with 9 branches and tree 2 with 26 branches which each have 4 indices corresponding to one of the branches of tree 1. Now I would like to have for every branch of tree 2 the corresponding 4 branches of tree 1. The result would have a path in the form of {0 to 25;0 to 3}.

So far, the only way I have managed to get something close is by using the 'Explode Tree' component. However, I want it to be dynamical, so that the amount of branches in both trees can vary. In this setting the explode tree component would have to be changed manually to fit the right amount of branches.

Could anyone give me some advice?

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service