By creating equations (variables), those can be used to set parameters in JMAG-Designer and the shape editor. Using variables provides to change parameter values based on arbitrary expressions and define the relations between parameters using mathematical formulas. Defined variable names can be directly input into various parameters.
This script creates an equation of the expression type.
Preconditions
- One or more study has been created.
This script runs on the active study in the project tree.
Script Function
- Create an equation with the variable name "Delta1".
- Set the type to "Expression".
- Set the expression to:
abs(cos(45/90)) - Set the display name and description.
- Do not use for modeling.
- Specify the order as first in the equation list.
# 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/
app = designer.GetApplication()
def createEquationForCaseControl(designTable, varName, type, expression):
"""Create an equation for the case control."""
designTable.AddEquation(varName)
equation = designTable.GetEquation(varName)
# type of equation
# 0:Value
# 1:Expression
# 2:Expression(Condition)
# 3:Expression(Flag)
equation.SetType(type)
equation.SetExpression(expression)
equation.SetModeling(False)
equation.SetDisplayName(u"result_check")
equation.SetDescription(u"Use to compare results.")
equation.SetDisplayIndex(0)
study = app.GetCurrentStudy()
designTable = study.GetDesignTable()
type = 1
varName = u"Delta1"
expression = u"abs(cos(45/90))"
createEquationForCaseControl(designTable, varName, type, expression)


