# Path: trimesh/constants.py
# class NumericalToleranceMesh(object):
# class NumericalResolutionMesh(object):
# class NumericalTolerancePath(object):
# class NumericalResolutionPath(object):
# class MeshError(Exception):
# class TransformError(Exception):
#     def __init__(self, **kwargs):
#     def __init__(self, **kwargs):
#     def __init__(self, **kwargs):
#     def __init__(self, **kwargs):
# def _log_time(method):
#     def timed(*args, **kwargs):


from .constants import log
    Wild ass guess for the units of a drawing or model, based on the scale.
    '''
    if scale > 100.0:
        return 'millimeters'
    else:
        return 'inches'


def _set_units(obj, desired, guess):
    '''
    Given an object that has units and vertices attributes convert units.

    Arguments
    ---------
    obj:     object with units and vertices (eg Path or Trimesh)
    desired: units desired (eg 'inches')
    guess:   boolean, whether we are allowed to guess the units of the document
             if they are not specified.
    '''
    desired = str(desired)
    if not validate(desired):
        raise ValueError(desired + ' are not a valid unit!')

    if obj.units is None:
        if guess:
            obj.units = unit_guess(obj.scale)
            log.warning('No units specified, guessing units are %s',
                        obj.units)
        else:
            raise ValueError('No units specified and not allowed to guess!')

# Path: trimesh/constants.py
# class NumericalToleranceMesh(object):
# class NumericalResolutionMesh(object):
# class NumericalTolerancePath(object):
# class NumericalResolutionPath(object):
# class MeshError(Exception):
# class TransformError(Exception):
#     def __init__(self, **kwargs):
#     def __init__(self, **kwargs):
#     def __init__(self, **kwargs):
#     def __init__(self, **kwargs):
# def _log_time(method):
#     def timed(*args, **kwargs):


# Path: trimesh/units.py
from .constants import log

    Wild ass guess for the units of a drawing or model, based on the scale.
    '''
    if scale > 100.0:
        return 'millimeters'
    else:
        return 'inches'


def _set_units(obj, desired, guess):
    '''
    Given an object that has units and vertices attributes convert units.

    Arguments
    ---------
    obj:     object with units and vertices (eg Path or Trimesh)
    desired: units desired (eg 'inches')
    guess:   boolean, whether we are allowed to guess the units of the document
             if they are not specified.
    '''
    desired = str(desired)
    if not validate(desired):
        raise ValueError(desired + ' are not a valid unit!')

    if obj.units is None:
        if guess:
            obj.units = unit_guess(obj.scale)
            log.warning('No units specified, guessing units are %s',
                        obj.units)
        else:
            raise ValueError('No units specified and not allowed to guess!')

    log.info('Converting units from %s to %s', obj.units, desired)