TOL
- compas.tolerance.TOL = Tolerance(unit='M', absolute=1e-09, relative=1e-06, angular=1e-06, approximation=0.001, precision=3, lineardeflection=0.001, angulardeflection=0.1)[source]
Tolerance settings for geometric operations.
- Parameters:
- unit{“M”, “MM”}, optional
The unit of the tolerance settings.
- absolutefloat, optional
The absolute tolerance. Default is
ABSOLUTE.- relativefloat, optional
The relative tolerance. Default is
RELATIVE.- angularfloat, optional
The angular tolerance. Default is
ANGULAR.- approximationfloat, optional
The tolerance used in approximation processes. Default is
APPROXIMATION.- precisionint, optional
The precision used when converting numbers to strings. Default is
PRECISION.- lineardeflectionfloat, optional
The maximum distance between a curve/surface and its polygonal approximation. Default is
LINEARDEFLECTION.- angulardeflectionfloat, optional
The maximum curvature deviation. Default is
ANGULARDEFLECTION.- namestr, optional
The name of the tolerance settings.
- Attributes:
- unit{“M”, “MM”}
The unit of the tolerance settings.
- absolutefloat
The absolute tolerance.
- relativefloat
The relative tolerance.
- angularfloat
The angular tolerance.
- approximationfloat
The tolerance used in approximation processes.
- precisionint
The precision used when converting numbers to strings. Positive numbers correspond to the number of digits after the decimal point. Negative numbers correspond to the number of digits before the decimal point. Zero corresponds to integer precision. Therefore, the higher the number the higher the precision.
- lineardeflectionfloat
The maximum distance between a curve or surface and its polygonal approximation.
Notes
The absolute tolerance is used to determine when a number is small enough to be considered zero. The relative tolerance determines the allowable deviation between two values for the values to be considered equal. The relative tolerance is defined as a fraction of one of the two values. This value is called the “true value”. By convention, the second value is considered the “true value” by the comparison functions of this class.
Each call to
Tolerance(...)creates an independent instance. To modify the global tolerance settings used throughout COMPAS, use the explicit methods onTOL:TOL.update(...)- Update specific tolerance valuesTOL.reset()- Reset all values to defaultsTOL.temporary(...)- Context manager for temporary changes
Examples
Create an independent tolerance instance:
>>> tol = Tolerance(absolute=0.01) >>> tol.absolute 0.01
The global TOL is separate:
>>> from compas.tolerance import TOL >>> TOL.absolute # unchanged 1e-09
Modify global state explicitly:
>>> TOL.update(absolute=0.001) >>> TOL.absolute 0.001 >>> TOL.reset()