# Copyright (c) 2026 JSOL CORPORATION # # This script is released under the MIT License. # See the full license text at: # https://www.jmag-international.com/scriptlibrary/jmag_script_library_mit/ def checkMessages(studyReport): """Display the number of messages that have occurred""" print(u"NumAllMessages:", studyReport.NumMessages()) print(u"NumWarningMessages:", studyReport.NumWarningMessages()) print(u"NumErrorMessages:", studyReport.NumErrorMessages()) def showWarningDetail(studyReport): """Display the contents of all warning messages that have occurred""" if studyReport.HasWarningMessage(): print(u"Warning:") for i in range(studyReport.NumWarningMessages()): message = studyReport.GetWarningMessage(i) print( f"[{i}] type={message.GetType()} code={message.GetCode()} title={message.GetTitle()}") print(message.GetText()) print("") def showErrorDetail(studyReport): """Display the contents of all error messages that have occurred""" if studyReport.HasErrorMessage(): print(u"Error:") for i in range(studyReport.NumErrorMessages()): message = studyReport.GetErrorMessage(i) print( f"[{i}] type={message.GetType()} code={message.GetCode()} title={message.GetTitle()}") print(message.GetText()) print("") app = designer.GetApplication() study = app.GetCurrentStudy() report = study.GetReport() checkMessages(report) showWarningDetail(report) showErrorDetail(report)