Select tangent faces of a Brep?

I’m trying to figure out a better way to select subsets of Brep faces based on their continuity, and in particular, tangent faces.

David helped me out with a C# component that I had to put in a loop and hook-up to some Topology analysis Voodoo, but heck, it’s messy and takes too long to process !

I’d be surprised if there wasn’t a component in a plugin out there somewhere that would do this fast and easy, just like you would use SelChain command from within Join, and then set ChainContinuity to Tangent.

Does this involve any two faces which share their normals along the edge, or just planar faces?

How do you want to ‘select’ them?

Hi David, , If you remember, I managed to make a tree with, for each face of a BREP, the list of faces which are tangentially connected to it, and with your help, I got lists of tangent “chains” of faces.
It required using a C# component and a loop…

Maybe this could be a useful extra output for the “Topology” component.
This is particularly relevant for bent metal parts where it is useful to get the “Intrado” or “Extrado” skin to flatten it.

Hello,

I believe this might be useful for myself, so I made script solving this. I haven’t tested it much, but in the example it seems to work:

Please also note that there is no perfect g1 or g2 matching in reality.


CheckForTangent.gh (15.1 KB)

2 Likes

Hi TomTom,

Excellent !
Thank you so much.

Is it possible to edit that script so that it outputs a structured tree when there are multiple Breps as input ?
Multiple solids.gh (699.0 KB)

sure:

CheckForTangent2.gh (19.7 KB)

maybe these paths are more natural:

CheckForTangent3.gh (20.1 KB)

Hmm… it doesn’t seem to work with my data set.
Something is wrong.gh (694.4 KB)

By using “Brep Join” on the output, I should get a single Brep in each branch, right ?

"I should get a single Brep in each branch, right " not necessary. well, doesn’t work then. :slightly_frowning_face:

Well, if each branch represents a set of tangent surfaces, they should become a single Brep after “Join”.

as I said, haven‘t tested it fully. I spend less then 60 minutes which is a lot for free help in a forum. I believe its more about the idea rather then providing full functionality. Basically you can use this script and devellop it further.I fully commented so even if you dont understand c# you will get the idea from my notes. I also would like to help you further, but I do have a full time job so I cant simply spend 60 hours to it, which is a realistic timeframe for a well engineered functionality like this.:wink::slightly_smiling_face:

1 Like

Hi TomTom,

Thanks for your efforts ! Editing C# is out of my league, but at least I know what I’m missing.
That a small script could replace such a messy and convoluted part of my definition is an indication that I should look into scripting indeed !

For now, I guess I’ll have to make do with this.

Hi TomTom,
I think that the issue comes from the fact that you put in the same branch faces which are not tangentially connected to any other.
If they were dispatched in separate branches, this script would be a little jewel :slight_smile:

i’ll have a look later on, not sure if I can solve it though

I’m looking into graph theory to solve this problem.
Here is a tree (for Brep N°38) giving, for each face which has tangent neighbours, the list of those neighbours (including itself).
For example, list {38;13} says that face 13 is tangent to face 20 and 18.
If you plot a graph of all the faces (13, and 17 to 25), the two “chains” of tangentially connected faces appear as graph paths of a disjoint graph.

I was wondering if there was a graph plugin for GH, or how I could turn this in to an adjacency matrix and extract the two paths from there.

OK folks, I worked out my own solution to this problem.
Using the “BREP topology”, and a but of comparing normals, it is easy to get a tree with, for each face of the BREP, the list of neighboring faces which are tangentially connected.
But then, to get concatenated lists, or “chains” of faces, and despite all the tools in the “Sets” tab,

Sets

there didn’t seem to be an easy way to do that.
So, inspired by graph theory, I mapped the faces and the “tangency” condition as a set of nodes connected by links.
Then I got rid of the duplicate lines, made polylines, and reverse-engineered my way back to the face lists.
I guess that this could be useful in other circumstances.

GEOMETRIC SOLUTION TO LIST CONCATENATION.gh (102.1 KB)

And this is what the graphs look for other BREPS :

1 Like

Good work @osuire ,

in case you still need my one:

FindTangentFaces_Update.gh (2.0 MB)

3 Likes

TomTom,

Your component works flawlessly, and replaces a convoluted part of my definition quite elegantly and efficiently !

Thank you so much for this !