瀏覽代碼

user guide update

Gilbert Brault 5 年之前
父節點
當前提交
e676388e11

二進制
jupysketch-doc/docs/images/github.png


二進制
jupysketch-doc/docs/images/github_small.png


+ 5 - 3
jupysketch-doc/docs/index.md

@@ -1,5 +1,7 @@
 # Welcome to Jupyter Sketcher Documentation
 
+[![](images/github_small.png)](https://github.com/gbrault/jupytersketcher)
+
 ## Problem solved
 
 When you need to solve a mechanical problem, sooner or later you are going to sketch a figure to capture problem's parameters and variables.
@@ -22,9 +24,9 @@ You can use the binder link in jupytersketcher Github to see some experiments wi
 ## pysketcher features
 
 * Drawing sketches on a matplotlib widget for Jupyter Notebook server or Lab
-* Defining a yaml based "grammar" to define sketches
-* Animating sketches within the notebook
+* Defining a yaml based "grammar" to define sketches and simplify reuse
+* Animating sketches within Jupyter notebooks
 
 ## Main benefit
 
-With Pysketcher for Jupyter mechanical notebooks, you get a single copy of the description of the problem and a space to simulate and show the user how the system behaves
+With Pysketcher for Jupyter mechanical notebooks, you get a single copy of the description of the problem which is as well a space to simulate and system behaviour

文件差異過大導致無法顯示
+ 13924 - 0
jupysketch-doc/docs/resources/DryFriction.html


文件差異過大導致無法顯示
+ 702 - 0
jupysketch-doc/docs/resources/DryFriction.ipynb


+ 72 - 37
jupysketch-doc/docs/sketcher.md

@@ -4,11 +4,14 @@ Pysketcher initial version [HPL Pysketcher]() enable sketch definition in python
 
 Due to the hierarchical nature of sketches, it is quite straightforward to think about using yaml as the syntax for defining a sketch.
 
-The benefits are as follow:
+Benefits are the following:
 
-* A leaner presentation of the sketch as only the data making sense is going to be used
-* A more straightforward reading of the composition hierachy
-* A more robust sketch definition as only a set of rules will be applied to define a sketch and no further python idiom will be intermingled
+* Leaner sketch writing as only data relevant to the context needs to be defined
+* A more straightforward reading for the same reason
+* A more robust sketch definition 
+    * The same set of rules is applied to generate a sketch
+    * No further python idiom is be intermingled as opposed to the case of python defined sketches
+    * Of course, data defined versus program defined there is no winner, it's just a matter of context
 
 ## Example
 
@@ -17,15 +20,23 @@ This example provides the yaml content to define the Dry Friction case
 ### The final sketch
 ![](images/dryfriction.png)
 
-An inclined plan (the A-B edge) supports a blue rectangle which is pulled donward by the gravity. The plan makes an angle $\theta$. The sketch design enable the $\theta$ angle to change. The whole plan including the body can rotate arround the point B.
+An inclined plan (the A-B edge) supports a blue rectangle which is dragged down by gravity. The plan makes an angle $\theta$ with the ground level. Sketch implementation notebook includes a controller enabling the $\theta$ angle to change. The whole plan, including the body, can rotate arround point B.
+
+### Support files
+
+The example we are developing now is based upon the "Dry Friction mockup" notebook
+
+* the rendered html version of the notbook can be viewed [here](resources/DryFriction.html)
+* the notebook can be download [here](resources/DryFriction.ipynb)
 
 ### The yaml definition
 
-Sketcher language is defined as a yaml compliant file or string. The yaml file is a dictionnary of 
+Sketcher language is defined as a yaml compliant file or string. The yaml file is a dictionnary of "objects". Objects can be regular python objects or sketcher objects.
+A skertcher object is composed as follow:
 
-* functionnal objects (leaf objects, like Rectangle, Circle, Line etc or composition)
-* extended with object style (line or fill colors, line stroke...)
-* to which transformation are applied (translation, rotation...)
+* **a formula**: it's a leaf object, like Rectangle, Circle, Line etc or a composition
+* **a style list**: line or fill colors, line stroke... declared as a yaml hierarchy
+* **a transformation list**: the defined object can be transformed using sketcher transformation: translation, rotation...
 
 As a general rule, a new object suppose all parameters to be defined before they are used to construct it.
 
@@ -39,11 +50,12 @@ The general layout of a sketcher file is as follow:
     * some "actions" corresponding to executable python sentences
         * One mandatory action is the setting of the drawing frame (drawing_tool.set_coordinate_system): it must be declared before any other pysketcher object is used.
         * Other use case of action is the setting of global parameters like default line color: (drawing_tool.set_linecolor('black')) for example
+    * this is stored in the head string thereafter
 * **Objects**
-    * Usually starting with the declaration of leaf simple objects
-    * then aggregated using the composition object
-    * Composition can be made of composition object
-    * grouping leafs and composition will be further used to apply transformation latter on (based on the "physics")
+    * Usually starting with the declaration of Pysketcher leaf objects
+    * Then aggregated using the composition object
+    * Composition can be made of composition object (recursive behaviour)
+    * Grouping leafs and composition will be further used to apply transformation latter on (based on the "physics")
     * The example presents three group of objects
         * The body object
         * The plan object
@@ -52,9 +64,9 @@ The general layout of a sketcher file is as follow:
     * The friction includes the plan (that will be able to rotate as a group) and the ground (will stay fixed)
 
 #### Libraries, Construction Variables, Frame
-```yaml
-libraries: ["from math import tan, radians, sin, cos",
-            "from pysketcher import *"]
+```python
+head = """\
+libraries: ["from math import tan, radians, sin, cos","from pysketcher import *"]
 fontsize: 18
 g: 9.81              # constant gravity
 theta: 30.0          # inclined plane angle
@@ -77,9 +89,11 @@ x: a + 3*L/10.
 y: help_line(x=x)    
 contact: point(x, y)    
 c: contact + rL/2*normal_vec
+"""
 ```
 #### The body object
-```yaml
+```python
+body="""\
 rectangle: 
     formula: Rectangle(contact, rl, rL)
     style:
@@ -91,21 +105,21 @@ N:
     formula: Force(contact - rl*normal_vec, contact, r'$N$', text_pos='start')
     style:
         linecolor: black
-mg: 
-    formula: Gravity(c, rl, text='$Mg$')
-    style:
-        linecolor: black
 wheel: 
     formula: "Composition({'outer': rectangle})"   
     style:
         shadow: 1
+mc:
+    formula: Text(r'$c$', c)
 body: 
-    formula: "Composition({'wheel': wheel, 'N': N, 'mg': mg})"
+    formula: "Composition({'wheel': wheel, 'N': N, 'mc': mc})"
     style:
         linecolor: black
+"""
 ```
 #### The plan object
-```yaml
+```python
+plan="""\
 mB:
     formula: Text(r'$B$',B)
 mA:
@@ -114,6 +128,24 @@ wall:
     formula: Wall(x=[A[0], B[0]], y=[A[1], B[1]], thickness=-0.25,transparent=False)
     style:
         linecolor: black    
+x_const: 
+    formula: Line(contact, contact + point(0,4))
+    style:
+        linestyle: dotted
+    transform: rotate(-theta, contact)
+x_axis: 
+    formula: "Axis(start=contact+ 2*rl*normal_vec, length=2*rl,label='$x$', rotation_angle=-theta)"
+plan: 
+    formula: "Composition({'body': body, 'inclined wall': wall, 'x start': x_const, 'x axis': x_axis, 'mA': mA, 'mB': mB})"
+"""
+```
+#### The friction sketch
+```python
+friction="""\
+mg: 
+    formula: Gravity(c, rl, text='$Mg$')
+    style:
+        linecolor: black
 angle: 
     formula: "Arc_wText(r'$<bslash>theta$', center=B, radius=3, start_angle=180-theta, arc_angle=theta, fontsize=fontsize)"
     style:
@@ -125,23 +157,26 @@ ground:
          linecolor: black
          linestyle: dashed
          linewidth: 1
-x_const: 
-    formula: Line(contact, contact + point(0,4))
-    style:
-        linestyle: dotted
-    transform: rotate(-theta, contact)
-x_axis: 
-    formula: "Axis(start=contact+ 2*rl*normal_vec, length=2*rl,label='$x$', rotation_angle=-theta)"
-plan: 
-    formula: "Composition({'body': body, 'angle': angle, 'inclined wall': wall, 'x start': x_const, 'x axis': x_axis, 'mA': mA, 'mB': mB})"
+friction: 
+    formula: "Composition({'plan': plan, 'ground': ground, 'mg': mg, 'angle': angle})"
+"""
 ```
-#### The friction main object
-```yaml
 
-friction: 
-    formula: "Composition({'plan': plan, 'ground': ground})"
+### Using the parser
+
+To parse the above example, the following code do the job.
+1. the head must be used first as all the other bits needs one or more variable it defines.
+2. After, any other string can be parsed, the order just need to respect precedence (if one object uses another one it must be parsed after)
+3. this setting allows naturally a modular definition of sketch objects
+
+```python
+myfig = {}
+sketchParse(head,myfig)
+sketchParse(body,myfig)
+sketchParse(plan,myfig)
+sketchParse(friction,myfig)
 ```
 
-### The hierarchy of the "friction" main object
+### "friction" sketch hierarchy
 
 ![](images/dotfriction.png)

二進制
jupysketch-doc/site/images/github.png


二進制
jupysketch-doc/site/images/github_small.png


+ 4 - 3
jupysketch-doc/site/index.html

@@ -314,6 +314,7 @@
                 
                 
                 <h1 id="welcome-to-jupyter-sketcher-documentation">Welcome to Jupyter Sketcher Documentation</h1>
+<p><a href="https://github.com/gbrault/jupytersketcher"><img alt="" src="images/github_small.png" /></a></p>
 <h2 id="problem-solved">Problem solved</h2>
 <p>When you need to solve a mechanical problem, sooner or later you are going to sketch a figure to capture problem's parameters and variables.</p>
 <p>The better documented, the easier the problem is to resolve for the designer, and the easier it is for others to understand how it is actually solved.</p>
@@ -327,11 +328,11 @@
 <h2 id="pysketcher-features">pysketcher features</h2>
 <ul>
 <li>Drawing sketches on a matplotlib widget for Jupyter Notebook server or Lab</li>
-<li>Defining a yaml based "grammar" to define sketches</li>
-<li>Animating sketches within the notebook</li>
+<li>Defining a yaml based "grammar" to define sketches and simplify reuse</li>
+<li>Animating sketches within Jupyter notebooks</li>
 </ul>
 <h2 id="main-benefit">Main benefit</h2>
-<p>With Pysketcher for Jupyter mechanical notebooks, you get a single copy of the description of the problem and a space to simulate and show the user how the system behaves</p>
+<p>With Pysketcher for Jupyter mechanical notebooks, you get a single copy of the description of the problem which is as well a space to simulate and system behaviour</p>
                 
               
               

文件差異過大導致無法顯示
+ 13924 - 0
jupysketch-doc/site/resources/DryFriction.html


文件差異過大導致無法顯示
+ 702 - 0
jupysketch-doc/site/resources/DryFriction.ipynb


文件差異過大導致無法顯示
+ 1 - 1
jupysketch-doc/site/search/search_index.json


二進制
jupysketch-doc/site/sitemap.xml.gz


+ 105 - 44
jupysketch-doc/site/sketcher/index.html

@@ -213,6 +213,13 @@
     The final sketch
   </a>
   
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#support-files" class="md-nav__link">
+    Support files
+  </a>
+  
 </li>
         
           <li class="md-nav__item">
@@ -245,8 +252,8 @@
 </li>
         
           <li class="md-nav__item">
-  <a href="#the-friction-main-object" class="md-nav__link">
-    The friction main object
+  <a href="#the-friction-sketch" class="md-nav__link">
+    The friction sketch
   </a>
   
 </li>
@@ -257,8 +264,15 @@
 </li>
         
           <li class="md-nav__item">
-  <a href="#the-hierarchy-of-the-friction-main-object" class="md-nav__link">
-    The hierarchy of the "friction" main object
+  <a href="#using-the-parser" class="md-nav__link">
+    Using the parser
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#friction-sketch-hierarchy" class="md-nav__link">
+    "friction" sketch hierarchy
   </a>
   
 </li>
@@ -330,6 +344,13 @@
     The final sketch
   </a>
   
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#support-files" class="md-nav__link">
+    Support files
+  </a>
+  
 </li>
         
           <li class="md-nav__item">
@@ -362,8 +383,8 @@
 </li>
         
           <li class="md-nav__item">
-  <a href="#the-friction-main-object" class="md-nav__link">
-    The friction main object
+  <a href="#the-friction-sketch" class="md-nav__link">
+    The friction sketch
   </a>
   
 </li>
@@ -374,8 +395,15 @@
 </li>
         
           <li class="md-nav__item">
-  <a href="#the-hierarchy-of-the-friction-main-object" class="md-nav__link">
-    The hierarchy of the "friction" main object
+  <a href="#using-the-parser" class="md-nav__link">
+    Using the parser
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#friction-sketch-hierarchy" class="md-nav__link">
+    "friction" sketch hierarchy
   </a>
   
 </li>
@@ -406,23 +434,35 @@
                 <h2 id="a-language-to-describe-a-sketch">A language to describe a sketch</h2>
 <p>Pysketcher initial version <a href="">HPL Pysketcher</a> enable sketch definition in python. HPL is showing the hierachical nature of sketches. This is implemented via the Composition function. One can further grasp this using the graphviz_dot function applied to discover the composition herarchy implemented as a graphviz image <a href="#the-hierarchy-of-the-friction-main-object">see The hierarchy of the "friction" main object</a> at the end of this page.</p>
 <p>Due to the hierarchical nature of sketches, it is quite straightforward to think about using yaml as the syntax for defining a sketch.</p>
-<p>The benefits are as follow:</p>
+<p>Benefits are the following:</p>
 <ul>
-<li>A leaner presentation of the sketch as only the data making sense is going to be used</li>
-<li>A more straightforward reading of the composition hierachy</li>
-<li>A more robust sketch definition as only a set of rules will be applied to define a sketch and no further python idiom will be intermingled</li>
+<li>Leaner sketch writing as only data relevant to the context needs to be defined</li>
+<li>A more straightforward reading for the same reason</li>
+<li>A more robust sketch definition <ul>
+<li>The same set of rules is applied to generate a sketch</li>
+<li>No further python idiom is be intermingled as opposed to the case of python defined sketches</li>
+<li>Of course, data defined versus program defined there is no winner, it's just a matter of context</li>
+</ul>
+</li>
 </ul>
 <h2 id="example">Example</h2>
 <p>This example provides the yaml content to define the Dry Friction case</p>
 <h3 id="the-final-sketch">The final sketch</h3>
 <p><img alt="" src="../images/dryfriction.png" /></p>
-<p>An inclined plan (the A-B edge) supports a blue rectangle which is pulled donward by the gravity. The plan makes an angle <span><span class="MathJax_Preview">\theta</span><script type="math/tex">\theta</script></span>. The sketch design enable the <span><span class="MathJax_Preview">\theta</span><script type="math/tex">\theta</script></span> angle to change. The whole plan including the body can rotate arround the point B.</p>
+<p>An inclined plan (the A-B edge) supports a blue rectangle which is dragged down by gravity. The plan makes an angle <span><span class="MathJax_Preview">\theta</span><script type="math/tex">\theta</script></span> with the ground level. Sketch implementation notebook includes a controller enabling the <span><span class="MathJax_Preview">\theta</span><script type="math/tex">\theta</script></span> angle to change. The whole plan, including the body, can rotate arround point B.</p>
+<h3 id="support-files">Support files</h3>
+<p>The example we are developing now is based upon the "Dry Friction mockup" notebook</p>
+<ul>
+<li>the rendered html version of the notbook can be viewed <a href="../resources/DryFriction.html">here</a></li>
+<li>the notebook can be download <a href="../resources/DryFriction.ipynb">here</a></li>
+</ul>
 <h3 id="the-yaml-definition">The yaml definition</h3>
-<p>Sketcher language is defined as a yaml compliant file or string. The yaml file is a dictionnary of </p>
+<p>Sketcher language is defined as a yaml compliant file or string. The yaml file is a dictionnary of "objects". Objects can be regular python objects or sketcher objects.
+A skertcher object is composed as follow:</p>
 <ul>
-<li>functionnal objects (leaf objects, like Rectangle, Circle, Line etc or composition)</li>
-<li>extended with object style (line or fill colors, line stroke...)</li>
-<li>to which transformation are applied (translation, rotation...)</li>
+<li><strong>a formula</strong>: it's a leaf object, like Rectangle, Circle, Line etc or a composition</li>
+<li><strong>a style list</strong>: line or fill colors, line stroke... declared as a yaml hierarchy</li>
+<li><strong>a transformation list</strong>: the defined object can be transformed using sketcher transformation: translation, rotation...</li>
 </ul>
 <p>As a general rule, a new object suppose all parameters to be defined before they are used to construct it.</p>
 <p><strong>For example, you can create a circle if the center and the radius have been defined earlier in the file.</strong></p>
@@ -436,13 +476,14 @@
 <li>Other use case of action is the setting of global parameters like default line color: (drawing_tool.set_linecolor('black')) for example</li>
 </ul>
 </li>
+<li>this is stored in the head string thereafter</li>
 </ul>
 </li>
 <li><strong>Objects</strong><ul>
-<li>Usually starting with the declaration of leaf simple objects</li>
-<li>then aggregated using the composition object</li>
-<li>Composition can be made of composition object</li>
-<li>grouping leafs and composition will be further used to apply transformation latter on (based on the "physics")</li>
+<li>Usually starting with the declaration of Pysketcher leaf objects</li>
+<li>Then aggregated using the composition object</li>
+<li>Composition can be made of composition object (recursive behaviour)</li>
+<li>Grouping leafs and composition will be further used to apply transformation latter on (based on the "physics")</li>
 <li>The example presents three group of objects<ul>
 <li>The body object</li>
 <li>The plan object</li>
@@ -455,8 +496,8 @@
 </li>
 </ul>
 <h4 id="libraries-construction-variables-frame">Libraries, Construction Variables, Frame</h4>
-<pre><code class="yaml">libraries: [&quot;from math import tan, radians, sin, cos&quot;,
-            &quot;from pysketcher import *&quot;]
+<pre><code class="python">head = &quot;&quot;&quot;\
+libraries: [&quot;from math import tan, radians, sin, cos&quot;,&quot;from pysketcher import *&quot;]
 fontsize: 18
 g: 9.81              # constant gravity
 theta: 30.0          # inclined plane angle
@@ -479,10 +520,12 @@ x: a + 3*L/10.
 y: help_line(x=x)    
 contact: point(x, y)    
 c: contact + rL/2*normal_vec
+&quot;&quot;&quot;
 </code></pre>
 
 <h4 id="the-body-object">The body object</h4>
-<pre><code class="yaml">rectangle: 
+<pre><code class="python">body=&quot;&quot;&quot;\
+rectangle: 
     formula: Rectangle(contact, rl, rL)
     style:
         linecolor: blue
@@ -493,22 +536,22 @@ N:
     formula: Force(contact - rl*normal_vec, contact, r'$N$', text_pos='start')
     style:
         linecolor: black
-mg: 
-    formula: Gravity(c, rl, text='$Mg$')
-    style:
-        linecolor: black
 wheel: 
     formula: &quot;Composition({'outer': rectangle})&quot;   
     style:
         shadow: 1
+mc:
+    formula: Text(r'$c$', c)
 body: 
-    formula: &quot;Composition({'wheel': wheel, 'N': N, 'mg': mg})&quot;
+    formula: &quot;Composition({'wheel': wheel, 'N': N, 'mc': mc})&quot;
     style:
         linecolor: black
+&quot;&quot;&quot;
 </code></pre>
 
 <h4 id="the-plan-object">The plan object</h4>
-<pre><code class="yaml">mB:
+<pre><code class="python">plan=&quot;&quot;&quot;\
+mB:
     formula: Text(r'$B$',B)
 mA:
     formula: Text(r'$A$', A)
@@ -516,6 +559,24 @@ wall:
     formula: Wall(x=[A[0], B[0]], y=[A[1], B[1]], thickness=-0.25,transparent=False)
     style:
         linecolor: black    
+x_const: 
+    formula: Line(contact, contact + point(0,4))
+    style:
+        linestyle: dotted
+    transform: rotate(-theta, contact)
+x_axis: 
+    formula: &quot;Axis(start=contact+ 2*rl*normal_vec, length=2*rl,label='$x$', rotation_angle=-theta)&quot;
+plan: 
+    formula: &quot;Composition({'body': body, 'inclined wall': wall, 'x start': x_const, 'x axis': x_axis, 'mA': mA, 'mB': mB})&quot;
+&quot;&quot;&quot;
+</code></pre>
+
+<h4 id="the-friction-sketch">The friction sketch</h4>
+<pre><code class="python">friction=&quot;&quot;&quot;\
+mg: 
+    formula: Gravity(c, rl, text='$Mg$')
+    style:
+        linecolor: black
 angle: 
     formula: &quot;Arc_wText(r'$&lt;bslash&gt;theta$', center=B, radius=3, start_angle=180-theta, arc_angle=theta, fontsize=fontsize)&quot;
     style:
@@ -527,24 +588,24 @@ ground:
          linecolor: black
          linestyle: dashed
          linewidth: 1
-x_const: 
-    formula: Line(contact, contact + point(0,4))
-    style:
-        linestyle: dotted
-    transform: rotate(-theta, contact)
-x_axis: 
-    formula: &quot;Axis(start=contact+ 2*rl*normal_vec, length=2*rl,label='$x$', rotation_angle=-theta)&quot;
-plan: 
-    formula: &quot;Composition({'body': body, 'angle': angle, 'inclined wall': wall, 'x start': x_const, 'x axis': x_axis, 'mA': mA, 'mB': mB})&quot;
+friction: 
+    formula: &quot;Composition({'plan': plan, 'ground': ground, 'mg': mg, 'angle': angle})&quot;
+&quot;&quot;&quot;
 </code></pre>
 
-<h4 id="the-friction-main-object">The friction main object</h4>
-<pre><code class="yaml">
-friction: 
-    formula: &quot;Composition({'plan': plan, 'ground': ground})&quot;
+<h3 id="using-the-parser">Using the parser</h3>
+<p>To parse the above example, the following code do the job.
+1. the head must be used first as all the other bits needs one or more variable it defines.
+2. After, any other string can be parsed, the order just need to respect precedence (if one object uses another one it must be parsed after)
+3. this setting allows naturally a modular definition of sketch objects</p>
+<pre><code class="python">myfig = {}
+sketchParse(head,myfig)
+sketchParse(body,myfig)
+sketchParse(plan,myfig)
+sketchParse(friction,myfig)
 </code></pre>
 
-<h3 id="the-hierarchy-of-the-friction-main-object">The hierarchy of the "friction" main object</h3>
+<h3 id="friction-sketch-hierarchy">"friction" sketch hierarchy</h3>
 <p><img alt="" src="../images/dotfriction.png" /></p>
                 
               

文件差異過大導致無法顯示
+ 254 - 104
notebooks/.ipynb_checkpoints/DryFriction-checkpoint.ipynb


+ 46 - 35
notebooks/DryFriction.ipynb

@@ -102,11 +102,11 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 8,
+   "execution_count": 9,
    "metadata": {},
    "outputs": [],
    "source": [
-    "gw = \"\"\"\\\n",
+    "head = \"\"\"\\\n",
     "libraries: [\"from math import tan, radians, sin, cos\",\"from pysketcher import *\"]\n",
     "fontsize: 18\n",
     "g: 9.81              # constant gravity\n",
@@ -130,6 +130,16 @@
     "y: help_line(x=x)    \n",
     "contact: point(x, y)    \n",
     "c: contact + rL/2*normal_vec\n",
+    "\"\"\""
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 11,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "body=\"\"\"\\\n",
     "rectangle: \n",
     "    formula: Rectangle(contact, rl, rL)\n",
     "    style:\n",
@@ -151,6 +161,16 @@
     "    formula: \"Composition({'wheel': wheel, 'N': N, 'mc': mc})\"\n",
     "    style:\n",
     "        linecolor: black\n",
+    "\"\"\"        "
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 15,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "plan=\"\"\"\\\n",
     "mB:\n",
     "    formula: Text(r'$B$',B)\n",
     "mA:\n",
@@ -168,6 +188,16 @@
     "    formula: \"Axis(start=contact+ 2*rl*normal_vec, length=2*rl,label='$x$', rotation_angle=-theta)\"\n",
     "plan: \n",
     "    formula: \"Composition({'body': body, 'inclined wall': wall, 'x start': x_const, 'x axis': x_axis, 'mA': mA, 'mB': mB})\"\n",
+    "\"\"\""
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 13,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "friction=\"\"\"\\\n",
     "mg: \n",
     "    formula: Gravity(c, rl, text='$Mg$')\n",
     "    style:\n",
@@ -197,16 +227,19 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 9,
+   "execution_count": 16,
    "metadata": {},
    "outputs": [],
    "source": [
-    "sketchParse(gw,myfig)"
+    "sketchParse(head,myfig)\n",
+    "sketchParse(body,myfig)\n",
+    "sketchParse(plan,myfig)\n",
+    "sketchParse(friction,myfig)"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 10,
+   "execution_count": 17,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -215,7 +248,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 11,
+   "execution_count": 18,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -224,7 +257,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 12,
+   "execution_count": 19,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -250,7 +283,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 13,
+   "execution_count": 25,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -269,7 +302,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 14,
+   "execution_count": 26,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -283,13 +316,13 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 15,
+   "execution_count": 27,
    "metadata": {},
    "outputs": [
     {
      "data": {
       "application/vnd.jupyter.widget-view+json": {
-       "model_id": "b6c156cd73a94a479f9a140bf3008ff0",
+       "model_id": "6b8bb6722f1a45efb06eee4679c28d48",
        "version_major": 2,
        "version_minor": 0
       },
@@ -307,7 +340,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 16,
+   "execution_count": 28,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -325,7 +358,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 17,
+   "execution_count": 29,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -339,28 +372,6 @@
     "Use left and right rotation button to rotate the sketch"
    ]
   },
-  {
-   "cell_type": "code",
-   "execution_count": 20,
-   "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "{'arc': {\n",
-       " 'arc': \"181 (x,y) coords linewidth=1\",},\n",
-       " 'text': 'text \"$\\\\theta$\" at (7.86863,0.987317)'}"
-      ]
-     },
-     "execution_count": 20,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
-   "source": [
-    "myfig['angle'].shapes"
-   ]
-  },
   {
    "cell_type": "markdown",
    "metadata": {},