Best way to detect Box faces that are facing outside? Is it possible to detect line of sight?

Hello everyone.

I have created this set of boxes using this tutorial, It’s very computationally intensive because it’s creating a three dimensional grid of boxes ( 38,000 boxes in total ) which is bringing my computer down to it’s knees. I want to use something like Weaverbird’s Picture Frames to add detail to the model but I first need to cull boxes that are inside the façade, then I need cull every box face except for the façade.

I would appreciate any help, thanks in advance.

It seems pretty similar to what you’re trying to do.

Hey @HS_Kim, thanks for the response.

I checked the link you provided and I think I’ve failed to get my point across. I already have the exact overall form I want, but it only consists of boxes! And the volume is full of them ( they are not only on the outside). I need to first cull the boxes that are on the inside, Then deconstruct the remaining boxes and only keep the faces that are making up the façade.

I’ve uploaded the definition so you can check it out for yourself. It’s very computationally intensive and takes about 20 sec on my machine to open up. Thanks in advance. (32.9 KB)


The model produces geometry anyway so I tried Solid Union on the list of boxes but that failed. Had it succeeded, you would be left with only the outside surface fragments as a polysurface shell, with all inner surfaces gone.

Sometimes an iterative use of Solid Union works when a large list fails, a loop that joins one layer of boxes at a time when sorted (and branched) by Z.

This is a typical way of removing duplicate faces. Check the white group. I used mesh for faster calculations.
If you want a Brep(Polysurface)result, then, you can easily bake and convert the final mesh to brep in Rhino if you want… (29.2 KB)


Thank you for your answer, No matter how I tried, the Solid Union component returned with empty geometry.

Thank you so much! This is exactly what I was looking for and it absolutely works.

I came up with a way to accomplish the Solid Union that doesn’t require looping. The ~32K boxes are sorted, then branched, by the rounded Z value of their centroids before being joined by branch list.

Ran into a problem on one layer/branch though, {0;0;0;40}, that breaks the joined volume in two pieces.

Not sure yet why? Might be related to the single box (bottom center) connected by only an edge, no faces?

1 Like

Can you upload the modified definition?

I went to considerable effort (yellow group) to remove that specific box, connected only by an edge, and the problem of SUnion by “floor” went away. Way too much trouble for a general solution.

Somehow though, I’m ending up with an “Open Brep” when I expect a “Closed Brep”. Still, the “shell” surface looks good, eh?

Compute time is quite long (~18 minutes) so SUnion is disabled in the GH file but a copy of the shell is included for inspection, the SHELL (internalized surface): (515.4 KB)

1 Like

Thank you for your effort. I’m going to go over your definition and see what I can learn because this is much more advanced than my Grasshopper knowledge at this point. But I think an 18 minute computation time doesn’t seem right for the geometry this definition is trying to reproduce which makes me think the whole approach ( generating a three dimensional grid of boxes ) is not the most optimized and performant one.

I’ve been able to trim the total time down to ~13 minutes (from ~26 minutes) and avoid SUnion errors without “repairs” required to ignore specific boxes connected only along one edge (as before).

I scaled all boxes up slightly (by 1.001) to ensure overlaps and repeatedly partitioned branches (“floors”) to improve SUnion. (59.6 KB)

SUnion, FMerge
8.3m (498s), 32.6s
3m (180s), 9.2s
32.8s, 2.1s
3.9s, 0.34s
714.7s, 44.24s
TOTAL: 759s / 60 = 12.65m

This image below shows SUnion applied to unpartitioned branches - ~23+3 = 26 minutes to get “floors”.

I didn’t dig into how you created this list of boxes but for performance reasons, there might be value in considering and generating whole floor sections, since reorganizing and joining boxes on each floor takes so much time.

1 Like

Once again thank you for your efforts. I’m looking into creating a three dimensional grid of points and using the spiral curve to cull points instead of boxes. Then use those edge points to generate the facades and floors, it should theoretically be much much faster.