Examples

Runnable examples that generate GDS outputs.

packages/examples currently provides two runnable examples:

  • straight_waveguide.gds
  • ring_coupler.gds

Generation command:

uv run --package laylight-examples laylight-examples --output-dir build/examples

If the workspace dependencies are not installed yet, you can also run:

PYTHONPATH=packages/core:packages/examples python -m laylight_examples --output-dir build/examples

Example Structure

The example code follows a simple pattern:

  1. Create a new Layout and top-level cell
  2. Instantiate a device from core
  3. Insert the device cell into the top-level cell
  4. Call layout.write() to export GDS

This pattern is a good base for more complex composition examples, such as:

  • Multi-segment waveguide routing
  • MZI structures
  • Tunable devices with heaters
  • Probe pad and routing examples

On this page