Grasshopper

algorithmic modeling for Rhino

Hello,

this is probably very easy, but I still can't get it, or even find the answer on the forum, so,

I have a tree, and I need to replace say, X first branches with X last ones, mirroring them, for example:

{1}          {6}      Is this possible to do with Replace Branches?

{2}          {5}

{3}    =>  {3}

{4}          {4}

{5}          {5}

{6}          {6}

If it were two lists, then it's very easy with List Replace, but kill me, I can't get what's the logic in Replace Branches...

Please help!

Views: 5819

Replies to This Discussion

maybe like this?

Thanks for the reply,

well, in your def I do get the correct order of branches after Merge, but what is the ReplaceBranches doing?

So the Tree Branch instead of the Replace Branches did the job, 

but can anyone explain how to use RB properly in this case?

Based on my modest knowledge, it's the way Grasshopper works - it will merge the branches with the same marking (path). That is why the tree has 8 instead of 10 branches. So you can only replace the data inside of the branches, not replace the marking of the branches in a way that you have two of them separated but of the same mark (path).

I did a bit sloppy definition which like in Artyom's case uses "Tree branch" component and the "Merge" one in the end:

Attachments:

I agree with you on the merging thing, missed that moment, thanks)

Don't you think your def is a bit overcomplicated? I just couldn't quite follow the logic of it... 

Does anyone have a good explanatory example of how to use ReplaceBranches component?

You input your data tree into the "D" plug. You input the list of branches of that tree into the "S" plug". At the "R" you input the list of the branches you wish to replace with the ones from the "S" plug. Like Phillip did.
The only problem is that if there are some duplicates of the branches marks (paths), Grasshopper will merge them.
So, you can use the "Replace branches" component - but separately, or at least before merging the reminder and starting(and last) particular number of branches.

A simplified version using Phillip's components:

Attachments:

Thanks, that helped!

I need to replace the last 3 branches (15, 19 and 23) in the tree on the left with the 3 branches in the tree on the right. However once merged I need the last 3 branches on the right to have the branch index's of 15, 19, 23.

I simply needed to rotate the planes of the last 3 branches and re-insert into the tree.

best, p

Attachments:

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