Skip to main content

Tests

Optics Design Workbench

This workbench was inspired by the OpticsWorkbench and aims to extend its functionality towards design and optimization of optical assemblies.

The documentation is far from complete but growing.

Feel free to ask any question in the forum thread.

Installing the FreeCAD workbench

To make the Optics Design Workbench available in FreeCAD, install it using FreeCAD's built in addon manager.

Sometimes the latest version on github is not immediately recognized by the addon manger. To ensure to update to the latest version it may be necessary to uninstall the workbench, then refresh the local cache and install the workbench again.

Installing for usage in external python shells and jupyter notebooks

To install as a regular python package run

pip install optics_design_workbench

Note that from within the freecad python shell the workbench is available as a namespace package freecad.optics_design_workbench.

However it is uploaded to PyPi just as optics_design_workbench, i.e., not being part of the freecad namespace, because the freecad package is not pip-installable nor importable in non-freecad python interpreters (yet). It is therefore difficult to install the freecad namespace base package in virtual environments. The optics_design_workbench without the namespace component does not rely on the `freecad' package, therefore can be installed via pip in any virtual environment without any issue.

Feel free to open an issue if a less confusing way of organizing the package exists that allows both usage in FreeCAD as a workbench and installation in non-freecad python interpreters via pip.

Manual installation (without addon manager)

If you want to install without the addon manager, head to the releases section and download the zipped source of your version of choice. Extract the downloaded zip to the Mod folder of your FreeCAD installation. Make sure that the folder containing the init_gui.py is on the third subfolder level below the Mod directory like this:

..../Mod/freecad.optics_design_workbench-1.2.3/freecad/optics_design_workbench/init_gui.py

Development installation

Clone this repository, install the python module in development mode using pip install -e .. Create a symlink in your FreeCAD's Mod folder pointing to the directory of the cloned directory. With this setup, changes in the cloned repository folder will be effective immediately when restarting FreeCAD. Avoid using regular PyPi or addon manager installations in parallel with the development installation.

Getting started with examples

To get started, FCStd files and corresponding jupyter notebooks can be found in the examples folder of this repository.

Gaussian beam point source and detector

examples/1-source-and-detector

Ray-fan simulation mode

The ray-fan mode renders rays for cross-sections of the solid angle with a spacing matching the inverse power density of the light source. This mode renders fast and gives a good first impression where the optical power of your sources ends up.

ray-fan mode screenshot

Monte-Carlo simulation mode

In the Monte-Carlo simulation mode, rays are placed randomly in the full solid angle according to the given power density of the light source. If the simulation is run in continuous mode, recorded ray hits will be stored to disk and can be loaded and further analyzed with the accompanying notebook in the example folder.

monte-carlo mode screenshot

Spherical lens and parabolic mirror

examples/2-lens-and-mirror

Any geometric body in FreeCAD can become member of one of the OpticalGroups to turn them into reflective, refractive, absorbing or ray-detecting objects. This example contains spherical lenses and slotted parabolic mirrors, transparent and absorbing detectors. When running the continuous simulation, folders for all objects that have set Store Hits to true will be generated.

lens and mirror screenshot

Geometry parameter optimization

examples/3-parameter-sweeps

All parameters of the FreeCAD model are accessible from an external python shell through the jupyter_utils submodule. The recommended workflow is to use a jupyter notebook for such edits (hence the module name). The example shows a simple spherical lens, the radius of which is optimized to minimize the spot size on a detector.

Troubleshooting

When things don't work as expected first make sure you are actually running want you intend to run and whether the same workbench version is installed on the python and the FreeCAD side. To check this, run

import freecad.optics_design_workbench
freecad.optics_design_workbench.versionInfo()

in the FreeCAD python shell and

import optics_design_workbench
optics_design_workbench.versionInfo()

in your regular python shell of choice.

Make sure that the workbench versions seen by FreeCAD and by python match and that all the displayed versions and paths match your expectations.

Metadata

Release files for optics_design_workbench 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for optics_design_workbench 1.1.2
File Size Uploaded Provenance Actions
optics_design_workbench-1.1.2.tar.gz 2.6 MB Without provenance Details for optics_design_workbench-1.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for optics_design_workbench 1.1.2
File Interpreter ABI Platform Actions
optics_design_workbench-1.1.2-py3-none-any.whl Python 3 none any Details for optics_design_workbench-1.1.2-py3-none-any.whl

Total release size: 3.1 MB

Release files / optics_design_workbench-1.1.2.tar.gz

Download URL optics_design_workbench-1.1.2.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
8d880e1cea6cc1946ad7dbf3edc1d6c1df99fb2ae23eb9e670ca5a84366f19f2
BLAKE2b-256 checksum
How to use checksums
a04bfed19f76f6fdb22a5e1156912f2097c9b16c09690bdc8ede06138f8887d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / optics_design_workbench-1.1.2-py3-none-any.whl

Download URL optics_design_workbench-1.1.2-py3-none-any.whl
Size 492.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00aa54c318181c15fc48a0f298793e0a8c0b95493d17a85a32746f8e92af7d1f
BLAKE2b-256 checksum
How to use checksums
25d120026be6faaa449618733a1d3ced395ed9e144879669edd38edc65550b0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for optics_design_workbench 1.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page