cancel
Showing results for 
Search instead for 
Did you mean: 

Get points on surface

Solution Partner Pioneer Solution Partner Pioneer
Solution Partner Pioneer

I try to find points which is located on surfase. I use AskFaceUvMinmax and AskFaceProps functions that find U, V points. But some of them doesnt lie on the green face.

 

I tried to use AskPointsContainment but I was failed.

 

Please, help me to find a solution.

 

Screen Shot 2016-06-24 at 8.10.12 PM.png

5 REPLIES

Re: Get points on surface

Honored Contributor
Honored Contributor

"I tried to use AskPointsContainment but I was failed."

 

What do you mean by 'failed'? Did you get an error message? If so, what did it say?

Re: Get points on surface

Genius
Genius

Hello AntonAus!

 

Perhaps you are dealing with a so-called 'trimmed surface'.

Try to imagine a surface like a function from R^2 -> R^3, so e.g. F(u,v) = (x,y,z).

 

When using the method AskFaceUvMinmax you are asking NX to give you

the domain of F. Often (especially for non-periodic surfaces) the domain

is [0,1] x [0,1]. That means, that your domain is rectangular.

 

To deal with a non-rectangular image (e.g. a circle in your example) NX has

to cut the domain (internally):

 

example.png 

In this figure, I marked to (u,v)-values.

 

If you are asking NX to give you the point (1,1), it will give you the point in the upper right corner which is not on the visible object, but defined for the function F(u,v).

 

Unfortunately I don't know a simple solution but a (very dirty) work-around:

 

You can ask the uv-MinMax values and make a sampling, say a 10x10 grid (0,0),(0,0.1),(0.1,0.1),etc.

 

Then you can use AskFaceProps to get the image-Point in 3D-Space.

 

To check if this point is ON the visible surface you can use:

 

Point3d myPointIn3DSpace = (0,0,0);
NXOpen.Point myBufferPoint = workPart.Points.CreatePoint(myPointIn3DSpace);
curUfSession.Modl.AskMinimumDist(curFace.Tag, myBufferPoint.Tag, ...);

 

Here NX is computing the minimal distance of two objects (your 3D point and the visible surface). If you get a value >0 it is outside your trimmed area, otherwise it's inside.

 

Attention: This workflow will NOT give you an uniformly distributed sampling on the surface, this is difficult in general! :-D I guess NX is using some Newton-Method to compute the distance, so if you are using that method with let's say 10000 points, it will be a lot of non-linear work to do for NX...

 

If your surfaces are planar (e.g. in the xy-plane) you could extract the edges (ExtractGeometry) to

create other methods to get a sampling on the surface.

 

Hope that helps!

 

Bye,

 

flo

Re: Get points on surface

Solution Partner Pioneer Solution Partner Pioneer
Solution Partner Pioneer
Hello FlolScreen!

Many thanks for your answer. I already knew (found out when trying create solution) about u and v. But I thought that there is some function that can help me. Measuring closest distance may be helpful.. Of course it will cost much time Smiley Happy

As described in docs https://docs.plm.automation.siemens.com/data_services/resources/nx/10/nx_api/en_US/custom/nxopen_pyt...

"""
Overview
Determines if a set of 2D points lie inside, outside or on the boundary (vertex/edge)
of a face.

If this function will be called multiple times for the same face then performance can
be improved by using UF_MODL_set_containment and UF_MODL_unset_containment.
"""

this function can return statuses of points that lie on the surface or I understood it incorrect?

But I couldn't use it, I don't know how.

Re: Get points on surface

Solution Partner Pioneer Solution Partner Pioneer
Solution Partner Pioneer

I found the solution:

 

https://docs.plm.automation.siemens.com/data_services/resources/nx/10/nx_api/en_US/custom/nxopen_pyt...

 

If status == 1 - the point inside the surface.

Re: Get points on surface

Siemens Phenom Siemens Phenom
Siemens Phenom

If you have access to the SNAP API, it's every easy. Given a face myFace and a (u,v) pair, you write (in C#, in this example):

 

bool inside = myFace.ContainsPoint(u,v);

 

This will return "true" if the point corresponding to the given (u,v) parameters is inside the face. 

山田
yamada