I'm having trouble extracting the numerical data of surfaces.
More specifically, has surface types plane, cylinder, cone, sphere, torus, swept, blending, parametric, offset, and foreign. A call to UF_MODL_ask_face_data returns a type, and if this surface is a plane, cylinder, cone, sphere, or torus, then this same function returns the numerical information to determine the surface. In the other cases, however, it does not.
How to extract the surface data for the remaining surface types? My idea is to try to coerce them into B-surfaces, but a call to UF_MODL_extract_face (with mode=2) appears to create a new B-surface (and possibly add a second Body) and modify the user part. The documentation does not list a way to delete this extra surface when I am done with it, or any other way to coerce into B-surfaces. Any help here?
Also, I've noticed a case where I draw a spline curve and revolve it around an axis to get a surface, and this surface is reported as a "torus" rather than a parametric (B-surface). Is there a more reliable function than UF_MODL_ask_face_data for reporting surface type to begin with?
Solved! Go to Solution.
What version of NX and what language are you using (C++, perhaps)?
Another function to look at is UF_MODL_ask_face_props (or browse through the UF_MODL_ask_face* functions to find something that interests you).
The UF_MODL_extract_face function will return the tag of the newly created face. When you are done with it you can delete it with UF_OBJ_delete_object or UF_OBJ_delete_array_of_objects. Alternatively, you could create an undo mark before creating the new face, extract the info as needed, and roll back to the undo mark. This has the advantage that the part won't be marked as modified (if that is important for your application).
If you have access to the SNAP API, it's very easy. Each face has a "Geom" object that gives you all the geometric properties you'd expect. The code below shows how to do this with a b-surface. See geom.Poles, geom.Weights, etc. It's written in VB, but translation into C# should be easy.
If you don't have SNAP, then you have to use the NXOpen.UF.UFModl.AskBsurf function.
If you revolved a spline and got a torus, it must be because the spline was circular in shape. Parasolid is quite aggressive about replacing b-surface geometry by simpler stuff, where possible. And even if you revolve a complicated (no-circular) spline, you won't get a b-surface, you'll get a "revolved" surface.
The code example:
CopyImports Snap, Snap.Create Public Class MyProgram Public Shared Sub Main() Dim thruPoints As Position(,) = blah, blah, blah, ... ' Create Bezier patch through points Dim bsurface As NX.Bsurface = BezierPatchThroughPoints(thruPoints) ' Get face geometry Dim faceBsurface As NX.Face.Bsurface = bsurface.Face Dim geom As Geom.Surface.Bsurface = faceBsurface.Geometry ' Write out the geometry properties of the face InfoWindow.WriteLine("The poles of the b-surface are ") InfoWindow.WriteLine(geom.Poles) InfoWindow.WriteLine("The weights of the b-surface are ") InfoWindow.WriteLine(geom.Weights) InfoWindow.WriteLine("The knotsU of the b-surface are ") InfoWindow.WriteLine(geom.KnotsU) InfoWindow.WriteLine("The knotsV of the b-surface are ") InfoWindow.WriteLine(geom.KnotsV) InfoWindow.WriteLine("The degreeU of the b-surface is " & geom.DegreeU) InfoWindow.WriteLine("The degreeV of the b-surface is " & geom.DegreeV) End Sub End Class