Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module Module1
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim theUI As UI = UI.GetUI()
Dim lw As ListingWindow = theSession.ListingWindow
Sub Main()
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "find flat solid")
lw.Open()
Dim myFlatSolid As Body = Nothing
For Each tempBody As Body In theSession.Parts.Work.Bodies
Dim parentFeats() As Features.Feature = tempBody.GetFeatures
For Each tempFeat As Features.Feature In parentFeats
If TypeOf (tempFeat) Is Features.FlatSolid Then
myFlatSolid = tempBody
End If
Next
lw.WriteLine("")
Next
lw.WriteLine("flat solid body tag: " & myFlatSolid.Tag.ToString)
lw.Close()
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