mjmiddle
Ansys Employee

 

When your python code sets the value, you have to get the current unit and convert:

    import units
    #toUnit = ExtAPI.DataModel.CurrentUnitFromQuantityName(“Length”)
    toUnit = result.Properties[“MyProperty”].GetCurrentUnit()    # assuming unit=”Length” in property in XML
    fromUnit = ‘m'
    result.Properties[“MyProperty”].Value = units.ConvertUnit(2.54, fromUnit, toUnit)