Cancel
Showing results for
Did you mean:

# Finding interior and outer faces

Solution Partner Pioneer

I have a following body. The red face is an interior face, because it is surrounded by some sort of walls. The green face is an outer face, because it is not surrounded. How to find (programmatically) faces which are interior like the red face?

4 REPLIES

# Re: Finding interior and outer faces

Gears Esteemed Contributor

Below is a link to a somewhat related thread with code that you may find useful.

https://community.plm.automation.siemens.com/t5/NX-Programming-Customization/Collect-Associated-Face...

# Re: Finding interior and outer faces

Siemens Phenom

The key point is that the edges of the red face are concave, and the edges of the green face are convex (when viewed from outside the object). So, you need to cyle through the edges of the face, checking that all of its edges are concave. Like this:

```bool inside = true;

foreach (NX.Edge edge in myFace.GetEdges)
{
if (edge.Convexity(tol) != Snap.NX.EdgeConvexity.Concave) inside = false;
}```

The code is in C#, and uses SNAP functions. I think you could do basically the same thing using NX/Open, but I can't find the function to get edge convexity, right now..

# Re: Finding interior and outer faces

Solution Partner Pioneer
Thank you Yamada. But I cant find the same function in NXOpen Python API. I guess this function some sort of a function for facet body of face.

# Re: Finding interior and outer faces

Siemens Phenom

I looked again, and I couldn't find any relevant function in NX/Open, either.

There is a function for checking whether an edge between two facets is convex, but this won't help you, I don't think.

One idea is to write your own function. Construct a small disk-shaped solid normal to the edge, and intersect this with your base body. Looking at the volume of this intersection will tell you whether the edge is concave or convex. This algorithm isn't fool-proof, but it will work most of the time, I think.

Another option: get a SNAP license and then (if you insist on writing in Python), figure out how to call a .NET function from Python.