Files and reports
Save your work as a RayCrafter project. Use Zemax files to exchange designs with other programs.
Project files
File → Save and Save As write a project file, ending in .raycrafter; File → Open
reads one back. A project keeps the whole design: every lens with its full prescription, apertures and the aperture stop,
all fields and their colour settings, assemblies, locked gaps, the source and image planes, the detector, the back
aperture, your named designs and, for an imported design, the original Zemax file. (The Lock focus button is not saved.) Because each lens is stored in
full, a later change to the catalogue does not change a saved design.
The window title shows the project’s name and marks unsaved changes. RayCrafter asks before New, Open, Import or Quit would throw changes away.
File → Open Recent lists the last five files you opened, saved or imported.
File → New from Example starts from a ready-made design, such as a beam expander, a telescope or a microscope.
Importing Zemax files
File → Import ZMX replaces the design with the system in a .zmx file. RayCrafter works with whole
lenses, so the import is not exact: a dialog lists whatever was simplified. Read it. See
how lenses work compared with Zemax for what changes and what cannot be loaded.
- Some things are not imported yet: apertures on surfaces in air (you can add apertures yourself), the aperture stop setting (#106), and a detector. A finite object comes in as diverging beams rather than object points (#65).
- The original file is kept. When you save the project, it contains an exact copy of the ZMX file, the import notes and the design as it was first imported. This lets you see where a design came from, and lets a better importer read it again later. (Re-importing from the program is not possible yet.)
- The title says whether you have changed it, for example “Untitled (imported from lens.zmx, modified)”.
- Before you share a project, remember the original file is inside it. File → Save Without Original ZMX saves a project without that record; the design then no longer counts as imported.
Exporting to Zemax
File → Export ZMX writes a .zmx file. It does not save your design, because a ZMX file cannot
hold all of it:
- For beams, the width and vergence come from the selected field only. Every field angle and wavelength is written, but offsets and colours are not.
- A finite object is written with its distance, the selected point’s numerical aperture, and each point’s height as its distance from the axis.
- The aperture stop is written only while the fields fill it. Otherwise the first lens is written as the stop.
- Assemblies, locked gaps, part details, the detector (#105), the back aperture (#110) and named designs (#111) are not recorded. A set aperture is written, but RayCrafter does not read it back.
Exported files currently look wrong in Zemax (#9). Do not rely on them yet.
Exporting to CAD (STEP)
File → Export STEP writes the lenses, and rays if you want them, for CAD programs, where you can design the mounts. It needs an optional library; without it, RayCrafter says how to install it.
- Lenses. One solid for each glass element, with its two surfaces exact. A cemented or air-spaced lens is a sub-assembly of its elements.
- Rays. Choose how many for each field, or none. Each ray is a thin rod in its field’s colour, ending where it is blocked.
- Coordinates are the bench’s, in mm: z along the optical axis, y up in the side view.
- Not included: paraxial lenses, apertures and the detector. Edge flats and chamfers are not modelled, and the surfaces run to the clear diameter (#120).
User parts
A user part is a saved assembly, which may include apertures. Each is a small .raycrafter-part file in
your own data folder, so it is available in every design:
| macOS | ~/Library/Application Support/RayCrafter/parts |
| Windows | %APPDATA%\RayCrafter\parts |
| Linux | ~/.local/share/raycrafter/parts |
To share a part, copy its file into someone else’s folder. RayCrafter cannot yet rename or delete parts (#62). To delete one, delete its file.
Web report
View → Web report opens a page about the current design in your web browser: the first-order numbers, the ray diagram, an interactive 3D view and the analysis plots, with those that apply only sometimes (distortion, colour, glass losses and dispersion, the detector, where scanned beams cross) when they do. Click the ? beside a plot for an explanation of what it shows. The Tutorial switch adds the teaching overlays.
- It stays up to date. The page reloads itself after you change the design, at most every 10 seconds. It is served to your own computer only, and stops updating when RayCrafter closes.
- To keep or share it, click Save a copy to share on the page. The copy is a single file with the 3D view inside, which opens without RayCrafter or an internet connection.
From Python, write_report writes the report to a file.