Showing results for 
Search instead for 
Do you mean 
Solved! Go to solution

How to know when the result file is created after solving

Hi everybody,


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:



simSolution1.solve(nxopen.cae.SimSolution.SolveOption.SOLVE, nxopen.cae.SimSolution.SetupCheckOption.COMPLETE_CHECK_AND_OUTPUT_ERRORS);


nxopen.cae.SolutionResult  solutionResult1;

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 Smiley Happy






Re: How to know when the result file is created after solving

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():


simSolution1.PropertyTable.SetBooleanPropertyValue("Foreground", waitForCompletion)

Re: How to know when the result file is created after solving

[ Edited ]

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 Smiley Happy


Cheers, Bernardo


Accepted by topic author Bernardo
‎08-26-2015 04:32 AM

Re: How to know when the result file is created after solving

[ Edited ]

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)


Try this:

Dim waitForCompletion As Boolean = True
simSolution1.PropertyTable.SetBooleanPropertyValue("Foreground", waitForCompletion)


or this:


simSolution1.PropertyTable.SetBooleanPropertyValue("Foreground", True)