# How to extract the coplanar extraction of 2 groups of irregular cubes

Hello, everyone:

Excuse me，

The left figure is 2 groups of irregular cubes.

How to extract the coplanar extraction of 2 groups of irregular cubes through grasshopper

as shown in the right figure

cubes.3dm (52.5 KB)

Expecting a specific answer without posting a model isn’t realistic, though this guy got lucky with a similar question two years ago:

1 Like

I got this far and can eliminate the duplicate surfaces but still need to cull the smaller of each pair of coplanar surfaces… Geometry is internalized, no need for Rhino file.

cubes_2019Jul2a.gh (35.6 KB)

Have a look at the attachment.

Coplanar_Faces_Extraction_re.gh (23.6 KB)

Thank you very much, Joseph. That’s almost what I was looking for, except for one small problem.

Using the cull pattern to extract the coplanar surfaces seems to extract the redundant surface. How to solve this problem?

Thanks , KIM.

But how does your program find the coplanar surface of the same set of cubes?

Your question is somewhat not specific. I can’t help but tell you to analyze this definition step by step.

Another example of deliberately breaking R5 code with trivial differences in very basic components. What a pain! Given the clear image of the code, I can substitute the R5 version and see that this model doesn’t solve the problem.

Here is another flawed “solution” that yields better results but perhaps at the expense of generality?

cubes_2019Jul3a.gh (38.1 KB)

As a test, I moved faces on three of the breps and this code does a good job of identifying the interior faces in a solid union. What is needed though is to detect overlapping coplanar surfaces and an algorithm to deal with them. When two smaller surfaces are coplanar and overlap with a larger surface that “covers” both of them, which ones do you keep?

Thinks,Joseph!

If three sets of cubes of different types in a scene, represented by red (a) blue (b) green ©.

How can I get the coplanar surfaces of A and B to be white(x) and the coplanar surface of B and C to be yellow(y) and the coplanar surface of A and C to be black(z) ?

If the color match is fixed, can you use tables to drive them?

test.3dm (109.6 KB)T

I haven’t seen any Grasshopper code from you yet? The code I posted isn’t organized to handle multiple “sets” of cubes as you describe. And even then it fails.

For the problem you mentioned in the above example, I will keep the smaller coplanar surface.

HI,Joseph

If this code deals with multiple data,

It will be very helpful to me.

test.gh (20.7 KB)

Yo, the failure to resolve issues already mentioned cannot be ignored. And now I see one more problem…

This is nothing but a cosmetic merging of your test.gh and my cubes_2019Jul3a.gh (white group) with a switch (blue group) to choose either “A][B”, “B][C” or “A][C”. It shows a new issue caused by FMerge since “A][B” fails to find any result at all.

cubes_2019Jul4a.gh (68.7 KB)
(geometry is internalized, no need for Rhino file)

Look carefully at the following two images; the first has each set of breps wired to its respective Preview component:

The second connects the output of each FMerge to its respective Preview, showing the geometry actually being passed to the white group.

Notice that ‘Set A’ (red) and ‘Set B’ (blue) are touching with overlapped coplanar surfaces but neither one has a surface of that size, so the algorithm fails.