STL export of part variants

Hi!

I have a part with multiple parameters and would like export different variants of it in stl format, with the filenames of the parameter values concatenated. I try to do it with nested for loops. I could not figure out how the stl export should work. Any help would be appreciated.

Thanks,
Máté

' NX 10.0.3.5
'
Option Strict Off
Imports System
Imports NXOpen

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

Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work

Dim displayPart As NXOpen.Part = theSession.Parts.Display

theSession.Preferences.Modeling.UpdatePending = False

Dim markId1 As NXOpen.Session.UndoMarkId
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Expression")

For i As Double = 120 To 240 Step 30
For j As Double = 1.5 To 3.5 Step 0.5

Dim expression1 As NXOpen.Expression = CType(workPart.Expressions.FindObject("p102"), NXOpen.Expression)

Dim unit1 As NXOpen.Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), NXOpen.Unit)

workPart.Expressions.EditWithUnits(expression1, unit1, i)

Dim expression2 As NXOpen.Expression = CType(workPart.Expressions.FindObject("p103"), NXOpen.Expression)

Dim unit2 As NXOpen.Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), NXOpen.Unit)

workPart.Expressions.EditWithUnits(expression2, unit2, j)

theSession.Preferences.Modeling.UpdatePending = True

Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.DoUpdate(markId1)

Next j
Next i

End Sub
End Module

The following thread has a subroutine that will export an STL file given a file name and a solid body:

http://nxjournaling.com/content/exporting-stl-files