trimesh.units
units.py
Deal with physical unit systems (i.e. inches, mm)
Very basic conversions, and no requirement for sympy.physics.units or pint.
- trimesh.units.unit_conversion(current, desired)
Calculate the conversion from one set of units to another.
- Parameters
current (str) – Unit system values are in now (eg ‘millimeters’)
desired (str) – Unit system we’d like values in (eg ‘inches’)
- Returns
conversion – Number to multiply by to put values into desired units
- Return type
float
- trimesh.units.units_from_metadata(obj, guess=True)
Try to extract hints from metadata and if that fails guess based on the object scale.
- Parameters
obj (object) – Has attributes ‘metadata’ (dict) and ‘scale’ (float)
guess (bool) – If metadata doesn’t indicate units, guess from scale
- Returns
units – A guess of what the units might be
- Return type
str