Files
Atomizer/nx_journals/user_generated_journals/journal_solve_all_solution.py

42 lines
1.9 KiB
Python
Raw Normal View History

# NX 2412
# Journal created by antoi on Tue Nov 18 14:06:55 2025 Eastern Standard Time
#
import math
import NXOpen
import NXOpen.CAE
def main(args) :
theSession = NXOpen.Session.GetSession() #type: NXOpen.Session
workSimPart = theSession.Parts.BaseWork
displaySimPart = theSession.Parts.BaseDisplay
# ----------------------------------------------
# Menu: Analysis->Solve All Solutions...
# ----------------------------------------------
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
theSession.SetUndoMarkName(markId1, "Solve All Solutions Dialog")
markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Solve All Solutions")
theSession.DeleteUndoMark(markId2, None)
markId3 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Solve All Solutions")
theCAESimSolveManager = NXOpen.CAE.SimSolveManager.GetSimSolveManager(theSession)
numsolutionssolved1, numsolutionsfailed1, numsolutionsskipped1 = theCAESimSolveManager.SolveAllSolutions(NXOpen.CAE.SimSolution.SolveOption.Solve, NXOpen.CAE.SimSolution.SetupCheckOption.CompleteCheckAndOutputErrors, NXOpen.CAE.SimSolution.SolveMode.Foreground, False)
numsolutionssolved2, numsolutionsfailed2, numsolutionsskipped2 = theCAESimSolveManager.SolveAllMetaSolutions(NXOpen.CAE.SimSolution.SolveOption.Solve, NXOpen.CAE.SimSolution.SetupCheckOption.CompleteCheckAndOutputErrors, NXOpen.CAE.SimSolution.SolveMode.Foreground, False)
theSession.DeleteUndoMark(markId3, None)
theSession.SetUndoMarkName(markId1, "Solve All Solutions")
theSession.DeleteUndoMark(NXOpen.Session.UndoMarkId.ValueOf(1988), None)
# ----------------------------------------------
# Menu: Tools->Automation->Journal->Stop Recording
# ----------------------------------------------
if __name__ == '__main__':
main(sys.argv[1:])