소스 검색

udpate user guide

Gilbert Brault 5 년 전
부모
커밋
9f524ba6f8

+ 6 - 2
jupysketch-doc/docs/about.md

@@ -1,5 +1,9 @@
-In summer 2020 I discovered [Pysketcher](https://github.com/hplgit/pysketcher) as I was looking for a way to create Physics sketches for both design communication and simulation.
+In summer 2020 I discovered [Pysketcher](https://github.com/hplgit/pysketcher) as I was looking for a way to create Physics sketches for both design and simulation.
 
 My second requirement is to have sketches available in Jupyter notebooks (Lab or notebook server)
 
-This piece of software was developped by [Hans Petter Langtangen](https://en.wikipedia.org/wiki/Hans_Petter_Langtangen), see it in [GitHub](https://github.com/hplgit/pysketcher), I just need to upgrade it to make it compatible with Jupyter
+Pysketch was developped in 2012 by [Hans Petter Langtangen](https://en.wikipedia.org/wiki/Hans_Petter_Langtangen), see it in [GitHub](https://github.com/hplgit/pysketcher). At that time, Jupyter was emerging and Pysketch was developped as a standalone application. 
+
+I just need to upgrade it to make it compatible with Jupyter: This is the inception of Jupyter Sketch project!
+
+![](images/dryfriction.png)

BIN
jupysketch-doc/docs/images/dryfriction.png


+ 17 - 12
jupysketch-doc/docs/index.md

@@ -1,17 +1,22 @@
-# Welcome to MkDocs
+# Welcome to Jupyter Sketcher Documentation
 
-For full documentation visit [mkdocs.org](https://www.mkdocs.org).
+## Problem solved
 
-## Commands
+When you need to solve a mechanical problem, sooner or later you are going to sketch a figure to capture the parameters and variables of the problem.
 
-* `mkdocs new [dir-name]` - Create a new project.
-* `mkdocs serve` - Start the live-reloading docs server.
-* `mkdocs build` - Build the documentation site.
-* `mkdocs -h` - Print help message and exit.
+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.
 
-## Project layout
+What if you could capture this in the program solving the problem and use it as a repository for all definitions and physical variables?
 
-    mkdocs.yml    # The configuration file.
-    docs/
-        index.md  # The documentation homepage.
-        ...       # Other markdown pages, images and other files.
+This is what jupytersketcher (name of pysketcher module) is proposing to solve.
+
+Of course, this makes even more sense when using Jupyter notebooks, because as a sketch not only the image of the solved problem can be displayed, but the dictionary of all variables processed in the notebook for solving physics is used to draw the image and at the same time to solve the equations of motion.
+
+jupytersketcher is another small step towards reusable science.
+
+## Getting Started
+
+You can use the binder link in jupytersketcher Github to see some experiments with pysketcher. 
+[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/gbrault/jupytersketcher.git/master?filepath=notebooks%2FDryFriction.ipynb)
+
+## pysketcher features

+ 82 - 0
jupysketch-doc/docs/sketcher.md

@@ -0,0 +1,82 @@
+## A language to describe a sketch
+
+## Example
+```yaml
+libraries: ["from math import tan, radians, sin, cos",
+            "from pysketcher import *"]
+fontsize: 18
+g: 9.81              # constant gravity
+theta: 30.0          # inclined plane angle
+L: 10.0              # sketch sizing parameter
+a: 1.0               #
+xmin: 0.0            # sketech min Abscissa
+ymin: -3.0           # sketech min Ordinate     
+rl: 2.0              # rectangle width
+rL: 1.0              # rectangle length
+setframe:            # sketch setup
+    action: "drawing_tool.set_coordinate_system(xmin=xmin-L/5, xmax=xmin+1.5*L,ymin=ymin, ymax=ymin+1.5*L,instruction_file='tmp_mpl_friction.py')"
+setblackline:        # default frame values and actions
+    action: "drawing_tool.set_linecolor('black')"
+B: point(a+L,0)                      # wall right end
+A: point(a,tan(radians(theta))*L)    # wall left end
+normal_vec: point(sin(radians(theta)),cos(radians(theta)))     # Vector normal to wall
+tangent_vec: point(cos(radians(theta)),-sin(radians(theta)))   # Vector tangent to wall
+help_line: Line(A,B)                 # wall line
+x: a + 3*L/10.
+y: help_line(x=x)    
+contact: point(x, y)    
+c: contact + rL/2*normal_vec
+rectangle: 
+    formula: Rectangle(contact, rl, rL)
+    style:
+        linecolor: blue
+        filled_curves: blue
+    transform: ["rotate(-theta, contact)",
+                "translate(-rl/2*tangent_vec)"]
+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
+body: 
+    formula: "Composition({'wheel': wheel, 'N': N, 'mg': mg})"
+    style:
+        linecolor: black
+mB:
+    formula: Text(r'$B$',B)
+mA:
+    formula: Text(r'$A$', A)
+wall: 
+    formula: Wall(x=[A[0], B[0]], y=[A[1], B[1]], thickness=-0.25,transparent=False)
+    style:
+        linecolor: black    
+angle: 
+    formula: "Arc_wText(r'$<bslash>theta$', center=B, radius=3, start_angle=180-theta, arc_angle=theta, fontsize=fontsize)"
+    style:
+        linecolor: black
+        linewidth: 1
+ground: 
+     formula: Line((B[0]-L/10., 0), (B[0]-L/2.,0))
+     stlye:
+         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})"
+```

+ 1 - 0
jupysketch-doc/mkdocs.yml

@@ -1,6 +1,7 @@
 site_name: Jypyter Sketcher
 nav:
     - Home: index.md
+    - Sketcher definition: sketcher.md 
     - About: about.md
 theme:
   name: material    

+ 3 - 2
notebooks/DryFriction.ipynb

@@ -135,7 +135,8 @@
     "    style:\n",
     "        linecolor: blue\n",
     "        filled_curves: blue\n",
-    "    transform: [\"rotate(-theta, contact)\",\"translate(-rl/2*tangent_vec)\"]\n",
+    "    transform: [\"rotate(-theta, contact)\",\n",
+    "                \"translate(-rl/2*tangent_vec)\"]\n",
     "N: \n",
     "    formula: Force(contact - rl*normal_vec, contact, r'$N$', text_pos='start')\n",
     "    style:\n",
@@ -283,7 +284,7 @@
     {
      "data": {
       "application/vnd.jupyter.widget-view+json": {
-       "model_id": "83e8b7e739ef4b3c95a755a92d105b51",
+       "model_id": "cce2ada706774056b97b0cf67115a55c",
        "version_major": 2,
        "version_minor": 0
       },