How to re-assemble lists after dispatch? plus: Closest Planar Caps for Non-Planar Holes

In this epic thread, I found @RIL’s C# script for finding minimum oriented bounding boxes. I used it to create a definition that finds the closest planar cap inside a non-planar hole.

Definition: Closest Planar Cap for Non-Planar Hole + Min BB Lowest (2.7 MB)

(green = non-planar, red = planar)

My definition will work with a list of curves and a single plane as input or with matching lists of curves and planes as input.

In order to speed it up, I dispatch planar and non-planar curve input and process them separately, because the planar ones obviously don’t need to be planarized.

Also, the C# bounding box script outputs planes, not boxes, when fed planar input, and feeding planes, into a volume component in my sorting group made it slow to a crawl - 26 seconds for 3 boxes and 14 planes!

Because of the dispatch, my output is two pairs of lists that I can’t figure out how to reliably recombine into the same order as the two input lists. Is there a way to do that? Could I insert nulls into both dispatched lists to keep them in order? Something else? How do I do it?

The Weave component helps with that

1 Like

Thanks. I’ll check it out. Also it looks like Heteroptera’s center component doesn’t have the issue that volume has with lagging when fed a combination of breps and planes

In situations where you will have to bring “dispatched” things back together, you should “sift” instead of dispatch; this component is designed to be used in tandem with “combine.” When used with a list of booleans like you would do with dispatch, Sift replaces the items corresponding to false with “null” instead of removing them altogether. Combine handles bringing the lists back together.
As for the speed of “Volume,” it is not designed to handle planes so it is internally converting each one to a surface before trying to calculate the volume. If all you need is a center, use “Evaluate Box” set to 0.5,0.5,0.5 for a good, all-purpose fast center that handles just about any geometry type.

1 Like

Thanks, that solves everything, with native components except for the c# bounding box script.

1 Like