Extend lines downwards until they hit geometry

Hello all,
I have been working on this project for my uni where my plan is to generate a volume of non-intersecting cubes with varying sizes, connecting these downwards to other cubes and a grounded surface.
How I want it to look basically

I got the generation of cubes down quickly, however the vertical connections are giving me a headache. I basically want from vertical extensions from each of the lower vertices of the cubes going downwards until they hit another cube or end up getting to the bottom surfaces. I have tried a few things however my attempts with using brep/curve, curve/surface, and surface/line intersections don’t get me what I need. One idea I had which hasn’t worked out yet was to
One of my more confident attempts included cutting holes into the lower surface so that lines passing through cubes wouldn’t intersect with the lower surface however this is a faulty solution.
Cube_generation.gh (21.6 KB)

I’d appreciated any help or advice :slight_smile:

You can create the lines like this:

  1. using the dot product, find all surfaces with normals facing -z
  2. cull the duplicate point of the control polygon
  3. for every box, create a list containing all other boxes
  4. a surface below all boxes is added to these twenty lists
  5. the 4 corners of each downwards facing surface are projected downwards
  6. for each point you get only the first point of ‘collision’

Cube_generation_project_points_downwards.gh (30.2 KB)

To create the data sets I often first use the paths or a series of integers instead of an undistiguishable list of geometries so I see the right items are in each list… Something like this here:

The first list does not contain the first item. The second list does not contain the second item and so on. There may be a more direct way to do this…

There’s a very old post about cross reference on the old Grasshopper forum:

Cross Reference; what is it, how does it work, why would I need it? - Grasshopper (grasshopper3d.com)

3 Likes