I am trying to make an automation of a FEA in NX by running a Java journal in Eclipse.
The part of the journal that fails is this one:
solutionResult1 = theSession.resultManager().createSolutionResult(simSolution1);
The first command solves the FEA with NX Nastran but in the second command this problem appears.
"Result File not found"
I realized that it was a timing issue, that when the journal goes to find the result file, the solver is still solving. Entering a delay of 20 sec between the two commands solves the problem but what I want is to save time and that the journal continues running straight after the result file is created.
How can I know when the result file is created?
Thanks in advance for the help
Solved! Go to Solution.
By default, the solution process is run in the background so you can work in NX while the solve completes. In the api, this means that the next command is executed immediately after the solve is launched.
Interactively, there is a "Run job in Foreground" option on the solution. If you set this same property in the API, NX will wait for the solution to complete before executing the next command.
Do the following prior to the simSolution1.solve():
Thank you for the answer JimB!
As you said, i put that code line before the solving command but an error appears:
"waitForCompletion cannot be resolved to a variable"
What do you think is the problem? Should I define before in someway?
Thank you in advance
Sorry. I copied that line from a subroutine that I use. waitForCompletion is a boolean in the argument list (as the PropertyTable set method indicates)
Dim waitForCompletion As Boolean = True simSolution1.PropertyTable.SetBooleanPropertyValue("Foreground", waitForCompletion)