Default values for thermal model parameters can be derived from geometry.
This script updates the thermal model setting parameters from geometry and displays the values of selected parameters before and after the update.
Preconditions
- One or more thermal analysis studies with defined thermal model setting have been created.
This script runs on the active thermal analysis study in the project tree. - The thermal model is available in JMAG-Designer v25.1 and later.
Script Function
- Get the thermal model setting from the active study.
If it's not found, display message and stop. - Retrieve the original values of selected parameters of housing, flange, shaft, and front and rear bearing.
- Update thermal model parameter values from geometry.
- Display the values of the selected parameters before and after the update.
# 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()


