IConvertor¶
- class IConvertor¶
Bases:
ImpactCOMWrapperBase- Description:
Converts distances, angles, volumes, weigths and areas to and from strings.
Wraps a COM object or another wrapper instance. Accepts: - A valid impact_object - An existing impact_com_wrapper_base-derived instance
- property unit_settings¶
Gets unit_settings.
- Description:
Object that controls the formatting options used by the conversion methods. Note that you must create this object.
- Remarks:
If you wish to change the unit settings from the default values, you must first create an IUnitSettting object. For clarification, please see the example code. Introduced in Impact 5.1.4.21.
- Returns:
The value of unit_settings.
- Return type:
- Examples:
- angle_as_string(value)¶
- Description:
Converts an angle to a string.
- Remarks:
In an Application context angle_as_string respects the current value of angle_format in Application.units. In a Server context metric formatting is always used.
- Parameters:
value (float) – The value to convert.
- Examples:
- area_as_string(value)¶
- Description:
Converts an area to a string.
- Remarks:
In an Application context area_as_string respects the current value of distance_format in Application.units. In a Server context metric formatting is always used.
- Parameters:
value (float) – The value to convert.
- bytes_as_string(value, include_actual_bytes)¶
- Description:
Converts an integer value to the number of bytes (or kilobytes etc) in an easily-readable format.
- Remarks:
Introduced in Impact 8.0.0.21
- Returns:
A string, for example “1 KB” or “1 KB (1024 bytes)” for the value 1024.
- Parameters:
value (int) – The value to convert
include_actual_bytes (bool) – String to include the integer number of bytes as well.
- double_as_string(value)¶
- Description:
Converts a double to a string.
- Parameters:
value (float) – The value to convert.
- integer_as_string(value)¶
- Description:
Converts an integer to a string.
- Parameters:
value (int) – The value to convert.
- length_as_string(value)¶
- Description:
Converts a length to a string.
- Remarks:
In an Application context length_as_string respects the current value of distance_format in Application.units. In a Server context metric formatting is always used.
- Parameters:
value (float) – The value to convert.
- Examples:
- string_as_angle(string)¶
- Description:
Converts a string to an angle.
- Remarks:
In an Application context string_as_angle respects the current value of angle_format in Application.units. In a Server context metric formatting is always used.
- Parameters:
string (str) – The string to convert.
- string_as_area(string)¶
- Description:
Converts a string to an area.
- Remarks:
In an Application context string_as_area respects the current value of distance_format in Application.units. In a Server context metric formatting is always used.
- Parameters:
string (str) – The string to convert.
- string_as_double(string)¶
- Description:
Converts a string to a double.
- Parameters:
string (str) – The string to convert.
- string_as_integer(string)¶
- Description:
Converts a string to an integer.
- Parameters:
string (str) – The string to convert.
- string_as_length(string)¶
- Description:
Converts a string to a length.
- Remarks:
In an Application context string_as_length respects the current value of distance_format in Application.units. In a Server context metric formatting is always used.
- Parameters:
string (str) – The string to convert.
- string_as_volume(string)¶
- Description:
Converts a string to a volume.
- Parameters:
string (str) – The string to convert.
- string_as_weight(string)¶
- Description:
Converts a string to a weight.
- Parameters:
string (str) – The string to convert.
- volume_as_string(value)¶
- Description:
Converts a volume to a string.
- Parameters:
value (float) – The value to convert.
- weight_as_string(value)¶
- Description:
Converts a weight to a string.
- Parameters:
value (float) – The value to convert.