Optics Workbench

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
User avatar
Boogieman
Posts: 34
Joined: Wed Apr 18, 2018 9:03 am

Re: Optics Workbench

Post by Boogieman »

What happens if a dispersed ray hits another mirror or lens ?
I would not call the ray dispersed since its a bunch of rays that see a different "lens" each. So the calculations are pretty much unchanged only that the refraction index is now dependent on the ray, i.e. the rays wavelength property. So mirrors behave as usual.
Image
One thing i noticed on the way is, that the transparent lines dont work with colors. Thats why you see the opaque behavior at the mirror.
Also with a lens you always have two dispersions, when the ray enters the lens and when it exits the lens.
Hard to see in the images but that is already happening.
Did you already fork the OpticsWorkbench on Github ?
Not yet. I hope i will find some time today and tomorrow to do this. I would fork and make a pull request.
User avatar
christi
Posts: 208
Joined: Wed Oct 24, 2018 7:03 am
Location: Karlsruhe, Germany
Contact:

Re: Optics Workbench

Post by christi »

Very Cool !
drmacro
Veteran
Posts: 8983
Joined: Sun Mar 02, 2014 4:35 pm

Re: Optics Workbench

Post by drmacro »

sorry to bump my earlier post...but not comments or thoughts or instructions?

:?:
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
christi
Posts: 208
Joined: Wed Oct 24, 2018 7:03 am
Location: Karlsruhe, Germany
Contact:

Re: Optics Workbench

Post by christi »

drmacro wrote: Thu Aug 26, 2021 12:47 pm 1) When I open a file with optic elements I get:

Code: Select all

08:29:19  Traceback (most recent call last):
  File "/home/mac/.FreeCAD/Mod/OpticsWorkbench/Ray.py", line 53, in onChanged
    self.redrawRay(fp)
  File "/home/mac/.FreeCAD/Mod/OpticsWorkbench/Ray.py", line 85, in redrawRay
    insiders = self.isInsideLens(ray.Vertexes[0])
  File "/home/mac/.FreeCAD/Mod/OpticsWorkbench/Ray.py", line 271, in isInsideLens
    if obj.Shape.distToShape(Part.Vertex(vertex))[0] < EPSILON:
<class 'RuntimeError'>: BRepExtrema_DistShapeShape failed
2) When I change the Refraction index property. The first change automatically updates the refraction path of the ray. Sometimes, further changes in the index update the ray, sometimes not. (I have yet to tie down a repeatable sequence to replicate, sorry.)

3) The refraction path doesn't seem to work if the sketch is on other than the X, Y plane.

4) The lens container has a Placement object, but changes don't seem to have any effect. The Placement object of the contained sketch does move the sketch and effect the refraction path. (this is in a sketch on the X, Y plane; neither has any effect on a sketch on other planes.)

5) The default length of the Ray at 1 million make 3D view navigation a bit cumbersome and I always immediately set it to a more manageable 100. (obviously this would need to be increased based on the design of the lens system) Is/would it possible to set this default as a preference?
I added some of your reports to issued on Github. When they are solved, the issues will be closed.
1) see https://github.com/chbergmann/OpticsWorkbench/issues/10
2) see https://github.com/chbergmann/OpticsWorkbench/issues/12
3) see https://github.com/chbergmann/OpticsWorkbench/issues/11
4) Every FreeCAD object has a Placement property. It cannot be removed. Simply do not change it for lenses, mirrors and absorbers.
5) The best default value depends on the size of your design. 1000000 should always be big enough. 100 would be much to small for my parabolic mirror with 1,5m diameter. You can place an absorber box around your design to limit the ray length.
drmacro
Veteran
Posts: 8983
Joined: Sun Mar 02, 2014 4:35 pm

Re: Optics Workbench

Post by drmacro »

4) I understand every object has a Placement object. I guess I was asking which is the proper one to use to move the lens. So I guess the sketch placement is it. :)

thanks for adding the issues, I would have been happy to do so, but, I figured I needed to confirm whether it was just my naive use or ...misuse before doing so. :oops:
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
christi
Posts: 208
Joined: Wed Oct 24, 2018 7:03 am
Location: Karlsruhe, Germany
Contact:

Re: Optics Workbench

Post by christi »

A SunRay feature Image has been added to make it easier to use Boogiemans new dispersion feature.
drmacro
Veteran
Posts: 8983
Joined: Sun Mar 02, 2014 4:35 pm

Re: Optics Workbench

Post by drmacro »

Not sure what I've broken...
Snip macro screenshot-65c026.png
Snip macro screenshot-65c026.png (166.4 KiB) Viewed 3647 times

Code: Select all

10:14:33    File "/home/mac/.FreeCAD/Mod/OpticsWorkbench/Ray.py", line 238, in traceRay
    self.traceRay(fp, neworigin, linearray)
10:14:33    File "/home/mac/.FreeCAD/Mod/OpticsWorkbench/Ray.py", line 218, in traceRay
    if len(nearest_obj.Sellmeier) == 6:
10:14:33  AttributeError: 'FeaturePython' object has no attribute 'Sellmeier'
10:14:33  'FeaturePython' object has no attribute 'Sellmeier'
10:14:33  Traceback (most recent call last):
10:14:33    File "/home/mac/.FreeCAD/Mod/OpticsWorkbench/Ray.py", line 98, in redrawRay
    self.traceRay(fp, pos, linearray, True)
10:14:33    File "/home/mac/.FreeCAD/Mod/OpticsWorkbench/Ray.py", line 238, in traceRay
    self.traceRay(fp, neworigin, linearray)
10:14:33    File "/home/mac/.FreeCAD/Mod/OpticsWorkbench/Ray.py", line 238, in traceRay
    self.traceRay(fp, neworigin, linearray)
10:14:33    File "/home/mac/.FreeCAD/Mod/OpticsWorkbench/Ray.py", line 218, in traceRay
    if len(nearest_obj.Sellmeier) == 6:
10:14:33  AttributeError: 'FeaturePython' object has no attribute 'Sellmeier'
10:14:33  
And, is there a way to update optic objects after the workbench is updated? It seems I need to delete and re-add lens and beams.
Attachments
Explore-3.FCStd
(25.1 KiB) Downloaded 80 times
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
christi
Posts: 208
Joined: Wed Oct 24, 2018 7:03 am
Location: Karlsruhe, Germany
Contact:

Re: Optics Workbench

Post by christi »

drmacro wrote: Sun Aug 29, 2021 2:16 pm Not sure what I've broken...
And, is there a way to update optic objects after the workbench is updated? It seems I need to delete and re-add lens and beams.
Your objects were created by a non functional version of the workbench. There is no other way than deleting and re-creating the Optics Workbench objects. Sorry.
drmacro
Veteran
Posts: 8983
Joined: Sun Mar 02, 2014 4:35 pm

Re: Optics Workbench

Post by drmacro »

Thanks.

I just updated and re-added all the optic objects and it does seem to work now.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
Boogieman
Posts: 34
Joined: Wed Apr 18, 2018 9:03 am

Re: Optics Workbench

Post by Boogieman »

Ah, yes. This happens when you choose a non existing Material, which happened because now there are fewer Materials. And by luck/accident you saved a lens with one of theses materials.
Would be sufficient to just change the material.
Post Reply