Region Difference not working as hoped

Test.3dm (166.8 KB) (22.7 KB)
Hi All,

I’m working on my first GH model, and I’ve hit a snag. I’m trying to subtract an array of regions from another region, and what I end up with is the difference between the two PLUS the first one as a separate region.

Here’s where I believe the problem is. I’ve tried both of the dashed red connections and they work the way I expect, but the connection between RDiff and the Boudary does ends up as shown in the image above - not what I expected.

Any suggestions?

Warning: Data Tree Ahead!

Learn it from the creator.


Ok… That does the trick, but could you explain why?

When you have data trees as inputs the data trees have paths (branches) and operations usually work against matching branches. So for instance if you have spheres in branch 0 and cones in branch 1 and cubes in branch 3, the node you plug in to would be operating on each of those geometries independently as they are each in a separate list/container. If you flattened the data tree the node would have cones, spheres, and cubes all together to work on at the same time.

A data tree is a list of nested lists.

Data trees are really powerful though because you can do very complex tasks in an organized and computational efficient way by having good data organization.

Short Answer:
Because you had one input as a grafted input and another flattened, the region node was comparing the flattened data against each individual grouping of data aka branch in the grafted data tree. By flattening both inputs you are letting the region node consider all the data at once instead of comparing each group of data against the main flattened data group.