TAGGED: act, mechanical
-
-
August 14, 2023 at 4:18 am
Azmin Zamsanirani
SubscriberI'm working on modifying the AveTemp act extension, which calculates the average temperature of a model. However, the initial output doesn't match the current unit system in Mechanical. For instance, when using the U.S Customary unit system, the result should be in Kelvin, but it's currently produced in Celsius. To address this, I've set the default value as Celsius, as changing it to Kelvin would lead to incorrect output. For example, if the average temperature is 65 Celsius, and I switch to U.S Customary units, it displays 65 Kelvin, which is inaccurate. How can I ensure the output aligns with the current unit system
-
August 15, 2023 at 10:30 am
mjmiddle
Ansys EmployeeThis seems to be the same question as your post:
/forum/forums/topic/act-mechanical-coordinates-units/#post-298285
You need to get the current units and convert:
  import units
  #toUnit = ExtAPI.DataModel.CurrentUnitFromQuantityName("Temperature")
  toUnit = result.Properties["MyProperty"].GetCurrentUnit()   # assuming unit="Temperature" in property in XML
  fromUnit = 'C'
  result.Properties["MyProperty"].Value = units.ConvertUnit(2.54, fromUnit, toUnit)
-
- The topic ‘Defined ACT Mechanical Extension Results’ Units’ is closed to new replies.
-
3487
-
1057
-
1051
-
945
-
912
© 2025 Copyright ANSYS, Inc. All rights reserved.