# 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 createVectorExpression(study, vectorExprInfo): """Creating variables and expressions using vector data.""" exprtype = vectorExprInfo[u"type"] exprParam = vectorExprInfo[u"param"] vectExpr = study.CreateVectorExpression(vectorExprInfo[u"title"]) # Created from dataset. if exprtype == u"DataVariable": vectExpr.SetReferenceDataFromTable(exprParam[u"refDataFromTbl"]) vectExpr.SetUnit(exprParam[u"unit"]) vectExpr.SetLine(exprParam[u"line"]) vectExpr.SetVariable(exprParam[u"variable"]) vectExpr.SetCaseRangeType(exprParam[u"caseRangeType"]) # Creating an expression. elif exprtype == u"Expression": vectExpr.SetVariable(exprParam[u"variable"]) vectExpr.SetExpression(exprParam[u"expression"]) study = app.GetCurrentStudy() dataVarParam = { u"type" : u"DataVariable", u"title" : u"rth1", u"param" : { u"refDataFromTbl" : u"Circuit Thermal Resistance", u"unit" : u"s", u"line" : u"Rt1", u"variable" : u"RtRt1ve", u"caseRangeType" : u"allsteps" } } createVectorExpression(study, dataVarParam) exprParam = { u"type" : u"Expression", u"title" : u"rth2", u"param" : { u"variable" : u"RtCE1R2ve", u"expression" : u"1 / RtRt1ve" } } createVectorExpression(study, exprParam)