Collecting projected points on the parts nearest surface (with z-direction)

Hi everyone,

I am quite new at NXOpen. I have some questions to achieve my task.

Lets think there are some points on xy plane.

Example: (0, 0, 0), (0, 10, 0), (10, 10, 0)

I want to collect in z-direction projected points coordinates on the parts nearest surface. As you can imagine results x and y coordinates of points must be the same.

Result could be: (0, 0, 20), (0, 10, 15), (10, 10, 20)

Based on my research I should use origin point, z-unit vector, direction and scalar to achieve my goal. But how?

After collecting projected point. I need to collect surface angle with x-y plane at this point.

In my solution to this task is porbably getting face normal at this point and calculate angle with -z-direction unit vector.

Can you help to discover required functions or methods in NXOpen please?

Do you know which surface will be hit by the projected point before performing the operation?

If yes:
I'd suggest using the "project curve" command and projecting the point(s) to the surface along the Z vector. Using this point, the AskFaceParm method, and the AskFaceProps method, you can get the face normal at the location of the projected point.

If no:
If you have a body that you want to project the points to, but don't know which face it will hit (if any), I'd suggest using the TraceARay function. It will return the tag of the face that was hit and the normal of the face at that point.

There are probably other ways to get the info that you want, but these are the first 2 that I'd try.

First of all, thank you for your answer.
I interested “if no” option actually. But I managed to get all faces from part by “For Each theBody As Body In workPart.Bodies” structure. And then I played around with AskFaceParm and AsFaceProps method. It certainly working for getting z point and face normal of surface. But there is a problem about this method. For example, there is a sphere on center point (0, 0, 100) and 100 mm diameter.
For origin point (0, 0, 0) returns (0, 0, 50) as expected.
For origin point (300, 0, 0) I expect to return null. But it returns (47.4341649025258, 0, 84.1886116991581).
And also, I create grid to scan and create points all over the face with AskFaceUvMinmax “(u,v max-u,v min)/grid_count”. But same problem occurs when surface contains thinner form at somewhere in it. Points float in space and don’t have contact with surface.
I am very interested with TraceARay function and I assume this is the one that I require. I looked around to find some example but there was none. I tried to use it referring to nxopen reference document. But I am not qualified enough to understand it. Probably I am getting trouble with dimensioning parameters.

The AskFaceParm will return a parameter on the specified face given a reference point. The reference point doesn't necessarily need to be on the face; I'm not sure how it maps this reference point back to the face. I like to project the point to the face and use the projected point (that lies on the surface) in conjunction with the AskFaceParm function. This way, the point will match what is returned by the AskFaceParm function.

Regardless, if you have access to GTAC, you can find an example of the TraceARay function here (C# code):
http://solutions.industrysoftware.automation.siemens.com/view.php?si=nx_...