How to know that a face contains another face using Ruby API?

Hello everyone i have this 3D model on Sketchup, and i need to get the areas of diffrent faces using Ruby Sketchup API:
For example :
-for the first face on the left, i need to say that the face has a total area of 1.55 m² which is the area of the B face + the area of the A face, and say that this face has another face (A) in it and it’s area is 0.06 m².
And same for other faces (E and G).

How can i find that the face B contains the face A and not C or D ? because all face have the same material and have random x,y,z coordinates.

thank you in advance

Maybe Face.loop and Face.outer_loop to check if the small face outer loop is one of the larger face’s inner loop?

1 Like

I don’t know i’m still a beginner in Sketchup API developement can you be more specific ?

I can’t test anything at the moment, maybe someone will be kind enough to write something.

Also not where I can write code just now, but are some ideas:

If a Face, face_b, is inset in another Face, face_a, then the Loop returned by face_b.outer_loop will be geometrically the same as one of the Loops in the Array returned by face_a.loops. I say geometrically the same because Faces don’t share Loop objects, but their Loop objects will share Edges. The Loop class API doesn’t provide any comparison operation, so you have to roll your own. The ordering of Edges is independent in each Loop, but you can subtract the Arrays to see whether the result is empty, that is

test_array = face_a.loops[i].edges - face_b.outer_loop.edges

test_array will be empty if the Loops use the same edges, hence face_b is inset in face_a

1 Like

thank you so much for your reply i’ll try that