cancel
Showing results for 
Search instead for 
Did you mean: 

How can I wait for a Nastran solve to finish before continuing in my NX script?

Genius
Genius

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.

 

 

 
 simSolution1.Solve(NXOpen.CAE.SimSolution.SolveOption.Solve, NXOpen.CAE.SimSolution.SetupCheckOption.CompleteCheckAndOutputErrors)

simResultReference1 = simSolution1.Find("Structural")
solutionResult1 = theSession.ResultManager.CreateReferenceResult(simResultReference1)

resultParameters1 = theSession.ResultManager.CreateResultParameters()

loadcase1 = solutionResult1.Find("Loadcase[1]")
iteration1 = loadcase1.Find("Iteration[1]")
resultType1 = iteration1.Find("ResultType[[Displacement][Nodal]]")
resultParameters1.SetGenericResultType(resultType1)

 

 

2 REPLIES

Re: How can I wait for a Nastran solve to finish before continuing in my NX script?

Siemens Phenom Siemens Phenom
Siemens Phenom

Mark,

 

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.

Re: How can I wait for a Nastran solve to finish before continuing in my NX script?

Genius
Genius

Nice!  That is what I needed.  Thanks @JimB !