# 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 createMeshCondLayerCoating(meshCtrl, tgtSet, meshPropParamArray): """Add a coating to the mesh""" meshCond = meshCtrl.CreateCondition(u"LayerCoating", u"cond01") meshCond.AddSet(tgtSet, 0) meshCond.RemoveSubCondition(0) # Coating layer property settings for idx, meshPropParam in enumerate(meshPropParamArray, 1): meshSubCond = meshCond.CreateSubCondition(u"LayerCoatingData", u"Group {}".format(idx)) meshSubCond.SetValue(u"Thickness", meshPropParam[u"Thickness"]) meshSubCond.SetValue(u"Division", meshPropParam[u"Division"]) meshSubCond.SetMaterialByName(u"CoatingMaterial", meshPropParam[u"material"]) material = meshSubCond.GetMaterial(u"CoatingMaterial") material.SetValue(u"EddyCurrentCalculation", meshPropParam[u"eddyCurrentFlag"]) setNm = u"CoilSet" tgtSet = app.GetCurrentModel().GetSetList().GetSet(setNm) meshCtrl = app.GetCurrentStudy().GetMeshControl() meshPropParamArray = [{u"Thickness" : 0.01, u"Division" : 5, u"material" : u"Copper", u"eddyCurrentFlag" : "AllowEddyCurrent"}, {u"Thickness" : 0.005, u"Division" : 2, u"material" : u"TRANSFORMER_FILM", u"eddyCurrentFlag" : "NoEddyCurrent"}] createMeshCondLayerCoating(meshCtrl, tgtSet, meshPropParamArray)