Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Identify mating faces using NXOpen API ? 1

Status
Not open for further replies.

biw01

Automotive
Dec 31, 2011
152
0
0
US
Hello Everyone,

I have some applications which require identification of mating faces between 2 components in an assembly. There are no assembly constraints used for the assembly. These 2 components are simple touching. I wanted to know if someone in the group is aware of some NX API that can determine mating faces quickly.
We are currently employing a strategy, where-in we loop through all the solid bodies and get its faces. Then we compare each face in one component with the other component, measure the distance, compare the face normals and then determine mating.
I also wanted to check if we can employ some form of NX based rules to do this task.

Please let me know if someone has a better approach to my problem.

Cheers,
Amitabh
 
Replies continue below

Recommended for you

Hello Amitabh,

Consider adding filtering along your loops, here are some ideas, i'm not sure they are valid for your case:
1. Iterate only Solid bodies
2. Iterate only Planar faces

just in-case your application is a dll attached to NX session consider replacing it with exe, you'll get better performance.
 
Thank you for your suggestion, Tomerl. I forgot to mention that I am already doing both of them in the code to reduce the number of iterations and checks. I am using the following properties .IsSolidBody and .SolidFaceType to achieve this. Any other piece of advice that you would like to give ?

Thank You,
Amitabh
 
I'd start by using one of the .AskMinimumDist methods on the solid bodies. If the distance is greater than your "mating tolerance" distance, then the 2 bodies have no faces that mate - you can skip the expensive checks and move on to the next pair of solid bodies. If the distance is within your "mating tolerance", the points returned from the function will give you a good idea of which faces mate.

www.nxjournaling.com
 
Thank you for your suggestion, Cowski. I understand the solid bodies based distance validation. How can I use the points returned by the function to get an idea of which faces mate? Is there some NX API that provides a nearby face to a point ?

Thank You,
Amitabh
 
biw01 said:
Is there some NX API that provides a nearby face to a point?

I've never used it, but the .TraceARay method might work for this. The .AskMinimumDist method returns 2 points, you could use these 2 points to calculate a vector and use the vector in the .TraceARay method; it should return the faces that are hit. Alternatively, you could iterate through the faces on the body and use the .AskPointContainment function to see which face contains the point.

www.nxjournaling.com
 
Thank you, cowski. I bow to you. The TraceARay method is very quick and with some additional validations, I am able to quickly find out a mating face between 2 bodies. I am currently testing this method in different scenarios and I might need your guidance if I encounter some issue.

Thank You,
Amitabh
 
Status
Not open for further replies.
Back
Top