to¶
- Surface.to(target_unit: str, inplace: bool = False) Surface
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¶
SurfaceConverted surface.
Raises
Examples
Surfaceinstantiation.>>> from gearpy.units import Surface >>> s = Surface(1, 'm^2') >>> s 1 m^2
Conversion from square meter to square millimeter with
inplace=Falseby default, so it does not override the current value.>>> s.to('mm^2') 1000000.0 mm^2 >>> s 1 m^2
Conversion from square meter to square millimeter with
inplace=True, in order to override the current value.>>> s.to('mm^2', inplace=True) 1000000.0 mm^2 >>> s 1000000.0 mm^2