iso10110.spec#
ISO 10110 Drawing Specification Overlay
DrawingSpec is the user-facing bridge between an optiland Optic (which holds optical geometry) and the ISO 10110 drawing generator (which needs fabrication tolerances). It stores per-surface and per-element annotations that the optic itself does not carry.
Typical workflow#
spec = DrawingSpec(lens)
# Surface-level tolerances (designer fills these in)
spec.set_surface(1, irregularity=0.5, centration=0.5, imperfections="2x0.04")
spec.set_surface(2, irregularity=1.0, imperfections="1x0.063")
# Element-level glass quality (optician / procurement fills these in)
spec.set_element(0, bubbles="1x0.16", homogeneity_grade=2, striae_grade="A",
birefringence=10, part_number="OPT-001")
spec.save_yaml("lens_spec.yaml")
# later:
spec = DrawingSpec.load_yaml("lens_spec.yaml", lens)
Bernhard Lutzer, 2026
Classes
|
Fabrication annotation overlay for an optic. |
- class DrawingSpec(optic: Optic, project_name: str = '', organisation: str = '', reference_wavelength: float = 546.07)[source]#
Fabrication annotation overlay for an optic.
- Parameters:
optic – The optical system to annotate.
project_name – Optional project name printed in every title block.
- get_element_spec(element_index: int) ElementSpec[source]#
Return the
ElementSpecfor element_index, or a blank one.
- get_material_spec(element_index: int, component_index: int) ElementSpec[source]#
Return the
ElementSpecfor one glass component.Looks up the per-component spec set by
set_material(). Falls back to the element-level spec (get_element_spec()) when no per-component spec has been set, so singlet drawings continue to work without any API change.- Parameters:
element_index – 0-based index of the lens element.
component_index – 0-based index of the glass component within the element (0 for the first glass, 1 for the second, …).
- get_surface_spec(surface_index: int) SurfaceSpec[source]#
Return the
SurfaceSpecfor surface_index, or a blank one.
- classmethod load_yaml(path: str | Path, optic: Optic) DrawingSpec[source]#
Load a previously saved spec from path and attach to optic.
- Parameters:
path – YAML file written by
save_yaml().optic – The optic the spec should annotate.
- Returns:
A populated
DrawingSpecinstance.
- save_yaml(path: str | Path) None[source]#
Serialise spec annotations to a YAML file.
The file can be loaded back with
load_yaml()and handed to the same (or a reconstructed) optic.- Parameters:
path – Destination file path.
- set_element(element_index: int, **kwargs) None[source]#
Set ISO 10110 element-level specs for element_index.
Keyword arguments correspond to any
ElementSpecfield. Common examples:birefringence— 0/ stress birefringence in nm/cm (ISO 10110-2)bubbles— 1/ bubble-and-inclusion grade, e.g."1×0.16"(ISO 10110-3)nh_class— 2/ homogeneity, e.g."NH040"(ISO 10110-18)homogeneity_grade— legacy 0–5 integer grade (ISO 10110-4)striae_density— striae density class 1–5 (ISO 10110-4)striae_shadowgraph— striae shadowgraph class A–Dstriae_grade— legacy striae class string (backward compat)diameter,diameter_tolerance,ct_tolerance— dimensionsmatched_pair— True adds “M” marker to CT dimensionpart_number,revision,drawn_by,approved_by,notes— title block fields (see alsoset_title())
For cemented lenses where each glass component has its own quality requirements, use
set_material()to set per-component specs.Note this call replaces the entire element spec. If you also use
set_title(), callset_elementfirst, since a laterset_elementcall overwrites title-block fields set by an earlierset_titlecall for the same element_index.- Raises:
ValueError – If an unknown keyword is given (typo’d or renamed field name) or a value fails validation. See
ElementSpec.
- set_material(element_index: int, component_index: int, **kwargs) None[source]#
Set ISO 10110 material quality specs for one glass component.
Use this to specify independent 0/ (birefringence), 1/ (bubbles), and 2/ (homogeneity/striae) grades for each glass in a cemented lens.
For a singlet, component_index is always
0and this is equivalent to callingset_element(). For a cemented doublet, usecomponent_index=0for the crown andcomponent_index=1for the flint.The per-component spec takes precedence over the element-level spec set by
set_element()when the drawing is rendered.Keyword arguments correspond to
ElementSpecfields:birefringence,bubbles,homogeneity_grade,nh_class,striae_grade,striae_density,striae_shadowgraph. Title-block fields (part_number,revision, etc.) are only used from the element-level spec.- Raises:
ValueError – If an unknown keyword is given (typo’d or renamed field name) or a value fails validation. See
ElementSpec.
- set_surface(surface_index: int, **kwargs) None[source]#
Set ISO 10110 surface-level specs for surface_index.
Keyword arguments correspond to any
SurfaceSpecfield. Common examples:sag_tolerance,irregularity,rotationally_symmetric,test_wavelength,form_unit— 3/ surface form (ISO 10110-5)centration,centration_decentration,pyramid_error— 4/imperfections,coating_imperfections,scratches,edge_chips— 5/ (ISO 10110-7)laser_damage— 6/coating— 7/ (ISO 10110-9)roughness— 8/ (ISO 10110-8)r_tolerance,ca_diameter,ca_tolerance— dimensionschamfer,chamfer_angle,sharp_edge— edge treatmentwavefront_deformation— 13/ (ISO 10110-14)assembly_imperfections— 15/ (ISO 10110-7 §5.5)grating_type— ISO 10110-16 type symbol (for grating surfaces)
- Raises:
ValueError – If an unknown keyword is given (typo’d or renamed field name) or a value fails validation. See
SurfaceSpec.
- set_title(element_index: int, **kwargs) None[source]#
Set ISO 7200 title-block fields for element_index.
Keeps title-block metadata (who drew/approved a part, part number, revision, free-text notes) separate at the call site from the ISO 10110 optical-quality specs set via
set_element().Keyword arguments (all optional):
part_number— drawing/part identifierrevision— revision letter, defaults to"A"drawn_by— drafter initials/nameapproved_by— approver initials/namenotes— free-text note shown in the title block
This call is additive: it merges into any spec already set by
set_element()for the same element_index, rather than replacing it. Callset_element()first if you use both, sinceset_elementfully replaces the stored spec and would discard title-block fields set by an earlierset_titlecall.