Grasshopper

algorithmic modeling for Rhino

Hi everybody. It's already quite a while I'm using Gh but I never got this:

Branches are a great way to avoid coping and pasting parts of code, but I couldn't figure out yet how to use them multiple times in a row:
let's consider this example:

So, the curve components contain one curve each (the top and the bottom one on the snapshot). I use branches to pull the points of the tweened curve to both the top and the bottom curves by just using one single CrvCP component.
Similarly I would like to adapt the script so to do the same thing for a multitude of (couples of) curves:

So I thought (as it works for grafting simple lists) it could be done by putting one of the inputs on an higher branch level:

I thought that the branch {0,0} would be combined with both the branches {0} and {1} and the branch {1,0} again both with {0} and {1}, but this is not the case.
Could you help me understanding that?

Views: 531

Attachments:

Replies to This Discussion

Actually since your curves are separate to begin with, to me it makes the most sense to also use two Curve CP components:

The problem you're having is that you have two lists of points and you're projecting those two lists onto four curves. If you do not want to use two components for the projection, you're going to have to duplicate your point data instead so that there is a 'fresh' list of division points for each projection. It going to be more complicated than using two CP components.

Thanks for the reply. This clears up some doubts I had about threes.
I've had this situation a couple of times: I made a piece of script that worked for, let's say, an instance of a repeated geometry, like this couple of curves or a single module of a facade. Then, I had  the need of repeating that algorithm over all the instances of that base geometry, like all the tiles of the facade. You obviously can't copy and paste the script as many times as the the instances you have. So what if I had 100 of those couples of curves?
I thought there was a way to put them on a "higher hierarchical level"...
In other words: a way to store that x and yso that the final result would have been something like:
{0;0}
0. 0ax
1. 1ax
2. 2ax

{0;1}
0. 0bx
1. 1bx
2. 2bx

{1,0}
0. 0ay
1. 1ay
2. 2ay

{1,1}
0. 0by
1. 1by
2. 2by

like "supergrafting" them. I thought that was the reason of having branches and sub-branches and sub-sub-branches and so on...

As David pointed out, for a larger number of lines you must "prepare" your data before finding [CurveCP].

Fastest way is by using [CrossReference]. Only problem with this is the output data structure, so if this is important for the next steps of your definition, you will have to prepare the lists manually. Here are both ways:

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