Applying the Same GH Routine Across Several Objects

Hello everyone,

I am currently working on the construction of a geometry, a very simple one in comparison with what one would often see on the forum, but since I am using Rhino and Grasshopper for the very first time I am struggling to do what I have in mind. Which is why I am asking you for help.

For context, I’m building a Grasshopper routine to transpose a geological profile (a set of 4 curves representing soil layer interfaces) onto ~40 “offset lines” running parallel to the structure to be built, each representing a cross-section where I need the geology. The “station 0” of the geological profile is taken as the reference point with respect to which the thickness of a soil layer is determined (ex. the thickness of the clayey layer is 5 m at 15 m from the station 0 → this thickness is to be transposed to the “offset lines”).

What I have is the following:

  • I have a mesh representing the topography of the site;
  • I have the set of lines parallel to the axis of the structure spread across the site;
  • And I have the reference geological profile.

The “workflow” in Grashopper for a single offset line is the following:

  • To draw the natural ground curve for the line by projecting its control points onto the topography mesh.

  • To determine the z-coordinate of each soil layer at the distances associated with the control points of the line. Ex. If the second control point of the line is at 5 meters with respect to its own “station 0” (its first control point), we go and take the z-coordinate of each soil layer at 5 meters from the “station 0” of the geological profile. In order to do this, I created multiple planes that I intersected with the geological curves. The resulting z-coordinate of the intersection is what allows to calculate the thickness of each soil layer.

  • Finally comes the intersection (PCX component in the image above) and there is where I think it gets tricky. When I set only one curve, the script works as expected. When I set multiple offsetlines, I don’t really understand what it is doing but it is not the right thing: it doesn’t apply the same instructions to each offset line (project onto mesh → calculate intersections with geological profile based on distances from the station 0, etc). While trying to solve this, I got into the notion of data tree and branches and I have tried to tweak the “graft” and “flatten” option of the inputs/outputs of each component but I can’t get to make the script work for multiple lines.

Could you please help me to solve the problem or point towards documentation on data trees? A simplified version of my Rhino file is attached to this topic, as well as the grasshopper script.

grasshopper_routine.gh (20.3 KB)

geometria_ayuda_forum.3dm (2.5 MB)

Thank you,

Juan Esteban.

Hops and/or Data Output and Data Input?

If I’ve understood correctly, you want something like this - I have Rhino 8 so including an image just in case it doesn’t open properly

I don’t know whether it’s more helpful to annotate it and leave you to work it out or if you want to do a quick call and I can explain it - up to you, have a look - happy to answer questions:

grasshopper_routine_1.ghx (728.4 KB)

grasshopper_routine_1.gh (33.2 KB)

edit: also, go to Display > Draw Full Names in Grasshopper - because when you were looking for the vector length, you already had it:

Hi, @Artstep , thank you for your answer!

This Grasshopper routine helped me accomplish what I had in mind. Also, by trying to understand it, I learnt a good deal about data tree structures, which I was completely oblivious to before, so thanks for that as well.

P.S. My apologies for the very late response. Life happened and I took some months off work.

I didn’t really get the time to get into these particular components for what I am trying to do but I will learn and test them in the near future. Thanks!