I'm writing an automation program with NXOpen (java).
I need to launch the solver and then read some results after the solver has finished, but I'm facing a problem with the SimSolution.solve(...) method: it doesn't wait until the end of the simulation.
Is there a way to wait for the simulation to finish? Or a way to know if the simulation is still running?
Additionally, is there a way to stop/kill the running solver via API?
Thanks in advance
Interactivly, setting the "Run Job in Foreground" toggle on the Solution dialog causes NX to wait for the solution to complete before giving control back to the user. You can Journal this to find that it is setting the following property on the Solution Property Table (the following is from a .VB example, but the Java API contains the same functionality:
Dim solutionPropertyTable As CAE.PropertyTable = simSolution.PropertyTable solutionPropertyTable.SetBooleanPropertyValue("Foreground", waitForCompletion)
I'm not aware of any way in the NX Open API to get the process handle of the spawned solution process. If you are sure that there is only going to be one solve running at a time, your application could use standard system calls to find the solver process by executable name.
Thanks a lot Jim.
I tried the same with c++ journal to run one structural simulation after one thermal simulation and turning on the "Run in Foreground" allow me to run the two simulations sequentially instead of running two at the same time.
In order to communicate between NX thermal and NX nastran, I need to map NX thermal solution to NX nastran. However, with mapping, no such "Run in Foreground" option is available.
My ideal journal would be:
Thermal simulation start --> finish --> mapping start --> finish --> structural simulation start --> finish
However since I cannot run mapping in foreground, mapping and structural simulation start at the same time after the thermal simulation is completed.
Is there any way around it?
Thanks in advance!