programming many simulations

Hello everyone,

I'm new to this forum and NX journal, so excuse me for basic knowledge.

I have a simple body with three feet and I would like to obtain the maximum stress for each movement of the 6 degree of freedom of each foot. To do so, I put a simple move on one foot, I launch the simulation and export the result files.
However my journal don't wait the end of the simulation and so there is no result and my journal fail.

So, I would like to know if there is a way the put a function maybe, that wait the end of the simulation before continuing. A timer would a first step but I would like to do 36 simulations in queue and a timer could raise to much the time of simulation.

Thanks
Regards

The following code will run each solution in a .sim file, waiting for the solution to finish before starting the next one. The journal must be run with a .sim file open as the current work part.

Code was tested on NX 8.5.

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

Sub Main()

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()
If IsNothing(theSession.Parts.BaseWork) Then
'active part required
Return
End If

Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()

'Dim workPart As Part = theSession.Parts.Work
Dim workSimPart As CAE.SimPart

Try
workSimPart = CType(theSession.Parts.BaseWork, CAE.SimPart)
Catch ex As NXException
lw.WriteLine(ex.ErrorCode & ": " & ex.Message)
lw.WriteLine("journal exiting")
Return
End Try

Const undoMarkName As String = "NXJ journal"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

For Each tempSolution As CAE.SimSolution In workSimPart.Simulation.Solutions

lw.WriteFullline("Name: " & tempSolution.Name)
Dim resultFileDir As String
Dim resultFileName As String

tempSolution.GetResultFile(resultFileDir, resultFileName)
Dim resultFile As String = IO.Path.Combine(resultFileDir, resultFileName)

lw.WriteFullline("result file: " & resultFile)
lw.WriteFullline("step count: " & tempSolution.StepCount.ToString)

'solve & wait for file
workSimPart.Simulation.ActiveSolution = tempSolution

Dim solutionPropertyTable As CAE.PropertyTable = tempSolution.PropertyTable
solutionPropertyTable.SetBooleanPropertyValue("Foreground", True)

tempSolution.Solve(CAE.SimSolution.SolveOption.Solve, CAE.SimSolution.SetupCheckOption.CompleteCheckAndOutputErrors)

Next

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

Thanks that helps a lot