Skip to content

Commit

Permalink
feat: enhance LensInfoViewer to check for __str__ method existence in…
Browse files Browse the repository at this point in the history
… geometry
  • Loading branch information
HarrisonKramer committed Jan 26, 2025
1 parent 81e3223 commit d8f28de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion optiland/visualization/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ def view(self):
surf_type = []
for surf in self.optic.surface_group.surfaces:
g = surf.geometry
if hasattr(g, '__str__') and g.__str__ is not object.__str__:

# check if __str__ method exists
if type(g).__dict__.get('__str__'):
surf_type.append(str(surf.geometry))
else:
raise ValueError('Unknown surface type')
Expand Down

0 comments on commit d8f28de

Please sign in to comment.