parse_dim_arg#

static GeometryOperators.parse_dim_arg(string, scale_to_unit=None, variable_manager=None)[source]#

Convert a number and unit to a float. Angles are converted in radians.

Parameters:
stringstr, optional

String to convert. For example, "2mm". The default is None.

scale_to_unitstr, optional

Units for the value to convert. For example, "mm".

variable_manageransys.aedt.core.application.variables.VariableManager, optional

Try to parse formula and returns numeric value. The default is None.

Returns:
float

Value for the converted value and units. For example, 0.002.

Examples

Parse ‘“2mm”’.

>>> from ansys.aedt.core.modeler.geometry_operators import GeometryOperators as go
>>> go.parse_dim_arg('2mm')
>>> 0.002

Use the optional argument scale_to_unit to specify the destination unit.

>>> go.parse_dim_arg('2mm', scale_to_unit='mm')
>>> 2.0