From 071cac0088242970411c0096f90ad76b569f7852 Mon Sep 17 00:00:00 2001 From: Joaquin Matres <4514346+joamatab@users.noreply.github.com> Date: Sat, 14 Oct 2023 07:28:27 -0700 Subject: [PATCH 1/3] install gdsfactory cad --- notebooks/10_layout_full.ipynb | 36 ++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/notebooks/10_layout_full.ipynb b/notebooks/10_layout_full.ipynb index fbdbad0..067e05b 100644 --- a/notebooks/10_layout_full.ipynb +++ b/notebooks/10_layout_full.ipynb @@ -27,7 +27,7 @@ "try:\n", " import google.colab\n", " is_running_on_colab = True\n", - " !pip install gdsfactory klayout > /dev/null\n", + " !pip install gdsfactory[cad] > /dev/null\n", " \n", "except ImportError:\n", " is_running_on_colab = False" @@ -53,7 +53,7 @@ "outputs": [], "source": [ "import gdsfactory as gf\n", - "gf.CONF.display_type = 'klayout' # for plotting in Colab notebook" + "gf.CONF.display_type = 'klayout'" ] }, { @@ -100,17 +100,17 @@ "source": [ "import gdsfactory as gf\n", "\n", - "E = gf.components.ellipse(radii=(10, 5), layer=(1, 0))\n", - "R = gf.components.rectangle(size=[15, 5], layer=(2, 0))\n", - "C = gf.geometry.boolean(A=E, B=R, operation=\"not\", precision=1e-6, layer=(3, 0))\n", + "e = gf.components.ellipse(radii=(10, 5), layer=(1, 0))\n", + "r = gf.components.rectangle(size=[15, 5], layer=(2, 0))\n", + "b = gf.geometry.boolean(A=E, B=R, operation=\"not\", precision=1e-6, layer=(3, 0))\n", "# Other operations include 'and', 'or', 'xor', or equivalently 'A-B', 'B-A', 'A+B'\n", "\n", "# Plot the originals and the result\n", - "D = gf.Component(\"bool\")\n", - "D.add_ref(E)\n", - "D.add_ref(R).movey(-1.5)\n", - "D.add_ref(C).movex(30)\n", - "D.plot()" + "c = gf.Component(\"bool\")\n", + "c.add_ref(e)\n", + "c.add_ref(r).movey(-1.5)\n", + "c.add_ref(b).movex(30)\n", + "c.plot()" ] }, { @@ -412,6 +412,14 @@ "c.write_gds(\"demo.gds\", with_metadata=True)" ] }, + { + "cell_type": "markdown", + "id": "71ca1661", + "metadata": {}, + "source": [ + "You can also write it in OASIS format" + ] + }, { "cell_type": "code", "execution_count": null, @@ -424,6 +432,14 @@ "c.write_oas(\"demo.oas\")" ] }, + { + "cell_type": "markdown", + "id": "5fd055d9", + "metadata": {}, + "source": [ + "Or in STL for 3D printing or for integrating with other 3D CAD or simulation tools." + ] + }, { "cell_type": "code", "execution_count": null, From 676ee58ad55b3530afd46a00a27ed7c69f39b6c3 Mon Sep 17 00:00:00 2001 From: Joaquin Matres <4514346+joamatab@users.noreply.github.com> Date: Sat, 14 Oct 2023 07:30:26 -0700 Subject: [PATCH 2/3] fix installer for 10_layout notebook --- notebooks/10_layout.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/10_layout.ipynb b/notebooks/10_layout.ipynb index e62c8d5..6a550c0 100644 --- a/notebooks/10_layout.ipynb +++ b/notebooks/10_layout.ipynb @@ -24,7 +24,7 @@ "try:\n", " import google.colab\n", " is_running_on_colab = True\n", - " !pip install gdsfactory klayout > /dev/null\n", + " !pip install gdsfactory[cad] > /dev/null\n", " \n", "except ImportError:\n", " is_running_on_colab = False" From ebd811df473b7eab252b39c039bfce7a773b7a32 Mon Sep 17 00:00:00 2001 From: Joaquin Matres <4514346+joamatab@users.noreply.github.com> Date: Sat, 14 Oct 2023 07:46:11 -0700 Subject: [PATCH 3/3] fix boolean --- notebooks/10_layout_full.ipynb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/notebooks/10_layout_full.ipynb b/notebooks/10_layout_full.ipynb index 067e05b..3f301c9 100644 --- a/notebooks/10_layout_full.ipynb +++ b/notebooks/10_layout_full.ipynb @@ -69,9 +69,7 @@ "\n", "![](https://i.imgur.com/oeuKGsc.png)\n", "\n", - "In gdsfactory **all dimensions** are in **microns**\n", - "\n", - "based on [UCSB workshop](https://github.com/aisichenko/gdsfactory-workshop-ucsb) workshop" + "In gdsfactory **all dimensions** are in **microns**" ] }, { @@ -102,7 +100,7 @@ "\n", "e = gf.components.ellipse(radii=(10, 5), layer=(1, 0))\n", "r = gf.components.rectangle(size=[15, 5], layer=(2, 0))\n", - "b = gf.geometry.boolean(A=E, B=R, operation=\"not\", precision=1e-6, layer=(3, 0))\n", + "b = gf.geometry.boolean(e, r, operation=\"not\", precision=1e-6, layer=(3, 0))\n", "# Other operations include 'and', 'or', 'xor', or equivalently 'A-B', 'B-A', 'A+B'\n", "\n", "# Plot the originals and the result\n",