iso10110.drawing#

ISO 10110 Element Drawing Generator

Rendering architecture#

Two isolated renderer classes handle format-specific output, sharing layout logic via _BaseRenderer:

  • _MatplotlibRenderer — PDF/PNG.

  • _DxfRenderer — DXF via ezdxf.

ElementDrawing is a thin public coordinator that delegates to whichever renderer save_pdf / save_dxf / save_png / show require. Neither renderer class is part of the public API.

Paper / orientation#

paper : “A5”,”A4”,”A3”,”A2”,”A1”,”LETTER”,”LEGAL”,”TABLOID” orientation : “portrait” (default) | “landscape”

Bernhard Lutzer, 2026

Functions

draw_element(element, spec[, element_index, ...])

Build and generate an ElementDrawing for element in one call.

dxf_to_png(dxf_path, png_path[, dpi])

Render a DXF file to PNG using ezdxf with a white background.

Classes

ElementDrawing(element, spec[, ...])

ISO 10110 fabrication drawing for one lens element.

class ElementDrawing(element, spec, element_index: int = 0, paper: str = 'A4', orientation: str = 'portrait', total_sheets: int = 1, rotational_axis_y: float = 0.0, style: DrawingStyle | None = None)[source]#

ISO 10110 fabrication drawing for one lens element.

Delegates all rendering to _MatplotlibRenderer (PDF/PNG) and _DxfRenderer (DXF). Rendering logic is fully isolated in those classes; this class handles only file-I/O and public API.

Parameters:
  • element – LensElement

  • spec – DrawingSpec

  • element_index – 0-based element number.

  • paper – Paper size string (default "A4").

  • orientation – "portrait" (default) or "landscape".

  • total_sheets – Total sheet count for X/Y numbering.

  • rotational_axis_y – y-offset (optical mm) of the rotational axis when it differs from the optical axis. Default 0.0 = coincident.

  • style – DrawingStyle font-size scale factors and border margin. Defaults to DrawingStyle(), reproducing the built-in appearance exactly.

generate() → ezdxf.document.Drawing[source]#

Build DXF document (for save_dxf).

save_dxf(path: str | Path) → None[source]#

Save native DXF file.

save_pdf(path: str | Path) → None[source]#

Save clean PDF via matplotlib.

save_png(path: str | Path, dpi: int = 200) → None[source]#

Save PNG via matplotlib.

show(figsize: tuple | None = None) → None[source]#

Display inline.

draw_element(element, spec, element_index: int = 0, paper: str = 'A4', orientation: str = 'portrait', style: DrawingStyle | None = None) → ElementDrawing[source]#

Build and generate an ElementDrawing for element in one call.

dxf_to_png(dxf_path: str | Path, png_path: str | Path, dpi: int = 200) → None[source]#

Render a DXF file to PNG using ezdxf with a white background.