I have a python script (but it could be any language) where I do a Solve and then look at the results (see code snippet below). Unfortunately, the code continues on before the Solve is complete.
I guess I could watch the Nastran processes or maybe put it into a loop until results finally show up. I just curious if there is some API option or if anyone has a good, robust way of doing this. It has got to be a common problem.
simResultReference1 = simSolution1.Find("Structural")
solutionResult1 = theSession.ResultManager.CreateReferenceResult(simResultReference1)
resultParameters1 = theSession.ResultManager.CreateResultParameters()
loadcase1 = solutionResult1.Find("Loadcase")
iteration1 = loadcase1.Find("Iteration")
resultType1 = iteration1.Find("ResultType[[Displacement][Nodal]]")
Solved! Go to Solution.
Interactively, NX behaves the same way - when you launch a solution, control is returned to NX so you can work on other models, etc.
If you want NX to wait for the solution to complete, edit the solution and toggle on the "Run Job in Foreground" option. If you record a journal of this, you will see the API to set it.
In short, the solution property table contains a boolean property named "Foreground". If you set it to True, the application will wait for the solution to complete before proceeding.