chbergmann / OpticsWorkbench

GNU Lesser General Public License v3.0
69 stars 23 forks source link

previously saved file, error after reopening and resimulating. #24

Closed Durksz closed 2 years ago

Durksz commented 2 years ago

Dear Developers,

I'm trying to make some lightguides for directing led-light to a different spot. the Optics workbench works great for this.

I found an error though, When i create a model with a 2d or 3d beam, it initially works great. But when I perform the following steps the resimulation fails:

  1. save newly created file
  2. close FreeCAD
  3. reopen FreeCAD
  4. open the previously created file.
  5. open the optics workbench
  6. press restart simulation
  7. error occurs:

    File "C:\Users\310038536\AppData\Roaming\FreeCAD\Mod\OpticsWorkbench\Ray.py", line 55, in execute self.redrawRay(fp) File "C:\Users\310038536\AppData\Roaming\FreeCAD\Mod\OpticsWorkbench\Ray.py", line 70, in redrawRay if isOpticalObject(optobj): <class 'NameError'>: name 'isOpticalObject' is not defined

It appears that the optics workbench is not loaded properly first time.

A workaround for this:

  1. Create a new beam object in the same or new file.
  2. this wil load the Optics workbench properly and now the beam created by the previous session also works again.

the system I'm using OS: Windows 10 Version 1909 Word size of OS: 64-bit Word size of FreeCAD: 64-bit Version: 0.19.24272 (Git) Build type: Release Branch: releases/FreeCAD-0-19 Hash: 27b568e4e474f8b020203a7190b4db2afe5c8cc5 Python version: 3.8.6+ Qt version: 5.15.1 Coin version: 4.0.1 OCC version: 7.5.0 Locale: Western Frisian/Netherlands (fy_NL)

This also occurs when using the 0.20 development version.

chbergmann commented 2 years ago

I fixed it

Durksz commented 2 years ago

Great Thanks! I tested it it works!