OpticsWorkbench icon indicating copy to clipboard operation
OpticsWorkbench copied to clipboard

Reflections on a curved mirror only work for one row of rays, but fail with a second column

Open chbergmann opened this issue 10 months ago • 3 comments

Problem description see https://forum.freecad.org/viewtopic.php?t=59860&start=220#p809729

Switching on the lights will cause a RuntimeError

22:40:52 File "/home/christi/.local/share/FreeCAD/Mod/OpticsWorkbench/./Ray.py", line 558, in traceRay isec_struct = self.getIntersections(fp, line) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 22:40:52 File "/home/christi/.local/share/FreeCAD/Mod/OpticsWorkbench/./Ray.py", line 385, in getIntersections dist_to_face = vert.distToShape(face) ^^^^^^^^^^^^^^^^^^^^^^ 22:40:52 RuntimeError:

chbergmann avatar Feb 09 '25 21:02 chbergmann

The workbench itself is programmed in Python, but it makes use of a C++ library called opencascade. The workbench calculates the intersection points of a ray segment with all faces of all optical objects and picks out the nearest one. vert is one of the intersection points and face is the curved face of a mirror. distToShape() is a call to the opencascade library. It throws an exception. I do not know why. I tried to wrap the call with a try catch block to let the program be continued, but from this point on the calculations for the rays are wrong

chbergmann avatar Feb 09 '25 21:02 chbergmann

I've redone the CAD file from scratch and now the whole thing works as expected. I guess it comes from my initial geometry but I can't figure out what is different.

https://forum.freecad.org/viewtopic.php?p=811914#p811914

fflipski avatar Feb 18 '25 03:02 fflipski

Well, it didn't last long. after playing more with the same file, it does crash now. It almost looks like the CAD package is getting corrupted of some sort. I am lost here.

fflipski avatar Feb 19 '25 01:02 fflipski