to¶
- Torque.to(target_unit: str, inplace: bool = False) Torque
It converts actual
valueto a new value computed usingtarget_unitas the reference unit of measurement.If
inplaceisTrue, it overrides actualvalueandunit, otherwise it returns a new instance with the convertedvalueand thetarget_unitasunit.Parameters¶
Returns¶
TorqueConverted torque.
Raises
Examples
Torqueinstantiation.>>> from gearpy.units import Torque >>> T = Torque(1, 'Nm') >>> T ... 1 Nm
Conversion from newton-meter to kilogram force-meter with
inplace = Falseby default, so it does not override the current value.>>> T.to('kgfm') ... 0.10197162129779283 kgfm >>> T ... 1 Nm
Conversion from newton-meter to kilogram force-meter with
inplace = True, in order to override the current value.>>> T.to('kgfm', inplace = True) ... 0.10197162129779283 kgfm >>> T ... 0.10197162129779283 kgfm