# Copyright (c) 2026 JSOL CORPORATION # # This script is released under the MIT License. # See the following URL for the full license text. # https://www.jmag-international.com/jp/scriptlibrary/jmag_script_library_mit/ app = designer.GetApplication() def getThermalModelRegionCheckItems(dimension): """Get thermal model regions to be checked according to the model dimension.""" checkItems = [ (u"stator_gap", u"Gap (stator side)"), (u"rotor_gap", u"Gap (rotor side)"), (u"stator_outer", u"Stator outer boundary"), (u"rotor_inner", u"Rotor inner boundary"), ] if dimension == 2: checkItems.extend([ (u"stator_core", u"Stator core"), (u"rotor_core", u"Rotor core"), (u"coil", u"Coil (1 slot)"), ]) elif dimension == 3: checkItems.extend([ (u"stator_core", u"Stator core (front face)"), (u"rotor_core", u"Rotor core (front face)"), (u"coil", u"Coil (front face) (1 slot)"), (u"rear_stator_core", u"Stator core (rear face)"), (u"rear_rotor_core", u"Rotor core (rear face)"), (u"rear_coil", u"Coil (rear face) (1 slot)"), ]) return checkItems def checkUnassignedThermalModelRegions(thermalModelRegion, checkItems): """Check and display unassigned thermal model regions.""" warningExists = False for key, label in checkItems: if thermalModelRegion.HasWarning(key): print(u"{0} is not assigned.".format(label)) warningExists = True if not warningExists: print(u"All thermal model regions are assigned.") def main(): """Check unassigned thermal model regions in the current study.""" model = app.GetCurrentModel() study = app.GetCurrentStudy() thermalModelRegion = study.GetThermalModelRegion() if not thermalModelRegion.IsValid(): return checkItems = getThermalModelRegionCheckItems(model.GetDimension()) checkUnassignedThermalModelRegions(thermalModelRegion, checkItems) main()