{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# S-Bend Routing\n\nThis example demonstrates how to use :py:class:`i3.ConnectSBend<ipkiss3.all.ConnectSBend>`\nto route between two optical ports that are slightly offset but facing each other.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import ipkiss3.all as i3\n\nwg = i3.Waveguide()\n\ncircuit = i3.Circuit(\n    specs=[\n        i3.Inst([\"wg1\", \"wg2\"], wg),\n        i3.Place(\"wg1\", (0.0, 0.0)),\n        i3.Place(\"wg2\", (50.0, 20.0)),\n        i3.ConnectSBend(\n            \"wg1:out\", \"wg2:in\", sbend_type=i3.SBendType.Sine, min_bend_radius=10.0, connection_name=\"my_sbend\"\n        ),\n    ],\n)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Visualizing the layout\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "layout = circuit.Layout()\nfig = layout.visualize(annotate=True, show=False)\nfig.savefig(\"plot_connect_sbend.png\")"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.14.0"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}