Support

Changing the ray colors in a lens drawing

Written by Admin | Aug 30, 2021 4:00:00 AM

Question

I would like to change the colors of the rays that are drawn in the standard lens drawings. By default, green, blue, red,...etc. is chosen. How do I assign rays specific colors?

Synopsis

Changing the ray colors in a lens drawing

Solution

Note that fans of rays in lens drawings are drawn using a defined pen sequence. Each fan uses one pen in the sequence. When OSLO gets to the end of the pen sequence, the pen sequence is used again from the beginning. In order to change the colors for the rays in lens drawings, you need to change the pen sequence that is used. You can only change the colors from ray fan to ray fan. If you want to change the color of an individual ray, it is recommended that you draw that single ray as its own ray fan. First an exercise:  
  • Issue the command COLORS on the command line.
  • Note that the upper group of colors show all the colors that are pre-defined in OSLO.
  • Note that the lower group of colors shows the colors that are defined in the current (default) pen sequence
Remember that you can zoom in on any graphic by clicking the mouse and dragging a box shape where you would like to zoom into.   Descriptions of different ways to change the default pen sequence follow: Using Menus:  
  • Choose the OSLO menu item "File>>Preferences>>Preference Groups>>Graphics"
  • The "pen sequence control word" displays letters where a = color 0, b = color 1, ...etc. Fans of rays are drawn starting with the second letter in the sequence. When the sequence ends, it starts again with the first letter.
  • To make all rays black, set the "pen sequence control word" = a
  • To make all rays alternate between red and blue, set the "pen sequence control word" = cd
Again, note that for rays drawn in lens drawings, the first letter of the pen sequence is skipped the first time around.   Using Menus - an Alternate way:  
  • Choose the OSLO menu item "File>>Preferences>>Preference Groups>>Pen Sequence"
  • Choose a sampling of colors from the default OSLO colors
  • To make all rays black, set the values to "low limit" = 1, "high limit" = 1, "number of colors" = 1
  • To make the rays follow (roughly) the wavelength spectrum using a 20 pen sequence, set the values to "low limit" = 42, "high limit" = 106, "number of colors" = 20
Use the COLORS command to inspect the results of what this does to the pen sequence.   Using OSLO Commands: The pen sequence setting is set in OSLO preferences (graphics_pen_sequence). The easiest way to set this preference is to use the PENSEQ command.  
  • To make all rays black, use PENSEQ 1 1 1;
  • To make the rays follow (roughly) the wavelength spectrum using a 20 pen sequence, use PENSEQ 42 106 20;
Again, use the COLORS command to inspect the results of what this does to the pen sequence.