Tolerance.temporary
- Tolerance.temporary(unit=None, absolute=None, relative=None, angular=None, approximation=None, precision=None, lineardeflection=None, angulardeflection=None)[source]
Context manager for temporarily changing tolerance settings.
The original settings are automatically restored when the context exits, even if an exception occurs.
- Parameters:
- unit{“M”, “MM”}, optional
The unit of the tolerance settings.
- absolutefloat, optional
The absolute tolerance.
- relativefloat, optional
The relative tolerance.
- angularfloat, optional
The angular tolerance.
- approximationfloat, optional
The tolerance used in approximation processes.
- precisionint, optional
The precision used when converting numbers to strings.
- lineardeflectionfloat, optional
The maximum distance between a curve/surface and its polygonal approximation.
- angulardeflectionfloat, optional
The maximum curvature deviation.
- Yields:
ToleranceThe tolerance instance with temporary settings applied.
Examples
>>> from compas.tolerance import TOL >>> TOL.absolute 1e-09 >>> with TOL.temporary(absolute=0.01): ... TOL.absolute 0.01 >>> TOL.absolute 1e-09