{"id":248,"date":"2018-06-29T16:59:53","date_gmt":"2018-06-29T14:59:53","guid":{"rendered":"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/?page_id=248"},"modified":"2018-07-17T12:25:18","modified_gmt":"2018-07-17T10:25:18","slug":"lesson-6-using-the-execution-cycle","status":"publish","type":"page","link":"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/lesson-6-using-the-execution-cycle\/","title":{"rendered":"Lesson 6: Utilize the execution cycle of rules"},"content":{"rendered":"<div class=\"toc_sitemap\"><h3 class=\"toc_sitemap_pages\">Pages<\/h3><ul class=\"toc_sitemap_pages_list\"><li class=\"page_item page-item-24\"><a href=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/\">A RULE-BASED TOPOLOGICAL MODELER GENERATOR<\/a><\/li>\n<li class=\"page_item page-item-671\"><a href=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/inference-of-topological-operations-illustration-in-geology\/\">Inference of topological operations: illustration in geology<\/a><\/li>\n<li class=\"page_item page-item-596\"><a href=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/japhy\/\">Japhy : une plate-forme m\u00e9canique et topologique utilisant un langage \u00e0 base de r\u00e8gles pour l&rsquo;animation physique.<\/a><\/li>\n<li class=\"page_item page-item-645\"><a href=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/jerboaeclatement\/\">JerboaEclatement<\/a><\/li>\n<li class=\"page_item page-item-736\"><a href=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/joptop-jerboa-optimisation-topologique\/\">Joptop &#8211; Jerboa Optimisation Topologique<\/a><\/li>\n<li class=\"page_item page-item-85\"><a href=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/lesson-1-discover-topological-structures\/\">Lesson 1: Discover topological structures of Jerboa<\/a><\/li>\n<li class=\"page_item page-item-128\"><a href=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/lesson-2-discover-embeddings-and-orbits\/\">Lesson 2: Discover embeddings and orbits<\/a><\/li>\n<li class=\"page_item page-item-158\"><a href=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/lesson-3-modify-and-write-a-first-rule\/\">Lesson 3: Modify and write a first rule<\/a><\/li>\n<li class=\"page_item page-item-164\"><a href=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/lesson-4-write-embedding-expressions\/\">Lesson 4: Write embedding expressions<\/a><\/li>\n<li class=\"page_item page-item-243\"><a href=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/lesson-5-make-topological-transformations\/\">Lesson 5: Design topological transformations<\/a><\/li>\n<li class=\"page_item page-item-248\"><a href=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/lesson-6-using-the-execution-cycle\/\">Lesson 6: Utilize the execution cycle of rules<\/a><\/li>\n<li class=\"page_item page-item-536\"><a href=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/lesson-7-write-scripts-in-jerboa\/\">Lesson 7 : Write scripts in Jerboa<\/a><\/li>\n<li class=\"page_item page-item-449\"><a href=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/lesson-8-create-your-own-modeler\/\">Lesson 8: Create your own modeler<\/a><\/li>\n<li class=\"page_item page-item-775\"><a href=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/model-reevaluation-based-on-graph-transformation-rules\/\">Model reevaluation based on graph transformation rules<\/a><\/li>\n<li class=\"page_item page-item-712\"><a href=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/topological-inference-for-subdivision-schemes\/\">Topological inference for subdivision schemes<\/a><\/li>\n<\/ul><\/div>\n<a href=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\" class=\"su-button su-button-style-default\" style=\"color:#FFFFFF;background-color:#2D89EF;border-color:#246ec0;border-radius:6px\" target=\"_self\"><span style=\"color:#FFFFFF;padding:0px 18px;font-size:14px;line-height:28px;border-color:#6cadf4;border-radius:6px;text-shadow:none\"> Lesson 5<\/span><\/a>\n<p>&nbsp;<\/p>\n<p>In this lesson you will learn which steps take place in the execution cycle of a rule. You will learn how to optimize the operations, set preconditions to a rule as well as parameters.<\/p>\n<p>You will discover and use the Precondition, Midprocess and Postprocess in the editor of the modeler you have been using until now.<\/p>\n<p>Here is a diagram of the execution cycle (see Figure 6.1).<\/p>\n<figure id=\"attachment_543\" aria-describedby=\"caption-attachment-543\" style=\"width: 374px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-543 size-full\" src=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/138.jpg\" alt=\"\" width=\"374\" height=\"360\" srcset=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/138.jpg 374w, http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/138-300x289.jpg 300w\" sizes=\"(max-width: 374px) 100vw, 374px\" \/><figcaption id=\"caption-attachment-543\" class=\"wp-caption-text\">Figure 6.1: Execution cycle<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<h3><strong>PRECONDITIONS<br \/>\n<\/strong><\/h3>\n<p><span style=\"color: #0000ff;\"><div class=\"su-note\"  style=\"border-color:#e5e5e5;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#ffffff;border-color:#ffffff;color:#808080;\"><\/span><span style=\"color: #808080;\">Preconditions are boolean functions used to determine whether an operation can be applied, in addition to the topological pattern matching.<\/span><\/p>\n<p><span style=\"color: #808080;\">There are three types of precondition:<\/span><\/p>\n<p><span style=\"color: #808080;\">&#8211; preprocesses which are executed before the pattern matching which allow the rule to check conditions on the hooked darts.<br \/>\n<\/span><\/p>\n<p><span style=\"color: #808080;\">&#8211; node preconditions which are verified during the pattern matching process on each matched dart.<\/span><\/p>\n<p><span style=\"color: #0000ff;\"><span style=\"color: #808080;\">&#8211; rule preconditions which is checked on the whole left pattern after having been matched.<\/span><\/span><\/p>\n<p><span style=\"color: #808080;\">Darts are accessed with \u00ab\u00a0@leftPattern#ni#j\u00a0\u00bb where ni is the name of the node in the left pattern and j is the number of the instance of the node which is the dart you wish to access.<\/span><span style=\"color: #0000ff;\"><\/div><\/div><\/span><\/p>\n<p>&nbsp;<\/p>\n<p>Here you will add a precondition to the triangulate rule from lesson 5 so that it can&rsquo;t be applied to a triangle and then another one so that it can&rsquo;t be applied to a blue face.<\/p>\n<ul>\n<li>open the editor and edit the TriangulateFace rule<\/li>\n<li>click on \u00ab\u00a0Views\u00a0\u00bb then on \u00ab\u00a0Precondition\u00a0\u00bb<\/li>\n<li>In the precondition window at the bottom write the expression to prevent the rule from being applied to a triangle by returning a boolean on whether the size of the collection of the edge sub-orbit on a face (the &lt;0,3&gt; sub-orbit from the &lt;0,1,3&gt; orbit) is equal to three (three edges to a triangle) like in Screen 6.2<\/li>\n<\/ul>\n<figure id=\"attachment_544\" aria-describedby=\"caption-attachment-544\" style=\"width: 790px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-544 size-full\" src=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/139.jpg\" alt=\"\" width=\"790\" height=\"219\" srcset=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/139.jpg 790w, http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/139-300x83.jpg 300w, http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/139-768x213.jpg 768w\" sizes=\"(max-width: 790px) 100vw, 790px\" \/><figcaption id=\"caption-attachment-544\" class=\"wp-caption-text\">Screen 6.2: Precondition<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<h3><strong>EMBEDDING PARAMETERS<\/strong><\/h3>\n<p><span style=\"color: #808080;\"><span style=\"color: #0000ff;\"><div class=\"su-note\"  style=\"border-color:#e5e5e5;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#ffffff;border-color:#ffffff;color:#808080;\"><\/span>There is a window in the editor which enables you to declare variables to be used in rules. These variables (or parameters) are optional and must have a default value for the first application of the rule and they retain the value they are given over to the next application.<\/span><\/p>\n<p><span style=\"color: #808080;\">To create a variable you must click on \u00ab\u00a0Create New Embedding Parameter\u00a0\u00bb, give it a name, a type and a default value.<span style=\"color: #0000ff;\"><\/div><\/div><\/span><\/span><\/p>\n<p>You will now create a rule which places a hole in the center of a face. The hole will be the same shape as the face so each vertex of the hole will be placed halfway between it&rsquo;s counterpart on the edge of\u00a0 the face and the barycenter of the face. This barycenter will be the same for each vertex so you only want to calculate it once so you should do it with an embedding parameter in the midprocess.<\/p>\n<ul>\n<li>open the editor and create a new rule called \u00ab\u00a0PerforateFace\u00a0\u00bb<\/li>\n<\/ul>\n<figure id=\"attachment_516\" aria-describedby=\"caption-attachment-516\" style=\"width: 721px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-516 size-full\" src=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/130-1.jpg\" alt=\"\" width=\"721\" height=\"460\" srcset=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/130-1.jpg 721w, http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/130-1-300x191.jpg 300w\" sizes=\"(max-width: 721px) 100vw, 721px\" \/><figcaption id=\"caption-attachment-516\" class=\"wp-caption-text\">Screen 6.3: PerforateFace<\/figcaption><\/figure>\n<ul>\n<li>place a hook in the left pattern like in Screen 6.3<\/li>\n<li>place four nodes in the right pattern like in Screen 6.3<\/li>\n<li>click on \u00ab\u00a0Views\u00a0\u00bb, then \u00ab\u00a0Embedding Parameters\u00a0\u00bb and then \u00ab\u00a0Create New Embedding Parameter\u00a0\u00bb to create a variable called barycenter of the type Points (see screen 6.4)<\/li>\n<\/ul>\n<figure id=\"attachment_517\" aria-describedby=\"caption-attachment-517\" style=\"width: 714px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-517 size-full\" src=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/129.jpg\" alt=\"\" width=\"714\" height=\"178\" srcset=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/129.jpg 714w, http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/129-300x75.jpg 300w\" sizes=\"(max-width: 714px) 100vw, 714px\" \/><figcaption id=\"caption-attachment-517\" class=\"wp-caption-text\">Screen 6.4: Embedding parameters<\/figcaption><\/figure>\n<h3><strong>THE MIDPROCESS<\/strong><\/h3>\n<p><span style=\"color: #0000ff;\"><div class=\"su-note\"  style=\"border-color:#e5e5e5;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#ffffff;border-color:#ffffff;color:#808080;\"><\/span><span style=\"color: #808080;\">The midprocess is a collection of operations which are executed before any changes are made to the matched sub-graph. This is different to the operations which are in the embedding expressions which are executed for each dart which is transformed at the time of the transformation.<\/span><\/p>\n<p><span style=\"color: #808080;\">It is therefor advantageous and sometimes necessary to put certain operations in the midprocess which must only be executed once or which are needed for the execution of embedding expressions. The latter case requires information to be passed from the midprocess to the embedding expressions in the form of embedding parameters which are variables you must declare in the \u00ab\u00a0Embedding Parameters\u00a0\u00bb window before using them in the midprocess and then the embedding expressions.<\/span><span style=\"color: #0000ff;\"><\/div><\/div><\/span><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>go back to \u00ab\u00a0Views\u00a0\u00bb and select \u00ab\u00a0Midprocess\u00a0\u00bb (see Screen 6.5)\n<ul>\n<li>use the centerPoint() method from Points to assign the center of the face to the barycenter variable<\/li>\n<li>return true to let Jerboa know that the midprocess is being successfully used<\/li>\n<li>Apply<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<figure id=\"attachment_519\" aria-describedby=\"caption-attachment-519\" style=\"width: 717px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-519 size-full\" src=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/132.jpg\" alt=\"\" width=\"717\" height=\"214\" srcset=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/132.jpg 717w, http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/132-300x90.jpg 300w\" sizes=\"(max-width: 717px) 100vw, 717px\" \/><figcaption id=\"caption-attachment-519\" class=\"wp-caption-text\">Screen 6.5: Midprocess<\/figcaption><\/figure>\n<ul>\n<li>edit the point embedding of the n3 node in the right pattern (see Screen 6.6)\n<ul>\n<li>calculate a point between the dart point of the face and the barycenter of the face and return it<\/li>\n<li>Apply<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<figure id=\"attachment_520\" aria-describedby=\"caption-attachment-520\" style=\"width: 720px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-520 size-full\" src=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/133.jpg\" alt=\"\" width=\"720\" height=\"232\" srcset=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/133.jpg 720w, http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/133-300x97.jpg 300w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><figcaption id=\"caption-attachment-520\" class=\"wp-caption-text\">Screen 6.6: point embedding expression<\/figcaption><\/figure>\n<ul>\n<li>Save, export and try your new rule on any face of any object<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3><strong>THE POSTPROCESS<\/strong><\/h3>\n<p><span style=\"color: #0000ff;\"><div class=\"su-note\"  style=\"border-color:#e5e5e5;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#ffffff;border-color:#ffffff;color:#808080;\"><\/span><span style=\"color: #808080;\">The postprocess is a collection of operations which are executed after the transformation or after the pattern matching or other preconditions fail. These operations are often used to reset values which are modified by the rule for the next time the rule is applied.<\/span><span style=\"color: #0000ff;\"><\/div><\/div><\/span><\/p>\n<p>&nbsp;<\/p>\n<p>You will write a rule which creates a new vertex after having asked the user of the rule which coordinates the point of the vertex must have. For this you will need to create the variables in the Embedding Parameters, set the variables using a pop up window and then create the darts with those variables.<\/p>\n<p>There is a method in the\u00a0 \u00ab\u00a0Points\u00a0\u00bb java class called \u00ab\u00a0public static Points askForCoords()\u00a0\u00bb which creates input dialog boxes asking for each coordinate of the point and returns an instance of Points.<\/p>\n<ul>\n<li>open the editor and create a new rule called \u201cCreateFreeVertex\u201d<\/li>\n<li>create a free node in the right pattern<\/li>\n<li>right click on the node four times to place the four loops (see Screen 6.7)<\/li>\n<\/ul>\n<figure id=\"attachment_527\" aria-describedby=\"caption-attachment-527\" style=\"width: 723px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-527 size-full\" src=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/137.jpg\" alt=\"\" width=\"723\" height=\"484\" srcset=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/137.jpg 723w, http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/137-300x201.jpg 300w\" sizes=\"(max-width: 723px) 100vw, 723px\" \/><figcaption id=\"caption-attachment-527\" class=\"wp-caption-text\">Screen 6.7: CreateFreeVertex<\/figcaption><\/figure>\n<ul>\n<li>create a variable for the input point (see Screen 6.8)\n<ul>\n<li>click on \u00ab\u00a0Views\u00a0\u00bb then on \u00ab\u00a0Embedding Parameters\u00a0\u00bb<\/li>\n<li>click on \u00ab\u00a0Create New Embedding Parameter\u00a0\u00bb<\/li>\n<li>give it a name (for example: myPoint)<\/li>\n<li>the type is \u00ab\u00a0Points\u00a0\u00bb and it needs a default value which is provided by the new Points() constructor<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<figure id=\"attachment_523\" aria-describedby=\"caption-attachment-523\" style=\"width: 719px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-523 size-full\" src=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/135.jpg\" alt=\"\" width=\"719\" height=\"242\" srcset=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/135.jpg 719w, http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/135-300x101.jpg 300w\" sizes=\"(max-width: 719px) 100vw, 719px\" \/><figcaption id=\"caption-attachment-523\" class=\"wp-caption-text\">Screen 6.8: Embedding parameters<\/figcaption><\/figure>\n<ul>\n<li>write the midprocess (see Screen 6.9)\n<ul>\n<li>click on \u00ab\u00a0Views\u00a0\u00bb then on \u00ab\u00a0Midprocess\u00a0\u00bb<\/li>\n<li>use the \u00ab\u00a0askForCoords()\u00a0\u00bb method from \u00ab\u00a0Points\u00a0\u00bb to assign a value to \u00ab\u00a0myPoint\u00a0\u00bb<\/li>\n<li>add a \u00ab\u00a0return true;\u00a0\u00bb statement<\/li>\n<li>Apply<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<figure id=\"attachment_466\" aria-describedby=\"caption-attachment-466\" style=\"width: 714px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-466 size-full\" src=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/115.jpg\" alt=\"\" width=\"714\" height=\"278\" srcset=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/115.jpg 714w, http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/115-300x117.jpg 300w\" sizes=\"(max-width: 714px) 100vw, 714px\" \/><figcaption id=\"caption-attachment-466\" class=\"wp-caption-text\">Screen 6.9: Midprocess<\/figcaption><\/figure>\n<ul>\n<li>write the point embedding expression (see Screen 6.10)\n<ul>\n<li>edit the point embedding of the node in the right pattern<\/li>\n<li>return myPoint<\/li>\n<li>Apply<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<figure id=\"attachment_467\" aria-describedby=\"caption-attachment-467\" style=\"width: 715px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-467 size-full\" src=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/116.jpg\" alt=\"\" width=\"715\" height=\"279\" srcset=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/116.jpg 715w, http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/116-300x117.jpg 300w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><figcaption id=\"caption-attachment-467\" class=\"wp-caption-text\">Screen 6.10: point embedding expression<\/figcaption><\/figure>\n<ul>\n<li>save and export then try your new rule (this rule needs to be applied without selecting any darts) and check that it&rsquo;s position is correct<\/li>\n<li>try the rule twice to see whether the values are kept from one application to the next as default values<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>You will now modify your CreateFreeVertex rule so that it can be applied without showing the pop up window every time (for example: in s script like you will learn in the next lesson). To do so you will just need to create a boolean which determines whether to ask for the coordinates or not, this boolean can have true as a default value and be set to false by the script but then it must be reset to true at the end of the operation so that next time you want to use it, you will be able to input the coordinates.<\/p>\n<ul>\n<li>open the editor and edit the CreateFreeVertex rule<\/li>\n<li>in the embedding parameters, add a variable called \u00ab\u00a0askUser\u00a0\u00bb of the type boolean and set it to true (see Screen 6.11)<\/li>\n<\/ul>\n<figure id=\"attachment_521\" aria-describedby=\"caption-attachment-521\" style=\"width: 718px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-521 size-full\" src=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/134.jpg\" alt=\"\" width=\"718\" height=\"239\" srcset=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/134.jpg 718w, http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/134-300x100.jpg 300w\" sizes=\"(max-width: 718px) 100vw, 718px\" \/><figcaption id=\"caption-attachment-521\" class=\"wp-caption-text\">Screen 6.11: Embedding parameters<\/figcaption><\/figure>\n<ul>\n<li>in the midprocess add an \u00ab\u00a0if\u00a0\u00bb statement wherein the condition is askUser and the instruction is the assignment of myPoint using askForCoords (see Screen 6.12)<\/li>\n<\/ul>\n<figure id=\"attachment_524\" aria-describedby=\"caption-attachment-524\" style=\"width: 715px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-524 size-full\" src=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/121-1.jpg\" alt=\"\" width=\"715\" height=\"276\" srcset=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/121-1.jpg 715w, http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/121-1-300x116.jpg 300w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><figcaption id=\"caption-attachment-524\" class=\"wp-caption-text\">Screen 6.12: Midprocess<\/figcaption><\/figure>\n<ul>\n<li>now go to Views and open the \u00ab\u00a0Postprocess\u00a0\u00bb and set askUser to true, this means that the last thing this operation does is set the boolean to true in case it has been set to false (see Screen 6.13)<\/li>\n<\/ul>\n<figure id=\"attachment_475\" aria-describedby=\"caption-attachment-475\" style=\"width: 712px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-475 size-full\" src=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/117.jpg\" alt=\"\" width=\"712\" height=\"277\" srcset=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/117.jpg 712w, http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-content\/uploads\/2018\/07\/117-300x117.jpg 300w\" sizes=\"(max-width: 712px) 100vw, 712px\" \/><figcaption id=\"caption-attachment-475\" class=\"wp-caption-text\">Screen 6.13: Postprocess<\/figcaption><\/figure>\n<ul>\n<li>Apply, save and export then try the operation, it should work just as it did before but now you will be able to use it in a script in the next lesson without having the input dialog popping up<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<hr \/>\n<h3><strong>What have you learned ?<\/strong><\/h3>\n<ul>\n<li>What type of precondition can you use to sew two faces together only if they are the same color?<\/li>\n<li>How many times is the midprocess executed when a rule is applied?<\/li>\n<li>How many times is an embedding expression executed when a rule is applied?<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; In this lesson you will learn which steps take place in the execution cycle of a rule. You will learn how to optimize the operations, set preconditions to a rule as well as parameters. You will discover and use the Precondition, Midprocess and Postprocess in the editor of the modeler you have been using &hellip; <a href=\"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/lesson-6-using-the-execution-cycle\/\" class=\"more-link\">Continuer la lecture de <span class=\"screen-reader-text\">Lesson 6: Utilize the execution cycle of rules<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-json\/wp\/v2\/pages\/248"}],"collection":[{"href":"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-json\/wp\/v2\/comments?post=248"}],"version-history":[{"count":25,"href":"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-json\/wp\/v2\/pages\/248\/revisions"}],"predecessor-version":[{"id":567,"href":"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-json\/wp\/v2\/pages\/248\/revisions\/567"}],"wp:attachment":[{"href":"http:\/\/xlim-sic.labo.univ-poitiers.fr\/jerboa\/doc\/wp-json\/wp\/v2\/media?parent=248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}