Jelajahi Sumber

User guide documentation

Gilbert Brault 5 tahun lalu
induk
melakukan
366d8143b0

File diff ditekan karena terlalu besar
+ 369 - 0
jupysketch-doc/docs/reference/dashpot.svg


File diff ditekan karena terlalu besar
+ 360 - 0
jupysketch-doc/docs/reference/spring.svg


+ 44 - 0
jupysketch-doc/docs/shapereference.md

@@ -20,6 +20,8 @@
 - [Moment](#moment): defines a Moment arrow with text given text, center and radius
 - [Text_wArrow](#text_warrow): defines Text, but an arrow is drawn from the mid part of the text to some point arrow_tip
 - [Wheel](#wheel): defines Hub and spokes Wheel given center, radius, spokes (default 10), inner_radius(default 1/5 of radius)
+- [Spring](#spring): defines a vertical spring, starting at start and with length as total vertical length
+- [Dashpot](#dashpot): defines a vertical dashpot of height `total_length` and `start` as bottom/starting point.
 
 ## Line
 [home](#list-of-shapes) Defines a line providing start and end point
@@ -378,6 +380,48 @@ wheel.set_name("wheel")
 ```
 ![Wheel](reference/wheel.svg)
 
+## Spring
+[home](#list-of-shapes) Specify a vertical spring, starting at start and with length as total vertical length
+
+### Yaml
+```yaml
+spring="""
+name: spring
+shapes: 
+    spring: 
+       formula: Spring(point(0,0),5)
+       style:
+           linecolor: black
+           linewidth: 1
+"""
+```
+### Python
+```python
+spring = Spring(point(0,0),5)
+spring.set_linecolor('black')
+spring.set_linewidth(1)
+spring.set_name("spring")
+```
+![Spring](reference/spring.svg)
+
+## Dashpot
+[home](#list-of-shapes) Defines a vertical dashpot of height `total_length` and `start` as bottom/starting point.
+
+### Yaml
+```yaml
+dashpot="""
+name: dashpot
+shapes:
+    dashpot: Dashpot(point(0,0),5)
+"""
+```
+### Python
+```python
+dashpot = Dashpot(point(0,0),5)
+dashpot.set_name("dashpot")
+```
+![Dashpot](reference/dashpot.svg)
+
 [home](#list-of-shapes) In order to display the various shapes, use the following code in a jupyter notebook
 
 

File diff ditekan karena terlalu besar
+ 354 - 0
jupysketch-doc/site/reference/curve.svg


File diff ditekan karena terlalu besar
+ 369 - 0
jupysketch-doc/site/reference/dashpot.svg


File diff ditekan karena terlalu besar
+ 368 - 0
jupysketch-doc/site/reference/gravity.svg


File diff ditekan karena terlalu besar
+ 366 - 0
jupysketch-doc/site/reference/moment.svg


File diff ditekan karena terlalu besar
+ 360 - 0
jupysketch-doc/site/reference/spring.svg


File diff ditekan karena terlalu besar
+ 365 - 0
jupysketch-doc/site/reference/textwarrow.svg


File diff ditekan karena terlalu besar
+ 390 - 0
jupysketch-doc/site/reference/wheel.svg


File diff ditekan karena terlalu besar
+ 1 - 1
jupysketch-doc/site/search/search_index.json


+ 515 - 12
jupysketch-doc/site/shapereference/index.html

@@ -588,11 +588,11 @@
 </li>
       
         <li class="md-nav__item">
-  <a href="#code-to-display-the-above-defined-shapes" class="md-nav__link">
-    Code to display the above defined shapes
+  <a href="#curve" class="md-nav__link">
+    Curve
   </a>
   
-    <nav class="md-nav" aria-label="Code to display the above defined shapes">
+    <nav class="md-nav" aria-label="Curve">
       <ul class="md-nav__list">
         
           <li class="md-nav__item">
@@ -612,6 +612,189 @@
       </ul>
     </nav>
   
+</li>
+      
+        <li class="md-nav__item">
+  <a href="#gravity" class="md-nav__link">
+    Gravity
+  </a>
+  
+    <nav class="md-nav" aria-label="Gravity">
+      <ul class="md-nav__list">
+        
+          <li class="md-nav__item">
+  <a href="#yaml_14" class="md-nav__link">
+    Yaml
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#python_14" class="md-nav__link">
+    Python
+  </a>
+  
+</li>
+        
+      </ul>
+    </nav>
+  
+</li>
+      
+        <li class="md-nav__item">
+  <a href="#code-to-display-the-above-defined-shapes" class="md-nav__link">
+    Code to display the above defined shapes
+  </a>
+  
+</li>
+      
+        <li class="md-nav__item">
+  <a href="#moment" class="md-nav__link">
+    Moment
+  </a>
+  
+    <nav class="md-nav" aria-label="Moment">
+      <ul class="md-nav__list">
+        
+          <li class="md-nav__item">
+  <a href="#yaml_15" class="md-nav__link">
+    Yaml
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#python_15" class="md-nav__link">
+    Python
+  </a>
+  
+</li>
+        
+      </ul>
+    </nav>
+  
+</li>
+      
+        <li class="md-nav__item">
+  <a href="#text_warrow" class="md-nav__link">
+    Text_wArrow
+  </a>
+  
+    <nav class="md-nav" aria-label="Text_wArrow">
+      <ul class="md-nav__list">
+        
+          <li class="md-nav__item">
+  <a href="#yaml_16" class="md-nav__link">
+    Yaml
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#python_16" class="md-nav__link">
+    Python
+  </a>
+  
+</li>
+        
+      </ul>
+    </nav>
+  
+</li>
+      
+        <li class="md-nav__item">
+  <a href="#wheel" class="md-nav__link">
+    Wheel
+  </a>
+  
+    <nav class="md-nav" aria-label="Wheel">
+      <ul class="md-nav__list">
+        
+          <li class="md-nav__item">
+  <a href="#yaml_17" class="md-nav__link">
+    Yaml
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#python_17" class="md-nav__link">
+    Python
+  </a>
+  
+</li>
+        
+      </ul>
+    </nav>
+  
+</li>
+      
+        <li class="md-nav__item">
+  <a href="#spring" class="md-nav__link">
+    Spring
+  </a>
+  
+    <nav class="md-nav" aria-label="Spring">
+      <ul class="md-nav__list">
+        
+          <li class="md-nav__item">
+  <a href="#yaml_18" class="md-nav__link">
+    Yaml
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#python_18" class="md-nav__link">
+    Python
+  </a>
+  
+</li>
+        
+      </ul>
+    </nav>
+  
+</li>
+      
+        <li class="md-nav__item">
+  <a href="#dashpot" class="md-nav__link">
+    Dashpot
+  </a>
+  
+    <nav class="md-nav" aria-label="Dashpot">
+      <ul class="md-nav__list">
+        
+          <li class="md-nav__item">
+  <a href="#yaml_19" class="md-nav__link">
+    Yaml
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#python_19" class="md-nav__link">
+    Python
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#yaml_20" class="md-nav__link">
+    Yaml
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#python_20" class="md-nav__link">
+    Python
+  </a>
+  
+</li>
+        
+      </ul>
+    </nav>
+  
 </li>
       
     </ul>
@@ -1003,11 +1186,11 @@
 </li>
       
         <li class="md-nav__item">
-  <a href="#code-to-display-the-above-defined-shapes" class="md-nav__link">
-    Code to display the above defined shapes
+  <a href="#curve" class="md-nav__link">
+    Curve
   </a>
   
-    <nav class="md-nav" aria-label="Code to display the above defined shapes">
+    <nav class="md-nav" aria-label="Curve">
       <ul class="md-nav__list">
         
           <li class="md-nav__item">
@@ -1027,6 +1210,189 @@
       </ul>
     </nav>
   
+</li>
+      
+        <li class="md-nav__item">
+  <a href="#gravity" class="md-nav__link">
+    Gravity
+  </a>
+  
+    <nav class="md-nav" aria-label="Gravity">
+      <ul class="md-nav__list">
+        
+          <li class="md-nav__item">
+  <a href="#yaml_14" class="md-nav__link">
+    Yaml
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#python_14" class="md-nav__link">
+    Python
+  </a>
+  
+</li>
+        
+      </ul>
+    </nav>
+  
+</li>
+      
+        <li class="md-nav__item">
+  <a href="#code-to-display-the-above-defined-shapes" class="md-nav__link">
+    Code to display the above defined shapes
+  </a>
+  
+</li>
+      
+        <li class="md-nav__item">
+  <a href="#moment" class="md-nav__link">
+    Moment
+  </a>
+  
+    <nav class="md-nav" aria-label="Moment">
+      <ul class="md-nav__list">
+        
+          <li class="md-nav__item">
+  <a href="#yaml_15" class="md-nav__link">
+    Yaml
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#python_15" class="md-nav__link">
+    Python
+  </a>
+  
+</li>
+        
+      </ul>
+    </nav>
+  
+</li>
+      
+        <li class="md-nav__item">
+  <a href="#text_warrow" class="md-nav__link">
+    Text_wArrow
+  </a>
+  
+    <nav class="md-nav" aria-label="Text_wArrow">
+      <ul class="md-nav__list">
+        
+          <li class="md-nav__item">
+  <a href="#yaml_16" class="md-nav__link">
+    Yaml
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#python_16" class="md-nav__link">
+    Python
+  </a>
+  
+</li>
+        
+      </ul>
+    </nav>
+  
+</li>
+      
+        <li class="md-nav__item">
+  <a href="#wheel" class="md-nav__link">
+    Wheel
+  </a>
+  
+    <nav class="md-nav" aria-label="Wheel">
+      <ul class="md-nav__list">
+        
+          <li class="md-nav__item">
+  <a href="#yaml_17" class="md-nav__link">
+    Yaml
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#python_17" class="md-nav__link">
+    Python
+  </a>
+  
+</li>
+        
+      </ul>
+    </nav>
+  
+</li>
+      
+        <li class="md-nav__item">
+  <a href="#spring" class="md-nav__link">
+    Spring
+  </a>
+  
+    <nav class="md-nav" aria-label="Spring">
+      <ul class="md-nav__list">
+        
+          <li class="md-nav__item">
+  <a href="#yaml_18" class="md-nav__link">
+    Yaml
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#python_18" class="md-nav__link">
+    Python
+  </a>
+  
+</li>
+        
+      </ul>
+    </nav>
+  
+</li>
+      
+        <li class="md-nav__item">
+  <a href="#dashpot" class="md-nav__link">
+    Dashpot
+  </a>
+  
+    <nav class="md-nav" aria-label="Dashpot">
+      <ul class="md-nav__list">
+        
+          <li class="md-nav__item">
+  <a href="#yaml_19" class="md-nav__link">
+    Yaml
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#python_19" class="md-nav__link">
+    Python
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#yaml_20" class="md-nav__link">
+    Yaml
+  </a>
+  
+</li>
+        
+          <li class="md-nav__item">
+  <a href="#python_20" class="md-nav__link">
+    Python
+  </a>
+  
+</li>
+        
+      </ul>
+    </nav>
+  
 </li>
       
     </ul>
@@ -1063,7 +1429,13 @@
 <li><a href="#arrow1">Arrow1</a>: defines a line with arrow(s) given starting and ending point and arrow termination(s) -&gt;, \&lt;-&gt;, \&lt;-</li>
 <li><a href="#force">Force</a>: defines an Indication of a force by an arrow and a text (symbol)</li>
 <li><a href="#wall">Wall</a>: defines an hached box given starting, ending point and thickness, filled with a pattern</li>
-<li><a href="#"></a></li>
+<li><a href="#curve">Curve</a>: defines a general curve as a sequence of (x,y) coordinates</li>
+<li><a href="#gravity">Gravity</a>: defines a downward-pointing gravity arrow with the symbol g or user given symbol.</li>
+<li><a href="#moment">Moment</a>: defines a Moment arrow with text given text, center and radius</li>
+<li><a href="#text_warrow">Text_wArrow</a>: defines Text, but an arrow is drawn from the mid part of the text to some point arrow_tip</li>
+<li><a href="#wheel">Wheel</a>: defines Hub and spokes Wheel given center, radius, spokes (default 10), inner_radius(default 1/5 of radius)</li>
+<li><a href="#spring">Spring</a>: defines a vertical spring, starting at start and with length as total vertical length</li>
+<li><a href="#dashpot">Dashpot</a>: defines a vertical dashpot of height <code>total_length</code> and <code>start</code> as bottom/starting point.</li>
 </ul>
 <h2 id="line">Line</h2>
 <p><a href="#list-of-shapes">home</a> Defines a line providing start and end point</p>
@@ -1309,24 +1681,155 @@ wall.set_name(&quot;wall&quot;)
 </code></pre>
 
 <p><img alt="Wall" src="../reference/wall.svg" /></p>
+<h2 id="curve">Curve</h2>
+<p><a href="#list-of-shapes">home</a> defines a general curve as a sequence of (x,y) coordinates</p>
+<h3 id="yaml_13">Yaml</h3>
+<pre><code class="yaml">curve=&quot;&quot;&quot;\
+name: curve
+shapes:
+    N: 100
+    x: np.linspace(-2.0, 2.0, N)
+    y: x**3
+    curve: Curve(x,y)
+&quot;&quot;&quot;
+</code></pre>
+
+<h3 id="python_13">Python</h3>
+<pre><code class="python">N = 100
+x = np.linspace(-2.0, 2.0, N)
+y = x**3
+curve = Curve(x,y)
+curve.draw()
+curve.set_name(&quot;curve&quot;)
+</code></pre>
+
+<p><img alt="Curve" src="../reference/curve.svg" /></p>
+<h2 id="gravity">Gravity</h2>
+<p><a href="#list-of-shapes">home</a> defines a downward-pointing gravity arrow with the symbol g or user given symbol.</p>
+<h3 id="yaml_14">Yaml</h3>
+<pre><code class="yaml">gravity=&quot;&quot;&quot;
+name: gravity
+shapes:
+    c: point(0,0)
+    r: 2
+    gravity: 
+        formula: Gravity(c, r, text='$Mg$')
+&quot;&quot;&quot;
+</code></pre>
+
+<h3 id="python_14">Python</h3>
+<pre><code class="python">c = point(0,0)
+r = 2
+gravity = Gravity(c, r, text='$Mg$')
+gravity.set_name(&quot;gravity&quot;)
+</code></pre>
+
+<p><img alt="Gravity" src="../reference/gravity.svg" /></p>
 <h2 id="code-to-display-the-above-defined-shapes">Code to display the above defined shapes</h2>
+<h2 id="moment">Moment</h2>
+<p><a href="#list-of-shapes">home</a> defines a Moment arrow with text given text, center and radius.</p>
+<h3 id="yaml_15">Yaml</h3>
+<pre><code class="yaml">moment=&quot;&quot;&quot;
+name: moment
+shapes:
+    moment: Moment(&quot;$T$&quot;, point(0,0), 2)
+&quot;&quot;&quot;
+</code></pre>
+
+<h3 id="python_15">Python</h3>
+<pre><code class="python">moment = Moment(&quot;$T$&quot;, point(0,0), 2)
+moment.shape_name=&quot;moment&quot;
+</code></pre>
+
+<p><img alt="Moment" src="../reference/moment.svg" /></p>
+<h2 id="text_warrow">Text_wArrow</h2>
+<p><a href="#list-of-shapes">home</a> Text, but an arrow is drawn from the mid part of the text to some point arrow_tip</p>
+<h3 id="yaml_16">Yaml</h3>
+<pre><code class="yaml">txtarrow=&quot;&quot;&quot;
+name: txtarrow
+shapes:
+    txtarrow: Text_wArrow(&quot;$Text$&quot;, point(0,0), point(2,2))
+&quot;&quot;&quot;
+</code></pre>
+
+<h3 id="python_16">Python</h3>
+<pre><code class="python">txtarrow = Text_wArrow(&quot;$Text$&quot;, point(0,0), point(2,2))
+txtarrow.set_name(&quot;txtarrow&quot;)
+</code></pre>
+
+<p><img alt="Text_wArrow" src="../reference/textwarrow.svg" /></p>
+<h2 id="wheel">Wheel</h2>
+<p><a href="#list-of-shapes">home</a> Hub and spokes Wheel given center, radius, spokes (default 10), inner_radius(default 1/5 of radius)</p>
+<h3 id="yaml_17">Yaml</h3>
+<pre><code class="yaml">wheel=&quot;&quot;&quot;
+name: wheel
+shapes:
+    wheel: Wheel(point(0,0), 5)
+&quot;&quot;&quot;
+</code></pre>
+
+<h3 id="python_17">Python</h3>
+<pre><code class="python">wheel = Wheel(point(0,0), 5)
+wheel.set_name(&quot;wheel&quot;)
+</code></pre>
+
+<p><img alt="Wheel" src="../reference/wheel.svg" /></p>
+<h2 id="spring">Spring</h2>
+<p><a href="#list-of-shapes">home</a> Specify a vertical spring, starting at start and with length as total vertical length</p>
+<h3 id="yaml_18">Yaml</h3>
+<pre><code class="yaml">spring=&quot;&quot;&quot;
+name: spring
+shapes: 
+    spring: 
+       formula: Spring(point(0,0),5)
+       style:
+           linecolor: black
+           linewidth: 1
+&quot;&quot;&quot;
+</code></pre>
+
+<h3 id="python_18">Python</h3>
+<pre><code class="python">spring = Spring(point(0,0),5)
+spring.set_linecolor('black')
+spring.set_linewidth(1)
+spring.set_name(&quot;spring&quot;)
+</code></pre>
+
+<p><img alt="Spring" src="../reference/spring.svg" /></p>
+<h2 id="dashpot">Dashpot</h2>
+<p><a href="#list-of-shapes">home</a> Defines a vertical dashpot of height <code>total_length</code> and <code>start</code> as bottom/starting point.</p>
+<h3 id="yaml_19">Yaml</h3>
+<pre><code class="yaml">dashpot=&quot;&quot;&quot;
+name: dashpot
+shapes:
+    dashpot: Dashpot(point(0,0),5)
+&quot;&quot;&quot;
+</code></pre>
+
+<h3 id="python_19">Python</h3>
+<pre><code class="python">dashpot = Dashpot(point(0,0),5)
+dashpot.set_name(&quot;dashpot&quot;)
+</code></pre>
+
+<p><img alt="Dashpot" src="../reference/dashpot.svg" /></p>
 <p><a href="#list-of-shapes">home</a> In order to display the various shapes, use the following code in a jupyter notebook</p>
 <pre><code class="python">[1]: %matplotlib widget
 [2]: from pysketcher import *
 [3]: from math import tan, radians, sin, cos # needed for python code
-[4]: drawing_tool.set_coordinate_system(xmin=-10, xmax=10,ymin=-10, ymax=10,axis=True)
+[4]: import numpy as np
+[6]: drawing_tool.set_coordinate_system(xmin=-10, xmax=10,ymin=-10, ymax=10,axis=True)
 [5]: drawing_tool.mpl.gcf().canvas
 </code></pre>
 
 <p>for Yaml, you need to add those extra steps</p>
 <pre><code class="python">head = &quot;&quot;&quot;\
-libraries: [&quot;from math import tan, radians, sin, cos&quot;,&quot;from pysketcher import *&quot;]
+libraries: [&quot;from math import tan, radians, sin, cos&quot;,&quot;from pysketcher import *&quot;,&quot;import numpy as np&quot;]
 myfig={}
 sketchParse(head,myfig)
 </code></pre>
 
-<p>The above code initialize myfig sketch space loading into it libraries references so samples can use tan, radians, si, cos and all the objects defined in pysketcher (the module name of jupytersketcher): this is used by the yaml definition of shapes</p>
-<h3 id="yaml_13">Yaml</h3>
+<p>The above code initialize myfig sketch space loading into it libraries references so samples can use tan, radians, si, cos and all the objects defined in pysketcher (the module name of jupytersketcher) and numpy as well: this is used by the yaml definition of shapes</p>
+<h3 id="yaml_20">Yaml</h3>
 <pre><code class="python">myfig={}
 sketch=&quot;&quot;&quot;
 # put here the yaml 'object' definition
@@ -1338,7 +1841,7 @@ d = myfig['object'].draw()
 drawing_tool.display()
 </code></pre>
 
-<h3 id="python_13">Python</h3>
+<h3 id="python_20">Python</h3>
 <pre><code class="python">drawing_tool.erase()
 # put the code of the object case here
 # replace object by the actual name line, rectangle, circle...

TEMPAT SAMPAH
jupysketch-doc/site/sitemap.xml.gz


File diff ditekan karena terlalu besar
+ 1707 - 1
notebooks/Reference.ipynb


+ 0 - 3
pyvenv.cfg

@@ -1,3 +0,0 @@
-home = C:\Python38
-include-system-site-packages = false
-version = 3.8.5