I am hoping someone will be able to help me.
I have a faceted body with about 1.5 million facets on it. I trying to write a program that automatically creates surfaces on it using the RapidSurface feature.
In the RapidSurfaceBuilder you have to define the points using the sub routine
SetDefiningPoint(index as integer, coordination as NXOpen.Point3d, facetID as Integer)
Does anyone know how I can find the facetID of the facet at a certain XYZ position on the faceted body. I guess you could cycle through each facet and see if the point is on the facte but with 1.5 million facets this would take a very long time.
Thanks for any pontenial help.
PS I am running NX10.0.0.24 and programming in VB.Net
I can't think of any way to do this. If you cycle through 1.5M facets once, it probably won't take very long. But if you're going to do this repeatedly, performance will be a problem, so you should build some sort of index or dictionary that lets you get from coordinates to facet IDs quickly.
The Delaunay method and the convex hull methods from the scipy.spatial library would be useful for this but I have not been able to integrate them successfully with the NX Open API. http://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.Delaunay.html
Here is a starting point just to get the facet id for each facet.
num_facets=uf_facet.AskNFacetsInModel(facet_tag) for i in range(0, num_facets): #arguments are model id for facet_tag and facet id for i facet_id=uf_facet.AskFaceIdOfFacet(facet_tag, i) #returns 3 vertices for each triangle/facet
# can access each vertex via "vertex_tuple[facet id][0/1/2][0/1/2] vertex_tuple=uf_facet.AskVerticesOfFacet(facet_tag,i)
You could try creating a numpy array and use some type of sorting and/or iteration
points_array = np.array([row for row in vertex_list])