Skip to content

Determining the correct syntax for OSLO commands

Question

I want to use an OSLO command in a CCL macro I am writing. How do I make sure that the command has the correct syntax?

Synopsis

Determining the correct syntax for OSLO commands

Solution

There are at least four different ways to determine the correct syntax of an OSLO command. In order to keep this article from becomming excessively long, only two of the ways will be described in full detail:
  1. Looking up the command name in the online help: If you type in keywords under the Search tab of the online help, you will see all online help pages that contain those words. In the list of topics, the pages that have named in Title case (example: "Trace Reference Ray") are overview pages that describe the topic. Pages that are listed all in lower case (example: "trr - trace_ref_ray"), are a complete listing of the meaning, usage and arguments of a command. This command description is very useful for understanding what a command does, but reading and understanding how the argument list works can be easy for some short commands and tedious for longer commands. If you are just starting with OSLO programming, we recommend one of the other methods for reliably getting the syntax of a command.
  2. Look at how the command is saved in a lens file: All commands contained within a *.LEN or *.OSL lens file are automatically formatted with the correct CCL syntax. But since some OSLO commands are not saved with the lens file, this is not a consistent method to determine command syntax.
  3. Issue a command from one of the OSLO menus or toolbars: then examine the command line for the correct syntax of the command.

    EXAMPLE: Load any lens into OSLO and trace a single ray using the TRA icon from the Standard Toolbar in the Text (TW) window. A "Trace single ray" dialog will open to specify the parameters that control the ray trace. Go ahead and choose different parameters for the ray trace and when you are done, click on the "OK" button at the bottom of the dialog. The ray trace will proceed as you determined (the output will write to the text window). Now open up the command line history list by clicking on the small black triangle on the right side of the "blank" command line. The top line of the command history contains the correctly formatted command for the ray trace you just performed. If you chose the default parameters for the ray trace, the top line of the command history will look as follows: tra std loc srf usr 0.0 0.0 0 0 n 1Note that you can directly edit this command (i.e. change numerical arguments) and hit the <Enter> key to execute the ray trace again. When you are happy with the command, you can copy and paste the command into your macro CCL file. You can also replace some of the arguments with variables if you choose.
  4. Use the forced prompt operator: In OSLO, the question mark (?) is a forced prompt operator. Simply issue a command on the command line followed by a question mark and OSLO will be forced to query you for each argument of the command even if default arguments are defined.EXAMPLE: Type the following command on the command line followed by the <Enter> key: tra? Now answer the questions that you are asked for each argument. When you are done, the correctly formatted command will be at the top of the command history list as in item #3.
When you paste the formatted command into your CCL macro, please remember to place a semi-colon (;) at the end of each command.