value_with_units#

Mechanical.value_with_units(value, units=None, units_system='Length')#

Combine a number and a string containing the modeler length unit in a single string e.g. “1.2mm”. If the units are not specified, the model units are used. If value is a string (like containing an expression), it is returned as is.

Parameters:
valuefloat, int, str

Value of the number or string containing an expression.

unitsstr, optional

Units to combine with value. Valid values are defined in the native API documentation. Some common examples are: “in”: inches “cm”: centimeter “um”: micron “mm”: millimeter “meter”: meters “mil”: 0.001 inches (mils) “km”: kilometer “ft”: feet

units_systemstr, optional

Unit system. Default is “Length”.

Returns:
str

String that combines the value and the units (e.g. “1.2mm”).