Feature Group vs Brep

Hi,

I have bodies grouped together in a part. I want to generate a excel report with each group mass properties. While compile I got error saying feature group cannot be cast into Brep, If I use Brep it is selecting all the individual bodies inside group not considering the group.

Option Strict Off
Imports System
Imports System.IO
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Collections
Imports System.Runtime.InteropServices
Imports NXOpen
Imports NXOpen.GeometricUtilities
Imports NXOpen.UF
Imports NXOpen.Assemblies
Imports NXOpenUI
Imports System.Collections.Generic
Imports System.Threading
Imports Microsoft.Office
Imports Microsoft.Office.Interop.Excel
Imports Microsoft.Office.Interop

Module MassandCG

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim theUI As UI = UI.GetUI
Dim ufs As UFSession = UFSession.GetUFSession
Dim lw As ListingWindow = theSession.ListingWindow

Sub Main()

Dim MyExcel As Object = Nothing
Dim MyBook As Object = Nothing
Dim Mysheet As Object = Nothing
Dim RefBook As Object = Nothing
Dim RefSheet As Object = Nothing
Dim ExcelFileName As String = "C:\Users\t5371pa\Desktop\Checklist.xlsx"
Dim ExcelNewFileName As String = "C:\Users\t5371pa\Desktop\Myexcel.xlsx"
Dim ExcelFileExists As Boolean = False
Dim NewExcel As String = Nothing
'Dim MyExcel As Excel.Application = Nothing
'Dim MyBook As Workbook = Nothing
'Dim Mysheet As Worksheet = Nothing
'Dim RefBook As Workbook = Nothing
'Dim RefSheet As Worksheet = Nothing

Dim Partno As String = Nothing
Dim tempScreenshot As String = Nothing
Dim tempLocation As String = "C:\Temp"
Try
Partno = workPart.GetStringAttribute("DB_PART_NO")
Catch ex As NXException
lw.WriteLine("Partno Not found" & ex.ErrorCode & ":" & ex.Message.ToString)
Partno = "Not Found"
End Try

'Create Excel File and Save it in user defined location
Dim Savechecklist As New SaveFileDialog
With Savechecklist
.Title = "Saving Standard DP Check File"
.InitialDirectory = "C:\Users\t5371pa\Desktop"
.Filter = "ExcelFiles (*.xlsx)|*.xlsx|Macro enabled Powerpoint files (*.xlsm)|*.xlsm|All files (*.*)|*.*"
.FilterIndex = 1
.RestoreDirectory = True
.FileName = ExcelNewFileName
If .ShowDialog = DialogResult.OK Then
NewExcel = .FileName
End If
End With

If MyExcel Is Nothing Then
MyExcel = CreateObject("Excel.Application")
If MyExcel Is Nothing Then
theUI.NXMessageBox.Show("Error", NXMessageBox.DialogType.Error, "Could not start Excel, journal exiting")
Exit Sub
End If
End If

MyExcel.Visible = False

If File.Exists(ExcelNewFileName) Then
'Open the Excel file
ExcelFileExists = True
MyBook = MyExcel.Workbooks.Open(ExcelNewFileName)
Else
'Create the Excel file
MyBook = MyExcel.Workbooks.Add
MyBook.SaveAs(ExcelNewFileName)
End If
If MyBook Is Nothing Then
theUI.NXMessageBox.Show("Error", NXMessageBox.DialogType.Error, "Could not open Excel file: " & ExcelFileName & ControlChars.NewLine & "journal exiting.")
Exit Sub
End If

Mysheet = MyBook.Worksheets.Add()
Mysheet.Activate()

Dim Row As Integer = Nothing
Dim i As Integer = Nothing
Dim MyGroupRep As NXObject = Nothing
Dim MyGroup As Features.Brep = Nothing
Dim Replist As ArrayList = New ArrayList
Dim Mylist As ArrayList = New ArrayList

For Each MyGroupRep In workPart.Features
If TypeOf MyGroupRep Is Features.Brep Then
Replist.Add(MyGroupRep)
End If
Next

For Each MyGroup In Replist
Mylist.Add(MyGroup)
Next
MsgBox(Mylist.Count.ToString)

For Row = 1 To Mylist.Count - 1
Dim Thegroup As Features.Brep = Mylist(Row)
Dim GruopName As String = Thegroup.Name
Thegroup.ShowBody(False)
Dim BodyList() As Body = Nothing
Dim MYSolidBodies As List(Of Body) = Nothing
Dim MYSheetBodies As List(Of Body) = Nothing
BodyList = Thegroup.GetBodies()

For j = 1 To BodyList.Length - 1
If BodyList(j).IsSolidBody Then
MYSolidBodies.Add(BodyList(i))
ElseIf BodyList(j).IsSheetBody Then
MYSheetBodies.Add(BodyList(i))
End If
Next
MsgBox(MYSolidBodies.Count.ToString)
Dim thebodies() As Body = MYSolidBodies.ToArray
Dim Partvolume As String = Nothing
Dim PartDen As String = Nothing
Dim PartMass As String = Nothing
Dim CGValue As Point3d = Nothing
Dim CGX As String = Nothing
Dim CGY As String = Nothing
Dim CGZ As String = Nothing

Dim myMeasure As MeasureManager = theSession.Parts.Display.MeasureManager()
Dim massUnits(4) As Unit
massUnits(0) = theSession.Parts.Display.UnitCollection.GetBase("Area")
massUnits(1) = theSession.Parts.Display.UnitCollection.GetBase("Volume")
massUnits(2) = theSession.Parts.Display.UnitCollection.GetBase("Mass")
massUnits(3) = theSession.Parts.Display.UnitCollection.GetBase("Length")

Dim MyNewmeasure As MeasureBodies = Nothing
Try
MyNewmeasure = myMeasure.NewMassProperties(massUnits, 0.99, thebodies)
MyNewmeasure.InformationUnit = MeasureBodies.AnalysisUnit.KilogramMillimeter
Try
Partvolume = MyNewmeasure.Volume.ToString("#.0")
Catch ex As NXException
Partvolume = MyNewmeasure.Volume.ToString("#.0")
End Try
Try
PartMass = MyNewmeasure.Mass.ToString("#.0")
Catch ex As NXException
PartMass = MyNewmeasure.Mass.ToString("#.0")
End Try
Try
CGValue = MyNewmeasure.Centroid
CGX = CGValue.X.ToString("#.0")
CGY = CGValue.Y.ToString("#.0")
CGZ = CGValue.Z.ToString("#.0")
Catch ex As NXException
CGX = 0
CGY = 0
CGZ = 0
End Try
Try
Dim DenFor As Integer = (MyNewmeasure.Mass.ToString / MyNewmeasure.Volume.ToString)
PartDen = DenFor.ToString("#.0")
Catch ex As NXException
PartDen = (MyNewmeasure.Mass.ToString / MyNewmeasure.Volume.ToString).ToString("#.0")
End Try
Catch ex As Exception
lw.WriteLine(Partno & ": MassProperties error-" & ex.Message.ToString)
End Try

Try
tempScreenshot = IO.Path.Combine(tempLocation, Partno & "-" & Row.ToString & ".jpg")
ExportScreenshot(tempScreenshot)

Catch ex As NXException
lw.WriteLine(Partno & Row.ToString & ": View Not Generated-" & ex.ErrorCode & ":" & ex.Message.ToString)
End Try
Mysheet.cells(Row, 1).value() = GruopName
Dim Piccommant As Object = Mysheet.Cells(Row, 2).AddComment()
Mysheet.cells(Row, 3).value() = Partvolume
Mysheet.cells(Row, 4).value() = PartMass
Mysheet.cells(Row, 5).value() = PartDen
Mysheet.cells(Row, 6).value() = CGX
Mysheet.cells(Row, 7).value() = CGY
Mysheet.cells(Row, 8).value() = CGZ

'Dim Piccommant As Excel.Comment = Mysheet.Cells(Row, 3).AddComment()
With Piccommant.Shape
.Fill.UserPicture(tempLocation & "\" & Partno & "-" & Row.ToString & ".jpg")
.Height = 600
.Width = 600
End With

Thegroup.HideBody()
Next

MyBook.Save()
MyBook.Close()
MyBook = Nothing
MyExcel.Quit()

End Sub

Sub ExportScreenshot(ByVal filename As String)

'save user preference for visibility of WCS, triad, view name, and view border
Dim wcsVisible As Boolean = theSession.Parts.BaseDisplay.WCS.Visibility
Dim triadVisible As Integer = theSession.Preferences.ScreenVisualization.TriadVisibility
Dim displayModelViewNames As Boolean = theSession.Parts.BaseDisplay.Preferences.NamesBorderVisualization.ShowModelViewNames
Dim displayModelViewBorders As Boolean = theSession.Parts.BaseDisplay.Preferences.NamesBorderVisualization.ShowModelViewBorders

'turn off the WCS, triad, view name, and view border
theSession.Parts.BaseDisplay.WCS.Visibility = False
theSession.Preferences.ScreenVisualization.TriadVisibility = False
theSession.Parts.BaseDisplay.Preferences.NamesBorderVisualization.ShowModelViewBorders = False
theSession.Parts.BaseDisplay.Preferences.NamesBorderVisualization.ShowModelViewNames = False

Try
ufs.Disp.CreateImage(filename, UFDisp.ImageFormat.Jpeg, UFDisp.BackgroundColor.White)
Catch ex As Exception
MsgBox(ex.Message & ControlChars.NewLine & _
"'" & filename & "' could not be created")
Throw New Exception("Screenshot could not be created")
Finally
'reset visibility of WCS, triad, view name, and view border to user's preference
theSession.Parts.BaseDisplay.WCS.Visibility = wcsVisible
theSession.Preferences.ScreenVisualization.TriadVisibility = triadVisible
theSession.Parts.BaseDisplay.Preferences.NamesBorderVisualization.ShowModelViewBorders = displayModelViewBorders
theSession.Parts.BaseDisplay.Preferences.NamesBorderVisualization.ShowModelViewNames = displayModelViewNames
End Try

End Sub
End Module

BREP stands for "boundary representation" and represents an unparameterized feature. The unparameterized "Body" feature is one example of a BREP feature. A BREP is quite different from a feature set; it is not possible to convert from one to the other. To get the bodies from the features in the group, I'd suggest first getting the features in the group then using the .GetBodies or .GetEntities method on each feature to extract the body objects.

The following link has some code that shows one method of getting the features that belong to a given feature group:
http://nxjournaling.com/comment/4097#comment-4097

I identified the problem. The imported para solids are not actually Bodies, They are Brep. So I have to Select a feature group, collect all brep's in it and extract bodies from Brep using .GetBodies method.

Option Strict Off
Imports System
Imports System.IO
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Collections
Imports System.Runtime.InteropServices
Imports NXOpen
Imports NXOpen.GeometricUtilities
Imports NXOpen.UF
Imports NXOpen.Assemblies
Imports NXOpenUI
Imports System.Collections.Generic
Imports System.Threading
Imports Microsoft.Office
Imports Microsoft.Office.Interop.Excel
Imports Microsoft.Office.Interop

Module MassandCG

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim theUI As UI = UI.GetUI
Dim ufs As UFSession = UFSession.GetUFSession
Dim lw As ListingWindow = theSession.ListingWindow

Sub Main()

Dim MyExcel As Object = Nothing
Dim MyBook As Object = Nothing
Dim Mysheet As Object = Nothing
Dim RefBook As Object = Nothing
Dim RefSheet As Object = Nothing
Dim ExcelNewFileName As String = "C:\Users\t5371pa\Desktop\Myexcel.xlsx"
Dim ExcelFileExists As Boolean = False
Dim NewExcel As String = Nothing
Dim lw As ListingWindow = theSession.ListingWindow
'Dim MyExcel As Excel.Application = Nothing
'Dim MyBook As Workbook = Nothing
'Dim Mysheet As Worksheet = Nothing
'Dim RefBook As Workbook = Nothing
'Dim RefSheet As Worksheet = Nothing

lw.Open()
Dim Partno As String = Nothing
Dim tempScreenshot As String = Nothing
Dim tempLocation As String = "C:\Temp"
Try
Partno = workPart.GetStringAttribute("DB_PART_NO")
Catch ex As NXException
lw.WriteLine("Partno Not found" & ex.ErrorCode & ":" & ex.Message.ToString)
Partno = "Not Found"
End Try

'Create Excel File and Save it in user defined location
Dim SaveMassandCG As New SaveFileDialog
With SaveMassandCG
.Title = "Saving Standard DP Check File"
.InitialDirectory = "C:\Users\t5371pa\Desktop"
.Filter = "ExcelFiles (*.xlsx)|*.xlsx|Macro enabled Powerpoint files (*.xlsm)|*.xlsm|All files (*.*)|*.*"
.FilterIndex = 1
.RestoreDirectory = True
.FileName = ExcelNewFileName
If .ShowDialog = DialogResult.OK Then
NewExcel = .FileName
End If
End With

If MyExcel Is Nothing Then
MyExcel = CreateObject("Excel.Application")
If MyExcel Is Nothing Then
theUI.NXMessageBox.Show("Error", NXMessageBox.DialogType.Error, "Could not start Excel, journal exiting")
Exit Sub
End If
End If

MyExcel.Visible = False

If File.Exists(ExcelNewFileName) Then
'Open the Excel file
ExcelFileExists = True
MyBook = MyExcel.Workbooks.Open(ExcelNewFileName)
Else
'Create the Excel file
MyBook = MyExcel.Workbooks.Add
MyBook.SaveAs(ExcelNewFileName)
End If
If MyBook Is Nothing Then
theUI.NXMessageBox.Show("Error", NXMessageBox.DialogType.Error, "Could not open Excel file: " & ExcelNewFileName & ControlChars.NewLine & "journal exiting.")
Exit Sub
End If

Mysheet = MyBook.Worksheets.Add()
Mysheet.Activate()

Dim Row As Integer = Nothing
Dim i As Integer = Nothing
Dim RepList As ArrayList = New ArrayList
Dim MyList As List(Of Features.FeatureGroup) = New List(Of Features.FeatureGroup)
Dim j As Integer = Nothing
Dim MyGroupRep As Features.Feature = Nothing
Dim MyGroup As Features.FeatureGroup = Nothing

For Each MyGroupRep In workPart.Features
If TypeOf MyGroupRep Is Features.FeatureGroup Then
RepList.Add(MyGroupRep)
End If
Next

For Each MyGroup In RepList
MyList.Add(MyGroup)
MyGroup.HideParents()
Next

lw.WriteLine("Total Group Count :" & MyList.Count.ToString)

For Row = 0 To RepList.Count - 1

Dim Thegroup As Features.FeatureGroup = MyList(Row)
Dim GroupName As String = Thegroup.Name
lw.WriteLine(GroupName & ":")
Thegroup.ShowParents(False)
Dim FeatureList() As Features.Feature = Nothing
Thegroup.GetMembers(FeatureList)
lw.WriteLine("Group Member Count: " & FeatureList.Length.ToString)
Dim BodyList As List(Of Features.Brep) = New List(Of Features.Brep)
Dim Mybodies As List(Of Body) = New List(Of Body)
Dim MySolidBodies As List(Of Body) = New List(Of Body)
Dim MySheetBodies As List(Of Body) = New List(Of Body)

For i = 0 To FeatureList.Length - 1
lw.WriteLine(FeatureList(i).GetType.ToString & FeatureList(i).Name)
If TypeOf FeatureList(i) Is Features.Brep Then
BodyList.Add(FeatureList(i))
End If
Next

lw.WriteLine("Brep Count: " & BodyList.Count.ToString)
For i = 0 To BodyList.Count - 1
For Each myb As Body In BodyList(i).GetBodies
Mybodies.Add(myb)
Next
Next
lw.WriteLine("Bodies Count: " & Mybodies.Count.ToString)
For Each Myb As Body In Mybodies
If Myb.IsSolidBody Then
MySolidBodies.Add(Myb)
ElseIf Myb.IsSheetBody Then
MySheetBodies.Add(Myb)
End If
Next
lw.WriteLine("SolidBodies Count: " & MySolidBodies.Count.ToString)
lw.WriteLine("SheetBodies Count: " & MySheetBodies.Count.ToString)
Dim thebodies() As Body = MySolidBodies.ToArray
Dim Partvolume As String = Nothing
Dim CGValue As Point3d = Nothing
Dim CGX As String = Nothing
Dim CGY As String = Nothing
Dim CGZ As String = Nothing

Dim myMeasure As MeasureManager = theSession.Parts.Display.MeasureManager()
Dim massUnits(4) As Unit
massUnits(0) = theSession.Parts.Display.UnitCollection.GetBase("Area")
massUnits(1) = theSession.Parts.Display.UnitCollection.GetBase("Volume")
massUnits(2) = theSession.Parts.Display.UnitCollection.GetBase("Mass")
massUnits(3) = theSession.Parts.Display.UnitCollection.GetBase("Length")

Dim MyNewmeasure As MeasureBodies = Nothing
Try
MyNewmeasure = myMeasure.NewMassProperties(massUnits, 0.99, thebodies)
MyNewmeasure.InformationUnit = MeasureBodies.AnalysisUnit.KilogramMillimeter
Try
Partvolume = MyNewmeasure.Volume.ToString("#.0")
Catch ex As NXException
Partvolume = MyNewmeasure.Volume.ToString("#.0")
End Try
Try
CGValue = MyNewmeasure.Centroid
CGX = CGValue.X.ToString("#.0")
CGY = CGValue.Y.ToString("#.0")
CGZ = CGValue.Z.ToString("#.0")
Catch ex As NXException
CGX = 0
CGY = 0
CGZ = 0
End Try

Catch ex As Exception
lw.WriteLine(Partno & ": MassProperties error-" & ex.Message.ToString)
End Try

Try
Dim Mylayout As Layout = CType(workPart.Layouts.FindObject("L1"), Layout)
Dim Isoview As ModelingView = CType(workPart.ModelingViews.FindObject("Isometric"), ModelingView)
Mylayout.ReplaceView(workPart.ModelingViews.WorkView, Isoview, True)
workPart.ModelingViews.WorkView.RenderingStyle = NXOpen.View.RenderingStyleType.ShadedWithEdges
tempScreenshot = IO.Path.Combine(tempLocation, Partno & "-" & Row.ToString & ".jpg")
ExportScreenshot(tempScreenshot)
CropScreenshot(tempScreenshot, 5)
Catch ex As NXException
lw.WriteLine(Partno & Row.ToString & ": View Not Generated-" & ex.ErrorCode & ":" & ex.Message.ToString)
End Try
Dim Myrow As Integer = Row + 1
Mysheet.cells(Myrow, 1).value() = GroupName
Dim Piccommant As Object = Mysheet.Cells(Myrow, 2).AddComment()
Mysheet.cells(Myrow, 3).value() = Partvolume
Mysheet.cells(Myrow, 4).value() = "=((C" & Myrow.ToString & "*E" & Myrow.ToString & ")/1000000000)"
Mysheet.cells(Myrow, 5).value() = "=((D" & Myrow.ToString & "/C" & Myrow.ToString & ")*1000000000)"
Mysheet.cells(Myrow, 7).value() = CGX
Mysheet.cells(Myrow, 8).value() = CGY
Mysheet.cells(Myrow, 9).value() = CGZ
Mysheet.cells(Myrow, 10).value() = MySheetBodies.Count.ToString
Mysheet.cells(Myrow, 11).value() = MySolidBodies.Count.ToString

'Dim Piccommant As Excel.Comment = Mysheet.Cells(Row, 3).AddComment()

With Piccommant.Shape
.Fill.UserPicture(tempLocation & "\" & Partno & "-" & Row.ToString & ".jpg")
.Height = 300
.Width = 300
End With
Thegroup.HideParents()

Next

Mysheet.Range("A1").entirerow.insert()
Mysheet.cells(1, 1).value = "Part Description"
Mysheet.cells(1, 2).value = "Image"
Mysheet.cells(1, 3).value = "Volume"
Mysheet.cells(1, 4).value = "Mass"
Mysheet.cells(1, 5).value = "Density"
Mysheet.cells(1, 6).value = "Material"
Mysheet.cells(1, 7).value = "CG X"
Mysheet.cells(1, 8).value = "CG Y"
Mysheet.cells(1, 9).value = "CG Z"
Mysheet.cells(1, 10).value() = "Surafce Count"
Mysheet.cells(1, 11).value() = "Solid Count"

Mysheet.Cells.EntireColumn.AutoFit()

MyBook.Save()
MyBook.Close()
MyBook = Nothing
MyExcel.Quit()

End Sub

Sub ExportScreenshot(ByVal filename As String)

'save user preference for visibility of WCS, triad, view name, and view border
Dim wcsVisible As Boolean = theSession.Parts.BaseDisplay.WCS.Visibility
Dim triadVisible As Integer = theSession.Preferences.ScreenVisualization.TriadVisibility
Dim displayModelViewNames As Boolean = theSession.Parts.BaseDisplay.Preferences.NamesBorderVisualization.ShowModelViewNames
Dim displayModelViewBorders As Boolean = theSession.Parts.BaseDisplay.Preferences.NamesBorderVisualization.ShowModelViewBorders

'turn off the WCS, triad, view name, and view border
theSession.Parts.BaseDisplay.WCS.Visibility = False
theSession.Preferences.ScreenVisualization.TriadVisibility = False
theSession.Parts.BaseDisplay.Preferences.NamesBorderVisualization.ShowModelViewBorders = False
theSession.Parts.BaseDisplay.Preferences.NamesBorderVisualization.ShowModelViewNames = False

Try
ufs.Disp.CreateImage(filename, UFDisp.ImageFormat.Jpeg, UFDisp.BackgroundColor.White)
Catch ex As Exception
MsgBox(ex.Message & ControlChars.NewLine & _
"'" & filename & "' could not be created")
Throw New Exception("Screenshot could not be created")
Finally
'reset visibility of WCS, triad, view name, and view border to user's preference
theSession.Parts.BaseDisplay.WCS.Visibility = wcsVisible
theSession.Preferences.ScreenVisualization.TriadVisibility = triadVisible
theSession.Parts.BaseDisplay.Preferences.NamesBorderVisualization.ShowModelViewBorders = displayModelViewBorders
theSession.Parts.BaseDisplay.Preferences.NamesBorderVisualization.ShowModelViewNames = displayModelViewNames
End Try

End Sub

Sub CropScreenshot(ByVal theImageFile As String, ByVal borderWidth As Integer)

'borderWidth = whitespace to leave around the border of the image

Dim original As New Bitmap(theImageFile)

Dim JPGminX As Integer = original.Width
Dim JPGminY As Integer = original.Height
Dim JPGmaxX As Integer = 0
Dim JPGmaxY As Integer = 0

Dim bckgrndColor As Color = Color.White

For y As Integer = 0 To original.Height - 1
For x As Integer = 0 To original.Width - 1
If original.GetPixel(x, y).ToArgb <> bckgrndColor.ToArgb Then
If x < JPGminX Then
JPGminX = x
ElseIf x > JPGmaxX Then
JPGmaxX = x
End If
If y < JPGminY Then
JPGminY = y
ElseIf y > JPGmaxY Then
JPGmaxY = y
End If
End If
Next
Next
Dim rect As New System.Drawing.Rectangle(JPGminX, JPGminY, JPGmaxX - JPGminX, JPGmaxY - JPGminY)

Dim cropped As Bitmap = original.Clone(rect, original.PixelFormat)

'create new image sized to add border around cropped image
Dim border As New Bitmap(cropped.Width + (2 * borderWidth), cropped.Height + (2 * borderWidth), cropped.PixelFormat)

'create a new graphics object
Dim g As Graphics = Graphics.FromImage(border)

'fill the graphics object with white color (for background)
Using myBrush As Brush = New SolidBrush(Color.White)
g.FillRectangle(myBrush, 0, 0, border.Width, border.Height)
End Using

'calculate position to place cropped image onto background image
Dim xImage As Integer = border.Width - cropped.Width - borderWidth
Dim yImage As Integer = border.Height - cropped.Height - borderWidth

'draw cropped image onto white background
g.CompositingMode = Drawing2D.CompositingMode.SourceOver
g.DrawImage(cropped, New System.Drawing.Point(xImage, yImage))

'dispose of unneeded graphics objects
original.Dispose()
cropped.Dispose()
g.Dispose()

'save our finished graphics file
border.Save(theImageFile, Imaging.ImageFormat.Png)

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

Regards,

Joe