index.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. <!doctype html>
  2. <html lang="en" class="no-js">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1">
  6. <link rel="shortcut icon" href="../assets/images/favicon.png">
  7. <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-5.5.3">
  8. <title>YAML files Reference - Jypyter Sketcher</title>
  9. <link rel="stylesheet" href="../assets/stylesheets/main.947af8d5.min.css">
  10. <link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
  11. <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7CRoboto+Mono&display=fallback">
  12. <style>body,input{font-family:"Roboto",-apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono",SFMono-Regular,Consolas,Menlo,monospace}</style>
  13. </head>
  14. <body dir="ltr">
  15. <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
  16. <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
  17. <label class="md-overlay" for="__drawer"></label>
  18. <div data-md-component="skip">
  19. <a href="#yaml-sketcher-file-grammar" class="md-skip">
  20. Skip to content
  21. </a>
  22. </div>
  23. <div data-md-component="announce">
  24. </div>
  25. <header class="md-header" data-md-component="header">
  26. <nav class="md-header-nav md-grid" aria-label="Header">
  27. <a href=".." title="Jypyter Sketcher" class="md-header-nav__button md-logo" aria-label="Jypyter Sketcher">
  28. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 003-3 3 3 0 00-3-3 3 3 0 00-3 3 3 3 0 003 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54z"/></svg>
  29. </a>
  30. <label class="md-header-nav__button md-icon" for="__drawer">
  31. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
  32. </label>
  33. <div class="md-header-nav__title" data-md-component="header-title">
  34. <div class="md-header-nav__ellipsis">
  35. <span class="md-header-nav__topic md-ellipsis">
  36. Jypyter Sketcher
  37. </span>
  38. <span class="md-header-nav__topic md-ellipsis">
  39. YAML files Reference
  40. </span>
  41. </div>
  42. </div>
  43. <label class="md-header-nav__button md-icon" for="__search">
  44. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
  45. </label>
  46. <div class="md-search" data-md-component="search" role="dialog">
  47. <label class="md-search__overlay" for="__search"></label>
  48. <div class="md-search__inner" role="search">
  49. <form class="md-search__form" name="search">
  50. <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" data-md-state="active">
  51. <label class="md-search__icon md-icon" for="__search">
  52. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
  53. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
  54. </label>
  55. <button type="reset" class="md-search__icon md-icon" aria-label="Clear" data-md-component="search-reset" tabindex="-1">
  56. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
  57. </button>
  58. </form>
  59. <div class="md-search__output">
  60. <div class="md-search__scrollwrap" data-md-scrollfix>
  61. <div class="md-search-result" data-md-component="search-result">
  62. <div class="md-search-result__meta">
  63. Initializing search
  64. </div>
  65. <ol class="md-search-result__list"></ol>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. </nav>
  72. </header>
  73. <div class="md-container" data-md-component="container">
  74. <main class="md-main" data-md-component="main">
  75. <div class="md-main__inner md-grid">
  76. <div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
  77. <div class="md-sidebar__scrollwrap">
  78. <div class="md-sidebar__inner">
  79. <nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
  80. <label class="md-nav__title" for="__drawer">
  81. <a href=".." title="Jypyter Sketcher" class="md-nav__button md-logo" aria-label="Jypyter Sketcher">
  82. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 003-3 3 3 0 00-3-3 3 3 0 00-3 3 3 3 0 003 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54z"/></svg>
  83. </a>
  84. Jypyter Sketcher
  85. </label>
  86. <ul class="md-nav__list" data-md-scrollfix>
  87. <li class="md-nav__item">
  88. <a href=".." title="Home" class="md-nav__link">
  89. Home
  90. </a>
  91. </li>
  92. <li class="md-nav__item">
  93. <a href="../about/" title="About" class="md-nav__link">
  94. About
  95. </a>
  96. </li>
  97. <li class="md-nav__item">
  98. <a href="../presentation/" title="Presentation" class="md-nav__link">
  99. Presentation
  100. </a>
  101. </li>
  102. <li class="md-nav__item">
  103. <a href="../learningbyexample/" title="Learning by Example" class="md-nav__link">
  104. Learning by Example
  105. </a>
  106. </li>
  107. <li class="md-nav__item">
  108. <a href="../shapereference/" title="Shapes Reference" class="md-nav__link">
  109. Shapes Reference
  110. </a>
  111. </li>
  112. <li class="md-nav__item md-nav__item--active">
  113. <input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
  114. <label class="md-nav__link md-nav__link--active" for="__toc">
  115. YAML files Reference
  116. <span class="md-nav__icon md-icon">
  117. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 9h14V7H3v2m0 4h14v-2H3v2m0 4h14v-2H3v2m16 0h2v-2h-2v2m0-10v2h2V7h-2m0 6h2v-2h-2v2z"/></svg>
  118. </span>
  119. </label>
  120. <a href="./" title="YAML files Reference" class="md-nav__link md-nav__link--active">
  121. YAML files Reference
  122. </a>
  123. <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
  124. <label class="md-nav__title" for="__toc">
  125. <span class="md-nav__icon md-icon">
  126. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
  127. </span>
  128. Table of contents
  129. </label>
  130. <ul class="md-nav__list" data-md-scrollfix>
  131. <li class="md-nav__item">
  132. <a href="#yaml-sketcher-file-grammar" class="md-nav__link">
  133. YAML sketcher file grammar
  134. </a>
  135. </li>
  136. <li class="md-nav__item">
  137. <a href="#libraries-pysketcher-object-creation-styles-transform" class="md-nav__link">
  138. Libraries, Pysketcher Object creation, Styles, Transform
  139. </a>
  140. <nav class="md-nav" aria-label="Libraries, Pysketcher Object creation, Styles, Transform">
  141. <ul class="md-nav__list">
  142. <li class="md-nav__item">
  143. <a href="#libraries" class="md-nav__link">
  144. Libraries
  145. </a>
  146. </li>
  147. <li class="md-nav__item">
  148. <a href="#pysketcher-object-creation" class="md-nav__link">
  149. Pysketcher object creation
  150. </a>
  151. </li>
  152. <li class="md-nav__item">
  153. <a href="#styles" class="md-nav__link">
  154. Styles
  155. </a>
  156. </li>
  157. <li class="md-nav__item">
  158. <a href="#transform" class="md-nav__link">
  159. Transform
  160. </a>
  161. </li>
  162. </ul>
  163. </nav>
  164. </li>
  165. <li class="md-nav__item">
  166. <a href="#example" class="md-nav__link">
  167. Example
  168. </a>
  169. </li>
  170. <li class="md-nav__item">
  171. <a href="#code-to-read-or-write-a-yaml-sketcher-file" class="md-nav__link">
  172. Code to read or write a yaml sketcher file
  173. </a>
  174. </li>
  175. </ul>
  176. </nav>
  177. </li>
  178. <li class="md-nav__item">
  179. <a href="../gallerydoc/" title="Gallery" class="md-nav__link">
  180. Gallery
  181. </a>
  182. </li>
  183. </ul>
  184. </nav>
  185. </div>
  186. </div>
  187. </div>
  188. <div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
  189. <div class="md-sidebar__scrollwrap">
  190. <div class="md-sidebar__inner">
  191. <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
  192. <label class="md-nav__title" for="__toc">
  193. <span class="md-nav__icon md-icon">
  194. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
  195. </span>
  196. Table of contents
  197. </label>
  198. <ul class="md-nav__list" data-md-scrollfix>
  199. <li class="md-nav__item">
  200. <a href="#yaml-sketcher-file-grammar" class="md-nav__link">
  201. YAML sketcher file grammar
  202. </a>
  203. </li>
  204. <li class="md-nav__item">
  205. <a href="#libraries-pysketcher-object-creation-styles-transform" class="md-nav__link">
  206. Libraries, Pysketcher Object creation, Styles, Transform
  207. </a>
  208. <nav class="md-nav" aria-label="Libraries, Pysketcher Object creation, Styles, Transform">
  209. <ul class="md-nav__list">
  210. <li class="md-nav__item">
  211. <a href="#libraries" class="md-nav__link">
  212. Libraries
  213. </a>
  214. </li>
  215. <li class="md-nav__item">
  216. <a href="#pysketcher-object-creation" class="md-nav__link">
  217. Pysketcher object creation
  218. </a>
  219. </li>
  220. <li class="md-nav__item">
  221. <a href="#styles" class="md-nav__link">
  222. Styles
  223. </a>
  224. </li>
  225. <li class="md-nav__item">
  226. <a href="#transform" class="md-nav__link">
  227. Transform
  228. </a>
  229. </li>
  230. </ul>
  231. </nav>
  232. </li>
  233. <li class="md-nav__item">
  234. <a href="#example" class="md-nav__link">
  235. Example
  236. </a>
  237. </li>
  238. <li class="md-nav__item">
  239. <a href="#code-to-read-or-write-a-yaml-sketcher-file" class="md-nav__link">
  240. Code to read or write a yaml sketcher file
  241. </a>
  242. </li>
  243. </ul>
  244. </nav>
  245. </div>
  246. </div>
  247. </div>
  248. <div class="md-content">
  249. <article class="md-content__inner md-typeset">
  250. <h1>YAML files Reference</h1>
  251. <p>Content</p>
  252. <ul>
  253. <li><a href="#yaml-sketcher-file-grammar">YAML sketcher file grammar</a></li>
  254. <li><a href="#libraries-pysketcher-object-creation-styles-transform">Libraries, Pysketcher Object creation, Styles, Transform</a></li>
  255. <li><a href="#example">Example</a></li>
  256. <li><a href="#code-to-read-or-write-a-yaml-sketcher-file">Code to read or write a yaml sketcher file</a></li>
  257. </ul>
  258. <h2 id="yaml-sketcher-file-grammar">YAML sketcher file grammar</h2>
  259. <p>Sketcher file EBNF Grammar is</p>
  260. <pre><code class="EBNF">Sketch ::= Sketch_Name Parts
  261. Sketch_Name ::= &quot;-&quot; &quot; &quot; &quot;name: &quot; Identifier Comment? &quot;\n&quot;
  262. Parts ::= &quot;-&quot; &quot; &quot; &quot;parts:\n&quot; Comment? Part+
  263. Part ::= Part_Name Shapes
  264. Part_Name ::= INDENT &quot;-&quot; &quot; &quot; &quot;name: &quot; Identifier Comment? &quot;\n&quot; DEDENT
  265. Shapes ::= INDENT &quot; &quot; &quot; &quot; &quot;shapes:\n&quot; Comment? Shape+ DEDENT
  266. Shape ::= Libraries | Expression | DoAction | SketchObject
  267. Libraries ::= INDENT &quot;libraries:&quot; &quot; &quot; (PyImport | &quot;[&quot; (PyImport &quot;,&quot;)+ PyImport &quot;]&quot;) &quot;\n&quot; DEDENT
  268. Expression ::= INDENT Identifier &quot;:&quot; &quot; &quot; &quot;|\n&quot;? PyRightHandExpression Comment? &quot;\n&quot; DEDENT
  269. DoAction ::= INDENT Identifier &quot;:&quot; &quot; &quot; Comment? &quot;\n&quot; Action DEDENT
  270. Action ::= INDENT &quot;action:&quot; &quot; &quot; PyExpression Comment? &quot;\n&quot; DEDENT
  271. SketchObject ::= INDENT Formula Styles? Transforms? DEDENT
  272. Formula ::= INDENT &quot;formula:&quot; (&quot; &quot; | &quot;|\n&quot;) SketcherCreator Comment? &quot;\n&quot; DEDENT
  273. SketcherCreator::= SketcherClass &quot;(&quot; PyFunctionArgs &quot;)&quot;
  274. SketcherClass ::= &quot;Line&quot; | &quot;Rectangle&quot; | &quot;Triangle&quot; | &quot;Circle&quot; | &quot;Distance_wText&quot; | &quot;Text&quot; | &quot;Cross&quot; | &quot;Axis&quot; |
  275. &quot;Arc&quot; | &quot;Arc_wText&quot; | &quot;Arrow1&quot; | &quot;Force&quot; | &quot;Wall&quot; | &quot;Curve&quot; | &quot;Trajectory&quot; | &quot;Gravity&quot; | &quot;Moment&quot; | &quot;Text_wArrow&quot; | &quot;Wheel&quot; | &quot;Spring&quot; | &quot;Dashpot&quot;
  276. Styles ::= INDENT &quot;style:\n&quot; Style+ DEDENT
  277. Style ::= LineStyle | LineWidth | LineColor | Arrow | Filled_Curves | Shadow
  278. LineStyle ::= INDENT &quot;linestyle:&quot; &quot; &quot; (&quot;solid&quot; | &quot;dashed&quot; | &quot;dashdot&quot; | &quot;dotted&quot;) &quot;\n&quot; DEDENT
  279. LineWidth ::= INDENT &quot;linewidth:&quot; &quot; &quot; Integer &quot;\n&quot; DEDENT
  280. LineColor ::= INDENT &quot;linescolor:&quot; &quot; &quot; MatplotLibLine_Colors &quot;\n&quot; DEDENT
  281. Filled_Curves ::= INDENT &quot;filled_curves:&quot; (Color | Pattern | Color Pattern) Comment? &quot;\n&quot; DEDENT
  282. Color ::= INDENT &quot;color:&quot; MatplotLibLine_Colors Comment? &quot;\n&quot; DEDENT
  283. Pattern ::= INDENT &quot;pattern:&quot; MatplotLibPattern Comment? &quot;\n&quot; DEDENT
  284. Arrow ::= INDENT &quot;linestyle:&quot; &quot; &quot; (&quot;-&gt;&quot; | &quot;&lt;-&quot; | &quot;&lt;-&gt;&quot;) Comment? &quot;\n&quot; DEDENT
  285. Shadow ::= INDENT &quot;shadow:&quot; &quot; &quot; Integer Comment? &quot;\n&quot; DEDENT
  286. Transforms ::= INDENT &quot;transform:&quot; &quot;|\n&quot;? Transform+ &quot;\n&quot; DEDENT
  287. Transform ::= Sketchertransform | &quot;[&quot; Sketchertransform+ &quot;]&quot;
  288. Sketchertransform ::= (&quot;rotate&quot; | &quot;translate&quot; | &quot;...&quot; ) &quot;(&quot; PyFunctionArgs &quot;)&quot;
  289. Integer ::=[1-9][0-9]*
  290. Identifier ::= [A-Za-z][_A-Za-z0-9]+
  291. Comment ::= &quot;#&quot; STRING
  292. </code></pre>
  293. <p>Here is the railroad grammar diagram:</p>
  294. <p><a href="../resources/yamlpysketchergrammar.xhtml">Yaml Sketcher railroad diagram</a></p>
  295. <p><small><a href="https://bottlecaps.de/rr/ui"target="_blank">[Built thanks]</a></small></p>
  296. <h2 id="libraries-pysketcher-object-creation-styles-transform">Libraries, Pysketcher Object creation, Styles, Transform</h2>
  297. <h3 id="libraries">Libraries</h3>
  298. <p>The libraries token defined in the grammar is</p>
  299. <ul>
  300. <li>a single import directive</li>
  301. <li>a list [] of import directive</li>
  302. <li>one of the import must be pysketcher!</li>
  303. </ul>
  304. <pre><code class="python">from pysketcher import *
  305. </code></pre>
  306. <h3 id="pysketcher-object-creation">Pysketcher object creation</h3>
  307. <ul>
  308. <li>The <code>Python pysktecher object creation</code> is a python class object statment. </li>
  309. <li>The possible class are defined in this <a href="/shapereference">section</a></li>
  310. <li>Every parameter of the object creation can be an expression, based upon variables defined before in the YAML file</li>
  311. </ul>
  312. <h3 id="styles">Styles</h3>
  313. <p>The list of possible style correspond to the list of set_&lt;style&gt; members of the corresponding pysketcher class used for the object creation. This function will be applied to the current object under creation. Parameters of this function can be variable defined upstream. </p>
  314. <h3 id="transform">Transform</h3>
  315. <p>The transform token defined in the grammer is</p>
  316. <ul>
  317. <li>a single transform statement</li>
  318. <li>a list [] of transform statments</li>
  319. <li>a tranform statement is a transformation function that can be applied to the object under construction</li>
  320. <li>example of transform function are rotate, translate</li>
  321. <li>parameters of the transform function can be expression based upon upstream variables definition</li>
  322. </ul>
  323. <h2 id="example">Example</h2>
  324. <pre><code class="yaml">!!omap
  325. - name: unknown
  326. - parts:
  327. - name: head
  328. shapes:
  329. libraries: ['from math import tan, radians, sin, cos', from pysketcher import
  330. *]
  331. - name: constants
  332. shapes:
  333. fontsize: 18 # size of the characters
  334. g: 9.81 # constant gravity
  335. theta: 30.0 # inclined plane angle
  336. L: 10.0 # sketch sizing parameter
  337. a: 1.0 #
  338. xmin: 0.0 # sketech min Abscissa
  339. ymin: -3.0 # sketech min Ordinate
  340. rl: 2.0 # rectangle width
  341. rL: 1.0 # rectangle length
  342. - name: frame
  343. shapes:
  344. setframe: # sketch setup
  345. action: drawing_tool.set_coordinate_system(xmin=xmin-L/5, xmax=xmin+1.5*L,ymin=ymin,
  346. ymax=ymin+1.5*L,instruction_file='tmp_mpl_friction.py')
  347. setblackline: # default frame values and actions
  348. action: drawing_tool.set_linecolor('black')
  349. B: point(a+L,0) # wall right end
  350. A: point(a,tan(radians(theta))*L) # wall left end
  351. normal_vec: point(sin(radians(theta)),cos(radians(theta))) # Vector normal to wall
  352. tangent_vec: point(cos(radians(theta)),-sin(radians(theta))) # Vector tangent to wall
  353. help_line: Line(A,B) # wall line
  354. x: a + 3*L/10. # contact point Abscissa
  355. y: help_line(x=x) # contact point Ordinate
  356. contact: point(x, y) # contact point: middle of the rectangle bottom edge
  357. c: contact + rL/2*normal_vec
  358. - name: body
  359. shapes:
  360. rectangle:
  361. formula: Rectangle(contact, rl, rL)
  362. style:
  363. linecolor: blue
  364. filled_curves: blue
  365. transform: ['rotate(-theta, contact)', translate(-rl/2*tangent_vec)]
  366. N:
  367. formula: Force(contact - rl*normal_vec, contact, r'$N$', text_pos='start')
  368. style:
  369. linecolor: black
  370. wheel:
  371. formula: &quot;Composition({'outer': rectangle})&quot;
  372. style:
  373. shadow: 1
  374. mc:
  375. formula: Text(r'$c$', c)
  376. body:
  377. formula: &quot;Composition({'wheel': wheel, 'N': N, 'mc': mc})&quot;
  378. style:
  379. linecolor: black
  380. - name: plan
  381. shapes:
  382. mB:
  383. formula: Text(r'$B$',B)
  384. mA:
  385. formula: Text(r'$A$', A)
  386. wall:
  387. formula: Wall(x=[A[0], B[0]], y=[A[1], B[1]], thickness=-0.25,transparent=False)
  388. style:
  389. linecolor: black
  390. x_const:
  391. formula: Line(contact, contact + point(0,4))
  392. style:
  393. linestyle: dotted
  394. transform: rotate(-theta, contact)
  395. x_axis:
  396. formula: Axis(start=contact+ 2*rl*normal_vec, length=2*rl,label='$x$', rotation_angle=-theta)
  397. plan:
  398. formula: &quot;Composition({'body': body, 'inclined wall': wall, 'x start': x_const,\
  399. \ 'x axis': x_axis, 'mA': mA, 'mB': mB})&quot;
  400. - name: friction
  401. shapes:
  402. mg:
  403. formula: Gravity(c, rl, text='$Mg$')
  404. style:
  405. linecolor: black
  406. angle:
  407. formula: Arc_wText(r'$&lt;bslash&gt;theta$', center=B, radius=3, start_angle=180-theta,
  408. arc_angle=theta, fontsize=fontsize)
  409. style:
  410. linecolor: black
  411. linewidth: 1
  412. ground:
  413. formula: Line((B[0]-L/10., 0), (B[0]-L/2.,0))
  414. stlye:
  415. linecolor: black
  416. linestyle: dashed
  417. linewidth: 1
  418. friction:
  419. formula: &quot;Composition({'plan': plan, 'ground': ground, 'mg': mg, 'angle':\
  420. \ angle})&quot;
  421. </code></pre>
  422. <h2 id="code-to-read-or-write-a-yaml-sketcher-file">Code to read or write a yaml sketcher file</h2>
  423. <p>To read a YAML Pysketcher file definition:</p>
  424. <pre><code class="python">from pysketcher import *
  425. myfig={}
  426. sketch = Sketch(myfig)
  427. sketch.file2Sketch(&quot;dryfriction.yml&quot;)
  428. #............... can now use sketch to draw something ..................
  429. </code></pre>
  430. <p>To write a YAML Pysketcher file definition:</p>
  431. <pre><code class="python">from pysketcher import *
  432. myfig={}
  433. sketch = Sketch(myfig)
  434. #............. need to create some Pysketcher objects in the sketch .................
  435. sketch.file2Sketch(&quot;dryfriction.yml&quot;)
  436. </code></pre>
  437. </article>
  438. </div>
  439. </div>
  440. </main>
  441. <footer class="md-footer">
  442. <div class="md-footer-nav">
  443. <nav class="md-footer-nav__inner md-grid" aria-label="Footer">
  444. <a href="../shapereference/" title="Shapes Reference" class="md-footer-nav__link md-footer-nav__link--prev" rel="prev">
  445. <div class="md-footer-nav__button md-icon">
  446. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
  447. </div>
  448. <div class="md-footer-nav__title">
  449. <div class="md-ellipsis">
  450. <span class="md-footer-nav__direction">
  451. Previous
  452. </span>
  453. Shapes Reference
  454. </div>
  455. </div>
  456. </a>
  457. <a href="../gallerydoc/" title="Gallery" class="md-footer-nav__link md-footer-nav__link--next" rel="next">
  458. <div class="md-footer-nav__title">
  459. <div class="md-ellipsis">
  460. <span class="md-footer-nav__direction">
  461. Next
  462. </span>
  463. Gallery
  464. </div>
  465. </div>
  466. <div class="md-footer-nav__button md-icon">
  467. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg>
  468. </div>
  469. </a>
  470. </nav>
  471. </div>
  472. <div class="md-footer-meta md-typeset">
  473. <div class="md-footer-meta__inner md-grid">
  474. <div class="md-footer-copyright">
  475. Made with
  476. <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
  477. Material for MkDocs
  478. </a>
  479. </div>
  480. </div>
  481. </div>
  482. </footer>
  483. </div>
  484. <script src="../assets/javascripts/vendor.c3dc8c49.min.js"></script>
  485. <script src="../assets/javascripts/bundle.f9edbbd5.min.js"></script><script id="__lang" type="application/json">{"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents"}</script>
  486. <script>
  487. app = initialize({
  488. base: "..",
  489. features: [],
  490. search: Object.assign({
  491. worker: "../assets/javascripts/worker/search.8e2cddea.min.js"
  492. }, typeof search !== "undefined" && search)
  493. })
  494. </script>
  495. <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML"></script>
  496. </body>
  497. </html>