소스 검색

documenting

Gilbert Brault 5 년 전
부모
커밋
460a29f955

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 58 - 0
jupysketch-doc/docs/reference.md


+ 2 - 1
jupysketch-doc/mkdocs.yml

@@ -1,8 +1,9 @@
 site_name: Jypyter Sketcher
 nav:
     - Home: index.md
-    - Sketcher definition: sketcher.md 
     - About: about.md
+    - Sketcher definition: sketcher.md
+    - Sketcher reference: reference.md
 theme:
   name: material
 markdown_extensions:

+ 26 - 19
notebooks/.ipynb_checkpoints/Introduction-checkpoint.ipynb

@@ -20,22 +20,7 @@
    "cell_type": "code",
    "execution_count": 2,
    "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "application/vnd.jupyter.widget-view+json": {
-       "model_id": "cdd175d1ec004dbc872477df56bde58f",
-       "version_major": 2,
-       "version_minor": 0
-      },
-      "text/plain": [
-       "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
-      ]
-     },
-     "metadata": {},
-     "output_type": "display_data"
-    }
-   ],
+   "outputs": [],
    "source": [
     "from pysketcher import *\n",
     "\n",
@@ -68,9 +53,31 @@
     "ground = Wall(x=[R, xmax], y=[0, 0], thickness=-0.3*R)\n",
     "\n",
     "fig = Composition({'vehicle': vehicle, 'ground': ground})\n",
-    "fig.draw()  # send all figures to plotting backend\n",
-    "\n",
-    "drawing_tool.display()"
+    "fig.draw()  # send all figures to plotting backend"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 3,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "application/vnd.jupyter.widget-view+json": {
+       "model_id": "f410cc4d6ed04658bfdee411622e6e60",
+       "version_major": 2,
+       "version_minor": 0
+      },
+      "text/plain": [
+       "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    }
+   ],
+   "source": [
+    "drawing_tool.mpl.gcf().canvas"
    ]
   },
   {

+ 26 - 18
notebooks/.ipynb_checkpoints/Oscillator1-checkpoint.ipynb

@@ -20,22 +20,7 @@
    "cell_type": "code",
    "execution_count": 2,
    "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "application/vnd.jupyter.widget-view+json": {
-       "model_id": "6ec245ab35354ff8895a58636abc2368",
-       "version_major": 2,
-       "version_minor": 0
-      },
-      "text/plain": [
-       "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
-      ]
-     },
-     "metadata": {},
-     "output_type": "display_data"
-    }
-   ],
+   "outputs": [],
    "source": [
     "\"\"\"Draw mechanical vibration system.\"\"\"\n",
     "\n",
@@ -90,8 +75,31 @@
     "    'text_m': text_m, 'text_ku': text_ku,\n",
     "    'x_axis': x_axis, 'x_axis_start': x_axis_start})\n",
     "\n",
-    "fig.draw()\n",
-    "drawing_tool.display()"
+    "fig.draw()"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 3,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "application/vnd.jupyter.widget-view+json": {
+       "model_id": "5b6519e875354bbf82e2356bcf09d158",
+       "version_major": 2,
+       "version_minor": 0
+      },
+      "text/plain": [
+       "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    }
+   ],
+   "source": [
+    "drawing_tool.mpl.gcf().canvas"
    ]
   },
   {

+ 105 - 19
notebooks/.ipynb_checkpoints/pendulum1-checkpoint.ipynb

@@ -16,17 +16,35 @@
    "outputs": [
     {
      "data": {
-      "application/vnd.jupyter.widget-view+json": {
-       "model_id": "e995955f250e4a19b807f8758599660c",
-       "version_major": 2,
-       "version_minor": 0
-      },
       "text/plain": [
-       "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
+       "{\n",
+       "'body': {\n",
+       "    'arc': \"181 (x,y) coords fillcolor='b' fillpattern=''\",},\n",
+       "'rod': {\n",
+       "    'line': \"2 (x,y) coords\",},\n",
+       "'vertical': {\n",
+       "    'line': \"2 (x,y) coords linecolor='k' linewidth=1 linestyle='dashed'\",},\n",
+       "'theta': {\n",
+       "    'arc': {\n",
+       "        'arc': \"181 (x,y) coords\",},\n",
+       "    'text': \"Text at (1.49593,4.58745)\",},\n",
+       "'path': {\n",
+       "    'arc': \"181 (x,y) coords linecolor='k' linewidth=1 linestyle='dashed'\",},\n",
+       "'g': {\n",
+       "    'arrow': {\n",
+       "        'line': \"2 (x,y) coords linecolor='k' arrow='->'\",},\n",
+       "    'text': \"Text at (5,4.11333)\",},\n",
+       "'L': {\n",
+       "    'arrow': {\n",
+       "        'arrow': {\n",
+       "            'line': \"2 (x,y) coords linecolor='k' linewidth=1 arrow='<->'\",},},\n",
+       "    'text': \"Text at (2.93892,4.31343)\",},\n",
+       "'m': \"Text at (4.53533,1.73676)\",}"
       ]
      },
+     "execution_count": 2,
      "metadata": {},
-     "output_type": "display_data"
+     "output_type": "execute_result"
     }
    ],
    "source": [
@@ -80,8 +98,7 @@
     "     'vertical': vertical, 'theta': angle, 'path': path,\n",
     "     'g': gravity, 'L': length, 'm': mass_symbol})\n",
     "\n",
-    "fig.draw()\n",
-    "drawing_tool.display()"
+    "fig.draw()"
    ]
   },
   {
@@ -90,11 +107,57 @@
    "metadata": {},
    "outputs": [
     {
-     "name": "stdin",
-     "output_type": "stream",
-     "text": [
-      "Press Return to make free body diagram:  \n"
-     ]
+     "data": {
+      "application/vnd.jupyter.widget-view+json": {
+       "model_id": "18d9de304de444c197579e4b6bd668be",
+       "version_major": 2,
+       "version_minor": 0
+      },
+      "text/plain": [
+       "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    }
+   ],
+   "source": [
+    "drawing_tool.mpl.gcf().canvas"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 4,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "{\n",
+       "'mg': {\n",
+       "    'arrow': {\n",
+       "        'line': \"2 (x,y) coords arrow='->'\",},\n",
+       "    'text': \"Text at (4.21394,0.949778)\",},\n",
+       "'S': {\n",
+       "    'arrow': {\n",
+       "        'line': \"2 (x,y) coords arrow='->'\",},\n",
+       "    'text': \"Text at (3.32263,3.45652)\",},\n",
+       "'rod': {\n",
+       "    'line': \"2 (x,y) coords linecolor='k' linewidth=1 linestyle='dashed'\",},\n",
+       "'vertical': {\n",
+       "    'line': \"2 (x,y) coords linecolor='k' linewidth=1 linestyle='dashed'\",},\n",
+       "'theta': {\n",
+       "    'arc': {\n",
+       "        'arc': \"181 (x,y) coords\",},\n",
+       "    'text': \"Text at (1.35342,4.97898)\",},\n",
+       "'body': {\n",
+       "    'arc': \"181 (x,y) coords fillcolor='b' fillpattern=''\",},\n",
+       "'m': \"Text at (4.53533,1.73676)\",}"
+      ]
+     },
+     "execution_count": 4,
+     "metadata": {},
+     "output_type": "execute_result"
     }
    ],
    "source": [
@@ -128,13 +191,36 @@
     "     'vertical': vertical2, 'theta': angle2,\n",
     "     'body': mass, 'm': mass_symbol})\n",
     "\n",
-    "body_diagram.draw()\n",
-    "drawing_tool.display('Free body diagram')"
+    "body_diagram.draw()"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 4,
+   "execution_count": 5,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "application/vnd.jupyter.widget-view+json": {
+       "model_id": "18d9de304de444c197579e4b6bd668be",
+       "version_major": 2,
+       "version_minor": 0
+      },
+      "text/plain": [
+       "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    }
+   ],
+   "source": [
+    "drawing_tool.mpl.gcf().canvas"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 6,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -144,7 +230,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": 7,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -156,7 +242,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 6,
+   "execution_count": 8,
    "metadata": {},
    "outputs": [],
    "source": [

+ 26 - 19
notebooks/Introduction.ipynb

@@ -20,22 +20,7 @@
    "cell_type": "code",
    "execution_count": 2,
    "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "application/vnd.jupyter.widget-view+json": {
-       "model_id": "cdd175d1ec004dbc872477df56bde58f",
-       "version_major": 2,
-       "version_minor": 0
-      },
-      "text/plain": [
-       "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
-      ]
-     },
-     "metadata": {},
-     "output_type": "display_data"
-    }
-   ],
+   "outputs": [],
    "source": [
     "from pysketcher import *\n",
     "\n",
@@ -68,9 +53,31 @@
     "ground = Wall(x=[R, xmax], y=[0, 0], thickness=-0.3*R)\n",
     "\n",
     "fig = Composition({'vehicle': vehicle, 'ground': ground})\n",
-    "fig.draw()  # send all figures to plotting backend\n",
-    "\n",
-    "drawing_tool.display()"
+    "fig.draw()  # send all figures to plotting backend"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 3,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "application/vnd.jupyter.widget-view+json": {
+       "model_id": "f410cc4d6ed04658bfdee411622e6e60",
+       "version_major": 2,
+       "version_minor": 0
+      },
+      "text/plain": [
+       "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    }
+   ],
+   "source": [
+    "drawing_tool.mpl.gcf().canvas"
    ]
   },
   {

+ 26 - 18
notebooks/Oscillator1.ipynb

@@ -20,22 +20,7 @@
    "cell_type": "code",
    "execution_count": 2,
    "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "application/vnd.jupyter.widget-view+json": {
-       "model_id": "6ec245ab35354ff8895a58636abc2368",
-       "version_major": 2,
-       "version_minor": 0
-      },
-      "text/plain": [
-       "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
-      ]
-     },
-     "metadata": {},
-     "output_type": "display_data"
-    }
-   ],
+   "outputs": [],
    "source": [
     "\"\"\"Draw mechanical vibration system.\"\"\"\n",
     "\n",
@@ -90,8 +75,31 @@
     "    'text_m': text_m, 'text_ku': text_ku,\n",
     "    'x_axis': x_axis, 'x_axis_start': x_axis_start})\n",
     "\n",
-    "fig.draw()\n",
-    "drawing_tool.display()"
+    "fig.draw()"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 3,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "application/vnd.jupyter.widget-view+json": {
+       "model_id": "5b6519e875354bbf82e2356bcf09d158",
+       "version_major": 2,
+       "version_minor": 0
+      },
+      "text/plain": [
+       "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    }
+   ],
+   "source": [
+    "drawing_tool.mpl.gcf().canvas"
    ]
   },
   {

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 606 - 0
notebooks/Reference.ipynb


+ 105 - 19
notebooks/pendulum1.ipynb

@@ -16,17 +16,35 @@
    "outputs": [
     {
      "data": {
-      "application/vnd.jupyter.widget-view+json": {
-       "model_id": "e995955f250e4a19b807f8758599660c",
-       "version_major": 2,
-       "version_minor": 0
-      },
       "text/plain": [
-       "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
+       "{\n",
+       "'body': {\n",
+       "    'arc': \"181 (x,y) coords fillcolor='b' fillpattern=''\",},\n",
+       "'rod': {\n",
+       "    'line': \"2 (x,y) coords\",},\n",
+       "'vertical': {\n",
+       "    'line': \"2 (x,y) coords linecolor='k' linewidth=1 linestyle='dashed'\",},\n",
+       "'theta': {\n",
+       "    'arc': {\n",
+       "        'arc': \"181 (x,y) coords\",},\n",
+       "    'text': \"Text at (1.49593,4.58745)\",},\n",
+       "'path': {\n",
+       "    'arc': \"181 (x,y) coords linecolor='k' linewidth=1 linestyle='dashed'\",},\n",
+       "'g': {\n",
+       "    'arrow': {\n",
+       "        'line': \"2 (x,y) coords linecolor='k' arrow='->'\",},\n",
+       "    'text': \"Text at (5,4.11333)\",},\n",
+       "'L': {\n",
+       "    'arrow': {\n",
+       "        'arrow': {\n",
+       "            'line': \"2 (x,y) coords linecolor='k' linewidth=1 arrow='<->'\",},},\n",
+       "    'text': \"Text at (2.93892,4.31343)\",},\n",
+       "'m': \"Text at (4.53533,1.73676)\",}"
       ]
      },
+     "execution_count": 2,
      "metadata": {},
-     "output_type": "display_data"
+     "output_type": "execute_result"
     }
    ],
    "source": [
@@ -80,8 +98,7 @@
     "     'vertical': vertical, 'theta': angle, 'path': path,\n",
     "     'g': gravity, 'L': length, 'm': mass_symbol})\n",
     "\n",
-    "fig.draw()\n",
-    "drawing_tool.display()"
+    "fig.draw()"
    ]
   },
   {
@@ -90,11 +107,57 @@
    "metadata": {},
    "outputs": [
     {
-     "name": "stdin",
-     "output_type": "stream",
-     "text": [
-      "Press Return to make free body diagram:  \n"
-     ]
+     "data": {
+      "application/vnd.jupyter.widget-view+json": {
+       "model_id": "18d9de304de444c197579e4b6bd668be",
+       "version_major": 2,
+       "version_minor": 0
+      },
+      "text/plain": [
+       "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    }
+   ],
+   "source": [
+    "drawing_tool.mpl.gcf().canvas"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 4,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "{\n",
+       "'mg': {\n",
+       "    'arrow': {\n",
+       "        'line': \"2 (x,y) coords arrow='->'\",},\n",
+       "    'text': \"Text at (4.21394,0.949778)\",},\n",
+       "'S': {\n",
+       "    'arrow': {\n",
+       "        'line': \"2 (x,y) coords arrow='->'\",},\n",
+       "    'text': \"Text at (3.32263,3.45652)\",},\n",
+       "'rod': {\n",
+       "    'line': \"2 (x,y) coords linecolor='k' linewidth=1 linestyle='dashed'\",},\n",
+       "'vertical': {\n",
+       "    'line': \"2 (x,y) coords linecolor='k' linewidth=1 linestyle='dashed'\",},\n",
+       "'theta': {\n",
+       "    'arc': {\n",
+       "        'arc': \"181 (x,y) coords\",},\n",
+       "    'text': \"Text at (1.35342,4.97898)\",},\n",
+       "'body': {\n",
+       "    'arc': \"181 (x,y) coords fillcolor='b' fillpattern=''\",},\n",
+       "'m': \"Text at (4.53533,1.73676)\",}"
+      ]
+     },
+     "execution_count": 4,
+     "metadata": {},
+     "output_type": "execute_result"
     }
    ],
    "source": [
@@ -128,13 +191,36 @@
     "     'vertical': vertical2, 'theta': angle2,\n",
     "     'body': mass, 'm': mass_symbol})\n",
     "\n",
-    "body_diagram.draw()\n",
-    "drawing_tool.display('Free body diagram')"
+    "body_diagram.draw()"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 4,
+   "execution_count": 5,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "application/vnd.jupyter.widget-view+json": {
+       "model_id": "18d9de304de444c197579e4b6bd668be",
+       "version_major": 2,
+       "version_minor": 0
+      },
+      "text/plain": [
+       "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    }
+   ],
+   "source": [
+    "drawing_tool.mpl.gcf().canvas"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 6,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -144,7 +230,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": 7,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -156,7 +242,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 6,
+   "execution_count": 8,
    "metadata": {},
    "outputs": [],
    "source": [

+ 281 - 0
notebooks/reference_doc.ipynb

@@ -0,0 +1,281 @@
+{
+ "cells": [
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "# Reference as the documentation"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "## Setup"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 1,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    " %matplotlib widget"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 2,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "from pysketcher import *"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 3,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "drawing_tool.set_coordinate_system(xmin=-10, xmax=10,ymin=-10, ymax=10,axis=True)"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "## Extra steps for YAML"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 5,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "head = \"\"\"\\\n",
+    "libraries: [\"from math import tan, radians, sin, cos\",\"from pysketcher import *\"]\n",
+    "\"\"\"\n",
+    "myfig={}\n",
+    "sketchParse(head,myfig)"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "## Canvas"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 4,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "application/vnd.jupyter.widget-view+json": {
+       "model_id": "c09c8559c92e4ef58b02b319e363044f",
+       "version_major": 2,
+       "version_minor": 0
+      },
+      "text/plain": [
+       "Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    }
+   ],
+   "source": [
+    "drawing_tool.mpl.gcf().canvas"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "## Line"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "### YAML"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 14,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "line=\"\"\"\n",
+    "A: point(-5,-5)\n",
+    "B: point(5,5)\n",
+    "line: Line(A,B)\n",
+    "\"\"\"\n",
+    "drawing_tool.erase()\n",
+    "sketchParse(line,myfig)\n",
+    "# replace 'object' by the actual one\n",
+    "d = myfig['line'].draw() \n",
+    "drawing_tool.display()"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "### Python"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "drawing_tool.erase()\n",
+    "A = point(-5,-5)\n",
+    "B = point(5,5)\n",
+    "line = Line(A,B)\n",
+    "line.draw()\n",
+    "drawing_tool.display()"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "## Rectangle"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "### YAML"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 12,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "rectangle=\"\"\"\n",
+    "L: 8\n",
+    "h: 5\n",
+    "p: point(-(L/2),-(h/2))\n",
+    "rectangle: Rectangle(p,L,h)\n",
+    "\"\"\"\n",
+    "drawing_tool.erase()\n",
+    "sketchParse(rectangle,myfig)\n",
+    "# replace 'object' by the actual one\n",
+    "d = myfig['rectangle'].draw() \n",
+    "drawing_tool.display()"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "### Python"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 10,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "drawing_tool.erase()\n",
+    "L = 8\n",
+    "h = 5\n",
+    "p = point(-(L/2),-(h/2))\n",
+    "rectangle = Rectangle(p,L,h)\n",
+    "rectangle.draw()\n",
+    "drawing_tool.display()"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "## Circle"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "### YAML"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 13,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "circle=\"\"\"\n",
+    "circle: Circle(point(0,0),5)\n",
+    "\"\"\"\n",
+    "drawing_tool.erase()\n",
+    "sketchParse(circle,myfig)\n",
+    "# replace 'object' by the actual one\n",
+    "d = myfig['circle'].draw() \n",
+    "drawing_tool.display()"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "### Python"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 15,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "drawing_tool.erase()\n",
+    "circle = Circle(point(0,0),5)\n",
+    "circle.draw()\n",
+    "drawing_tool.display()"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": []
+  }
+ ],
+ "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.8.5"
+  }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
+}