Selecting the closest face

Hello,

I'm experiencing issues selecting the closest face for a trim operation. Here is an example of a trim operation that I'm trying to accomplish.

http://imgur.com/2NGfSGt

The surface indicated by the green arrow is the surface I'd like the trim to return. The trim operation requires the selection of a region, interactively, this is done via hovering over the region you would like to keep. Programmatically this is done by setting the region using a Point object.

The screenshot link attached shows my current situation, I have a reference to the highlighted curves and would like to get a point that exists within the region marked with the green check-mark. My first thought would be to take the brown face, and use this function, UF_MODL_ask_face_parm, passing in a reference point as the average point of the selected edges start and end points.

This, however, did not work. Instead of returning a point that existed on the brown face, the point it returned lived on the green face indicated with the red X. I have come to the conclusion that it may be due to this note included in the API.

"Note that the returned point will be on the underlying surface but may not be on the portion which is bounded by the edges of the face. "

So, here is the question / problem, given the green face and selected (highlighted) edges, how can I return a point3d or point that lives within the region designated by the green check-mark?

Thanks,
Jgolen

You can use the function UF_MODL_ask_face_uv_minmax to find the minimum and maximum U-V values for the trimmed surface. I'd suggest using this function in conjunction with UF_MODL_ask_face_props. The "ask face props" function will take the UV parameter as input and return a point as one of the outputs. You could use the "ask face uv minmax" function to get valid UV parameters and pass them in to the "ask face props" function.

The function, UF_MODL_evaluate_face, is similar to UF_MODL_ask_face_props in that it will output a point on a given face given the face tag and a UV value.

The function, UF_MODL_ask_point_containment, might also come in handy to verify that the returned point lies on the face.

Thank you! By taking the output of the UF_MODL_ask_face_uv_minmax function and incrementing or decrementing the values returned from the UF_MODL_ask_face_parm and then passing in the validated parameter values into the UF_MODL_ask_face_props I was able to get a point that lived on the surface I wanted!

While this isn't the cleanest solution it's helping me at least take a step forward. Thanks.

Jgolen

NX 8.5
NX 9.0

Incrementing / Decrementing the UVParameter values would return a point that exists on the surface but not in a manner that I would expect, this is definitely not the best solution.

Upon further investigation I found a command: UF_EVALSF_ask_minimum_face_dist which will return a point on the face that is, apparently (haven't tested it yet), guaranteed to be within the bounds of the face edges.

NX 8.5
NX 9.0