Studies of JMAG-Designer will issue warnings and error messages if there are potential inappropriate values or combinations of setting parameters. Similarly, automatic mesh generation and analysis execution results will also display error messages if they fail to complete successfully, and warning messages if they are potentially inappropriate.
This script retrieves errors and warnings occurring in the study.
Preconditions
- One or more study has been created.
This script runs on the active study in the project tree.
Script Function
- Retrieve and display the total number of messages, the number of warning messages, and the number of error messages.
- Retrieve and display the content of all warning messages.
- Retrieve and display the content of all error messages.
# 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)


