tolerancing.registry#
Tolerance Registry Module
This module contains the base class for tolerance types and the registry that
maps tolerance type names, as used by Tolerancing.add_tolerance, to their
classes. Register a ToleranceType subclass to add a new kind of tolerance
without changing core code.
Kramer Harrison, 2026
Classes
Registry of tolerance types, keyed by name. |
|
|
Applies a signed deviation from nominal to one property of an optic. |
- class ToleranceRegistry[source]#
Registry of tolerance types, keyed by name.
- get(name: str) type[ToleranceType][source]#
Return the class registered under
name.- Raises:
ValueError – If
nameis not registered.
- register(name: str, tolerance_cls: type[ToleranceType], overwrite: bool = False) None[source]#
Register a tolerance type.
- Parameters:
name – The name used in
Tolerancing.add_tolerance.tolerance_cls – A
ToleranceTypesubclass.overwrite – Replace an existing registration with the same name.
- Raises:
TypeError – If
tolerance_clsis not aToleranceTypesubclass.ValueError – If
nameis already registered andoverwriteis False.
- class ToleranceType(optic: Optic, **kwargs)[source]#
Applies a signed deviation from nominal to one property of an optic.
Subclasses read the nominal state in
__init__and must restore it exactly inreset.- Parameters:
optic – The optic the tolerance applies to.
**kwargs – Type-specific arguments, such as
surface_number.
- Variables:
phase (optiland.tolerancing.base.Phase) – The phase in which the deviation is applied.
units (str) – Units of the deviation, shown in docs and result tables.
- abstractmethod apply(delta: float) None[source]#
Apply a deviation from nominal.
- Parameters:
delta – The signed deviation, in
units.
- phase: Phase = 0#