# 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 main(): app = designer.GetApplication() study = app.GetCurrentStudy() if study is None or not study.IsValid(): print(u"The active study could not be retrieved.") return try: thermalModelDefinition = study.GetThermalModelDefinition() except Exception as error: if app.HasError(): app.ClearError() print(u"The thermal model settings could not be retrieved. {0}".format(error)) return if app.HasError(): errorMessage = app.GetLastMessage() app.ClearError() print(u"The thermal model settings could not be retrieved. {0}".format(errorMessage)) return if thermalModelDefinition is None or not thermalModelDefinition.IsValid(): print(u"The thermal model settings could not be retrieved.") return # Parameters to display before and after the update parameterItems = [ (u"Housing > Height", u"HousingHeight"), (u"Flange > Diameter", u"FlangeDiameter"), (u"Flange > Plate Height", u"FlangePlateHeight"), (u"Flange > Plate Width", u"FlangePlateWidth"), (u"Shaft > Inner Diameter", u"ShaftInnerDiameter"), (u"Bearing > Front > Shaft Diameter", u"ShaftDiameterFront"), (u"Bearing > Front > Bearing Outer Diameter", u"BearingDiameterFront"), (u"Bearing > Front > Bearing Width", u"BearingWidthFront"), (u"Bearing > Rear > Shaft Diameter", u"ShaftDiameterRear"), (u"Bearing > Rear > Bearing Outer Diameter", u"BearingDiameterRear"), (u"Bearing > Rear > Bearing Width", u"BearingWidthRear"), ] beforeValues = {} # Get parameters before update for label, parameterName in parameterItems: beforeValues[parameterName] = thermalModelDefinition.GetValue(parameterName) thermalModelDefinition.SetDefaultsFromGeometry() # Get parameters after update print(u"--Parameters updated from geometry.--") for label, parameterName in parameterItems: afterValue = thermalModelDefinition.GetValue(parameterName) print(u"{0} : {1} -> {2}".format( label, beforeValues[parameterName], afterValue)) main()