I have created a VB application that allows the user to select a cylindrical face of a hole, and then it automatically gathers a list of all cylindrical faces with the same radius, to allow specified face attributes to be defined which are then used in Feature Based Manufacturing to create holemaking processes. This application also changes the color of the cylindrical face.
Current Issue--I would like to also change the color of all the faces associated to the selected cylindrical face, for example, the bottom of the hole and/or a chamfer at the top of the hole, or the counterbores if they exist. I have not come up with a method that will allow me to gather together all these associated faces. I had a random thought that I could get the center vector of the cylinder and then cycle all the faces to find ones that share the vector, but thought it best to poll those in the know to see if there is an easier way to accomplish this.
The selected faces would be the yellow ones shown above. The ones I need to gather would be the red ones.
Back Story--I am using step models imported out of a foreign CAD system, so don't have the ease of using the OOTB features in NX. My main function is to be able to map what appears to be holes and pockets to NX as threaded holes and threaded pockets.
Side Issue--While my selection process is working okay, it does have the potential side affect that when cycling the faces for inclusion in the list, it can't tell the difference between a hole face or a corner fillet since I am currently using:
If face1.SolidFaceType = Face.FaceType.Cylindrical Then
to filter the candidates. Does anyone have suggestions how I could further filter out partial cylindrical faces, like fillets, when looking for candidates for my list?
Thanks for any help and suggestions!
Solved! Go to Solution.
You have to define clearly what you mean by an "associated" face. It sounds like you are looking for faces that are:
Given a face, you can find the adjacent faces by
To distinguish between holes and fillets, look at the number and types of loops. A hole will have two "winding" loops, and a fillet will have a single "peripheral" loop.
To distinguish between a hole and a cylindrical boss, you have to look at the normal sense or the curvature of the face.
The easiest way to do all this is by using the Snap.Topology functions. In fact, the documentation for Snap.NX.Face.Sense has an example that might be useful to you. Also, look at Snap.Topology.LoopType. Both of thse are in the Snap Reference Guide.
If you don't have access to SNAP, then you can use the NXOpen.UF.Ufbrep class. I'm not sure it has everything you'll need, but it's the best available in NX/Open.
Regarding the question about distinguishing between full and partial cylindrical faces, there is an Open C function called UF_MODL_ask_face_periodicity(), which is wrapped for use in .Net as UFModl.AskFacePeriodicity(), that should allow you to perform this query. You will need to look at the original function in the Open C Reference Guide to see the details on the possible return value.
I agree with Yamada's and Steve's answers. I'd just like to add that since the model is being imported from another system, you should run heal geometry and/or optimize face on the model before analyzing the model faces. Some systems split the cylindrical faces into 2 faces; heal or optimize will join them back into one face. Having a single cylindrical face to deal with will make the suggestions above easier to implement.
Thanks for the quick response and, I'm sorry, I thought the picture would illustrate what I desired. Yes, I want to gather all the faces that are adjacent to the selected cylinder and part of the hole feature. I would expect them to fit all three you indicated. In the case of counterbores, I expect there will also be some flat surfaces.
I looking at AskAdjacFaces (UF_MODL_ask_adjac_faces), thinking that I could keep cycling through the body faces and selecting adjacent faces that have no more than two edges. The only situation I can think that this would fail was if a hole was in a round boss, and the hole entry face would be selected along with all the hole faces. All things considered, it would look a little odd when I change the face colors, but would still be functional for FBM feature recognition.
The idea for loops sounds reasonable. Will try and find something in NXOpen that exposes this information. Another idea might be to look at edge types. All the faces in a hole feature should have circular edges, unless it is a through hole that breaks through a curved face or a face not perpendicular to the hole centerline, or the entry face is curved or not perpendicular to the hole centerline. In those cases I guess the edge would be a spline?
Good point about the surface normal. Had not been considering bosses versus holes before. I think I saw something regarding the sign of the normal that indicated convex or concave?
I would respectfully disagree regarding SNAP. Since it is an added cost module, it is not available to everyone. Will check into the documentation to see the methods and then look for the corresponding NXOpen functions.
Thanks for the suggestions, giving me more directions to pursue!
I was trying to use the periodicity, but in my sample part, the hole cylinders and a fillet with the same radius, all returned the same values?
You are correct, we discovered that annoying trait and found that "optimize" works well when importing to eliminate the split faces.
Now, on to try some coding....
"I was trying to use the periodicity, but in my sample part, the hole cylinders and a fillet with the same radius, all returned the same values?"
I would have expected a full (360 degree) cylindrical face to return UF_MODL_PERIODIC for either the U_status or the V_status. If you are getting UF_MODL_NON_PERIODIC, then I have to wonder if the face could have been split, as Cowski mentioned.
Naw, these were imported with optimize which makes the hole face continuous. The U_status was "1" on all of them and the V_status was "0".
This is my sample part with the fillet I'm using.
I wonder if "optimize" is just masking the fact that it is a split cylinder and periodicity is seeing through to the original faces?
"Naw, these were imported with optimize which makes the hole face continuous. The U_status was "1" on all of them and the V_status was "0"."
A U_status of 1 indicates that the face is periodic:
#define UF_MODL_PERIODIC 1 /* UF_MODL_ask_face_periodic */
#define UF_MODL_NON_PERIODIC 0 /* UF_MODL_ask_face_periodic */
Or did you mean that you are also getting a 1 on the fillets?