Toolkit to read Zemax OpticStudio files.
Project description
ZmxTools
A toolkit to read Zemax files.
Currently this is limited to unpacking ZAR archives. To parse the files contained within the archive, e.g. ZMX or AGF glass files, please check out the following projects and packages:
- Optical ToolKit reads Zemax .zmx files.
- RayTracing reads Zemax .zmx files.
- Zemax Glass reads Zemax .agf files.
- Zemax Glass reads Zemax .agf files.
- RayOptics reads Zemax .zmx and CODE-V .seq files.
- RayOpt reads Zemax .zmx as well as OSLO files.
- OpticsPy does not read Zemax .zmx files but it reads CODE-V .seq files and glass information from data downloaded from https://www.refractiveindex.info/.
- OpticalGlass Reads glass manufacturer Excel sheets.
Features
- Unpack a Zemax OpticStudio Archive ZAR file using the
unzar
command. - Repack a ZAR file as a standard zip file using the
unzar -z
command. - Use as a pure Python 3 library.
- Fully typed with annotations and checked with mypy, PEP561 compatible
Installation
Prerequisites
- Python 3.6 (tested on Python 3.8)
- pip, the Python package manager
To install zmxtools
, just run the following command in a command shell:
pip install zmxtools
Usage
This package can be used directly from a terminal shell or from your own Python code.
Command line shell
The command unzar
is added to the path upon installation. It permits the extraction of the zar-file to a sub-directory
as well as its conversion to a standard zip-file. For example, extracting to the sub-directory mylens
is done using
unzar mylens.zar
Repacking the same zar-archive as a standard zip-archive mylens.zip
is done with:
unzar mylens.zar -z
Input and output can be specified.
unzar -h
unzar -i mylens.zar -o some/where/else/
More information and alternative options:
unzar -h
unzar -i mylens.zar -o some/where/else/
As a Python library
Extraction and repacking can be done programmatically as follows:
from zmxtools import zar
zar.extract('mylens.zar')
zar.repack('mylens.zar')
zar.read('mylens.zar')
Python pathlib.Path
objects can be used instead of strings.
Online
The latest version of the source code can be found on github: https://github.com/tttom/zmxtools
License
This code is distributed under the agpl3: GNU Affero General Public License
Credits
- Wouter Vermaelen for decoding the ZAR header and finding LZW compressed contents.
- Bertrand Bordage for sharing this gist.
- This project was generated with
wemake-python-package
. Current template version is: cfbc9ea21c725ba5b14c33c1f52d886cfde94416. See what is updated since then.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.