I have a faceA, a faceB, faceC, faceA contains faceB, I want to know how to have Ruby API to get faceA contains faceB. but not contain faceC
faceA.all_connected.grep(Sketchup::Face)
this can find faceB, but also faceC
This can be determined by comparing the loops that make up the face.
Face.outerloop
will return the loop that bounds a face (excluding any internal edges). Face.loop
returns all of a face's loops including inner and outer.
So, by getting a list of all connected faces (using the example code with all_connected
that you posted), you can iterate over those faces to determine if any of faceA's outerloop
is shared by the iterated face. If so, it is not an inset face, rather it is adjacent.
There is an alternative method posted here that might be a good way to go too: https://forums.sketchup.com/t/how-to-know-that-a-face-contains-another-face-using-ruby-api/21840/3
Note, in the linked post, they comment that you can't directly compare loops, but you can compare edges (which compose a loop).