Ask function for UF constant UF_UI_SEL_FEATURE_SOLID_BODY

Hi all,

I am new to NXJournaling. I have been editing few Journals and using them to measure volume.

I have a doubt in UF constant method which has been used in a code block.

In this block of code , i want to add additional filter to select only solid bodies(Non -sheet bodies). I have found out the UF constant for the same.

"UF_UI_SEL_FEATURE_SOLID_BODY" this UF constant will select only solid bodies.

Dim aBodyTag As Tag = Tag.Null
Do
theUFSession.Obj.CycleObjsInPart(thePart.Tag, _
UFConstants.UF_solid_type, aBodyTag)

If aBodyTag = Tag.Null Then
Exit Do
End If

Dim theType As Integer, theSubtype As Integer
theUFSession.Obj.AskTypeAndSubtype(aBodyTag, theType, theSubtype)

If theSubtype = UFConstants.UF_solid_body_subtype Then theBodies.Add(theSession.GetObjectManager.GetTaggedObject(aBodyTag))
End If

Loop While True

So the new code block will have the following codes.

Dim thesolidsubtype As Integer
theUFSession.***.*************(thesolidsubtype)
If thesolidsubtype = UFConstants.UF_UI_SEL_FEATURE_SOLID_BODY Then

I am not sure about the ask function (indicated in ****) for the solid body sub type.

Any help will be appreciated.

If you are working in a piece part, you can iterate through the body collection looking for the solid bodies. The journal below shows how to do that.

Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF

Module Module59
Sub Main()

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession
Dim workPart As Part = theSession.Parts.Work

Dim theSolidBodies As New List(Of Body)

For Each tempBody As Body In workPart.Bodies
If tempBody.IsSolidBody Then
theSolidBodies.Add(tempBody)
End If
Next

End Sub

End Module

If you want (or need) to use the .CycleObjsInPart method, you can get the body object from the tag and then use a similar strategy as the one above.

Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF

Module Module59
Sub Main()

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession
Dim workPart As Part = theSession.Parts.Work

Dim theSolidBodies As New List(Of Body)

Dim aBodyTag As Tag = Tag.Null
Do
theUfSession.Obj.CycleObjsInPart(workPart.Tag, UFConstants.UF_solid_type, aBodyTag)

If aBodyTag = Tag.Null Then
Exit Do
End If

Dim theType As Integer, theSubtype As Integer
theUFSession.Obj.AskTypeAndSubtype(aBodyTag, theType, theSubtype)

Dim theBody As Body = Utilities.NXObjectManager.Get(aBodyTag)
If theBody.IsSolidBody Then
theSolidBodies.Add(theBody)
End If

Loop While True

End Sub

End Module