Ansys Products

Ansys Products

Discuss installation & licensing of our Ansys Teaching and Research products

Defined ACT Mechanical Extension Results’ Units

TAGGED: ,

    • Azmin Zamsanirani
      Subscriber

      I'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

    • mjmiddle
      Ansys Employee

      This seems to be the same question as your post:

      https://forum.ansys.com/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)

Viewing 1 reply thread
  • You must be logged in to reply to this topic.