Extract information from imported geometry using NX Open | Working with Solids | Using UFUNC AskFaceData / AskPointContainment / AskFaceUvMinmax

NX Open is a powerful tool for working with imported geometries in NX.
One common task that engineers and designers may need to perform is to
extract information about holes or bosses in imported parts. This
information can then be used for manufacturing or assembly planning. In
this blog post, we will explore the steps required to extract this
information using NX Open.

Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF

Module NXJournal
Sub Main(ByVal args() As String)

Dim theUI As UI = UI.GetUI()
Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim theUFSession As NXOpen.UF.UFSession = NXOpen.UF.UFSession.GetUFSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work
Dim displayPart As NXOpen.Part = theSession.Parts.Display

Dim lw As nxopen.listingwindow = theSession.ListingWindow

lw.open()

Dim curves As New list(Of curve)

Dim faceList As System.Collections.Generic.List(Of Face)

faceList = New System.Collections.Generic.List(Of Face)

For Each thebody As body In workpart.bodies()

For Each theface As Face In theBody.GetFaces()

If theface.SolidFaceType = Face.FaceType.Cylindrical Then

Dim type As Integer = Nothing

Dim axispoint(2) As Double

Dim axisDir(2) As Double

Dim faceBox(5) As Double

Dim radius As Double = Nothing

Dim radiusdata As Double = Nothing

Dim normdirection As Integer = Nothing

theUFSession.Modl.AskFaceData(theface.Tag, type, axispoint, axisDir, faceBox, radius, radiusdata, normdirection)

Dim pointstatus As Integer = Nothing

theUFSession.Modl.AskPointContainment(axispoint, theBody.Tag, pointstatus)

Dim chk(3) As Double

theUFSession.Modl.AskFaceUvMinmax(theface.Tag, chk)

If pointstatus = 2 And (chk(0) = 0.0) And (chk(1) = Math.PI * 2) Then

faceList.Add(theface)

lw.writeline("Name: " & theface.name & " Radius: " & radius)

End If

End If

Next

Next

End Sub

Public Function GetUnloadOption(ByVal dummy As String) As Integer

'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
'-------------------------------

End Function
End Module
How to extract information like hole or boss from imported geometry in NX using NX Open

NX Open APIs used:

  1. AskFaceData –
    Queries the data associated with a face. The data output depends on the type of face receiving the query. The data can include the object type of the face, center point, axis direction, etc.
  2. AskPointContainment –
    Determines if a given point lies inside, outside or on the boundary of a given face, edge, solid or sheet body. In the case of a sheet body, a point is considered inside the body if it is on the face and on the body if it is on the boundary edges of the sheet body
  3. AskFaceUvMinmax –
    Computes the u,v parameter space min, max of a face.

In conclusion, using NX Open to extract information about holes and bosses in imported parts is a straightforward and efficient process. With these steps, engineers and designers can quickly and easily gather the information they need to make informed decisions about manufacturing and assembly.

Social Connect

Learn CAD Automation using NX Open & Automate Design Tasks in Less Than 90 Days Without Any Prior Knowledge.

Attend the NX Open Masterclass to Discover

This journal get’s the name material used in part. Imports SystemImports NXOpenModule NXJournalSub Main (ByVal args() As String)Dim theSession As NXOpen.Session = …

This journal get’s the name material used in part. Imports SystemImports NXOpenModule NXJournalSub Main (ByVal args() As String)Dim theSession As NXOpen.Session = …

Datum Planes are a planar reference feature to help define other features, such as swept bodies and features at angles to the …

The use of computer-aided design (CAD) software has become an essential tool in engineering and manufacturing. There is no industry today that …

An attribute is a persistant way to store non-geometric data (i.e. not a point or curve or solid or feature). Attributes can …

An attribute is a persistant way to store non-geometric data (i.e. not a point or curve or solid or feature). Attributes can …

Design Engineers always spend more time on drawings for several reasons. A few of them are; Drawings are prime source of information …

It is quite possible to create a blank part and drawing sheet with one click of a button. Yes, you are right, …

NX Open is a powerful tool for automating NX CAD tasks. Below is source code that creates a new blank prt file …

As engineers and designers, we often have to work with complex 3D models and drawings, and extracting important information from these can …

NX Open is a powerful tool for working with imported geometries in NX.One common task that engineers and designers may need to …

https://youtu.be/5NWHlSM0sQ0 Q:Can you teach me nx open using visual basic .net? ChatGPT: Yes, I can help you get started with using Visual …

Leave a Comment

Your email address will not be published. Required fields are marked *