Mirrored/Linked bodies not exporting

I've written a script to loop over all the bodies in an assembly and identify ones that match a certain NX_material string. These are then exported as STLs later.

However, parts that appear to be links/mirrors (I don't know the right NX terminology) are not exported, only the root part is exported.

As I loop over the bodies, though, and set the setHighlight flag to "1", all the mirrored/linked parts are highlighted, for a given body, but later, the ExportSTL call only exports one of these.

How can I export all occurrences (?) of this part.

Here's the full VB script with a few sensitive pieces of information removed:

Option Strict Off
Imports System
Imports System.Threading
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Assemblies
Imports NXOpen.Features

Module Module1

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = theSession.ListingWindow

Dim bCheckIfFullyLoaded As Boolean = False
Dim stlOutFileName As String = "C:/This/is/a/path"
Dim qualifiers As String = ""
Dim materialList As New List(Of String) From {"Material_name_1", "Material_name_2"}

Dim bWriteSTL As Boolean = False
Dim bWriteAsIndividualFiles As Boolean = False

Sub Main()

If IsNothing(theSession.Parts.BaseWork) Then
'active part required
Return
End If

Dim workParts As New List(Of Part)
For Each tempPart As Part In theSession.Parts
'Dim c As ComponentAssembly = tempPart.ComponentAssembly
workParts.Add(tempPart)
Next

lw.Open()

Const undoMarkName As String = "export solids to STL"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, undoMarkName)

Dim theSolids As New List(Of Body)

'collect the solid bodies in the work part

For Each part As Part in workParts
Dim isLoadead As Boolean = part.IsFullyLoaded()
Dim partDesc As String = part.GetStringAttribute("DB_PART_DESC")
lw.WriteLine(part.Name + " " + partDesc)

If bCheckIfFullyLoaded Then
If isLoadead Then
lw.WriteLine(" Fully Loaded")
Else
lw.WriteLine(" Not Fully Loaded")
lw.WriteLine(" Trying to fully load this part")
Try
part.LoadThisPartFully()
Catch ex As Exception
lw.WriteLine("Error: " + ex.Message)
End Try
End If
End If

For Each body As Body In part.Bodies
lw.WriteLine("-" + body.Name)
theUfSession.Disp.SetHighlight(body.Tag, 0)
If body.HasUserAttribute("NX_Material", NXObject.AttributeType.String, 0) Then
Dim obj As NXOpen.NXObject.AttributeInformation = body.GetUserAttribute("NX_Material", NXObject.AttributeType.String, -1)
Dim material As String = obj.StringValue

lw.WriteLine("... " + material)

Dim bKeepThisBody As Boolean = False
Dim bContinue = False

For Each mat As String In materialList
If material.Contains(mat) Then
bContinue = True
End If

' HACK to get a portion of the rollbar selected
If mat = "SPECIAL_NAME" Then
If partDesc.Contains("ROLLBAR") And material.Contains("ZERO MASS") Then
bContinue = True
End If
End If
Next

If bContinue Then
If qualifiers <> "" Then
For Each feature As Feature in body.GetFeatures()
If feature.Name.Contains(qualifiers)
bKeepThisBody = True
End If
Next
Else
bKeepThisBody = True
End If

If bKeepThisBody Then
theUfSession.Disp.SetHighlight(body.Tag, 1)
theUfSession.Disp.MakeDisplayUpToDate()
System.Threading.Thread.Sleep(200)

theUfSession.Disp.SetHighlight(body.Tag, 0)
theUfSession.Disp.MakeDisplayUpToDate()
lw.WriteLine(body.Name)
theSolids.Add(body)
End If
End If
End If
Next
Next

If bWriteSTL Then
If bWriteAsIndividualFiles
For Each body As Body In theSolids
Dim singleObject As New List(Of Body)
singleObject.Add(body)
ExportSTL(stlOutFileName + "_" + CStr(body.Tag), singleObject, 0.03)
Next
Else
ExportSTL(stlOutFileName, theSolids, 0.03)
End If
End If
'Try
'ExportSTL(workPart.FullPath, theSolids, 0.003, 0.003)
'Catch ex As NXException
'lw.WriteLine("NX Error: " & ex.Message)
'Catch ex As Exception
'lw.WriteLine("Error: " & ex.Message)
'End Try

lw.Close()

End Sub

Sub ExportSTL(ByVal FileName As String, ByVal theObjects As List(Of Body), ByVal triangleTolerance As Double)

Dim NumErrors As Integer
Dim FileHandle As IntPtr
Dim InfoError() As UFStd.StlError
Dim Header, FileBaseName As String
Dim lw As ListingWindow = theSession.ListingWindow
Dim theUfSession As UFSession = UFSession.GetUFSession()
'Dim numNegated As Integer
'Dim Negated() As Tag

lw.Open()
'Negated = Nothing
InfoError = Nothing

FileName = IO.Path.ChangeExtension(FileName, ".stl")

FileBaseName = IO.Path.GetFileName(FileName)
Header = "Header: " & FileBaseName

theUfSession.Std.OpenBinaryStlFile(FileName, False, Header, FileHandle)

theUfSession.Ui.SetPrompt("Creating file ... " & FileBaseName & " ...")

For Each temp As Body In theObjects
If temp.IsSolidBody Then
lw.WriteLine(" body is occurrence: " + temp.IsOccurrence.ToString)
Try
theUfSession.Std.PutSolidInStlFile(FileHandle, Tag.Null, temp.Tag, 0.0, 5.0, triangleTolerance, NumErrors, InfoError)
theUfSession.Disp.SetHighlight(temp.Tag, 0)
Catch ex As Exception
lw.WriteLine("Error with STL : " + ex.Message)
End Try
End If
Next

theUfSession.Std.CloseStlFile(FileHandle)

theUfSession.Ui.SetStatus("File ... " & FileBaseName & " generated ...")

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

If you want to export the bodies as seen in the assembly, I'd suggest getting all the bodies from the assembly.
http://nxjournaling.com/comment/3487#comment-3487

Your current code loops through each part and gets the bodies in each (the prototype bodies). This method could miss some occurrence bodies in the assembly.