<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: If Operation-Comment includes text in HSM Post Processor Forum</title>
    <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/if-operation-comment-includes-text/m-p/9590811#M7791</link>
    <description>&lt;P&gt;Hi @Anonymous&lt;/P&gt;
&lt;P&gt;includes method is not supported currently so could use match method to achieve what you have wanted&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;  if (hasParameter("operation-comment")) {
    var comment = getParameter("operation-comment");
    var trim = comment.trim();
    var n =trim.match(/.{1,5}/g);  
    var k = n.slice(0,1);
    if (k){
        if ((k == "Board")|| (k == "BOARD")) {
          writeBlock(mFormat.format(05));
          writeBlock(mFormat.format(28));
          writeBlock(mFormat.format(122));
          writeBlock(mFormat.format(4001));
          writeBlock(mFormat.format(00) + ';Reload, then press Start');
          writeComment(comment);
          writeBlock('(UAO,99)');
          writeBlock(mFormat.format(121));
          writeBlock(mFormat.format(29));
          writeBlock(sOutput.format(spindleSpeed));
          writeBlock(mFormat.format(tool.clockwise ? 3 : 4));
        } else{
          writeComment(comment);
        }
    }
  }&lt;/LI-CODE&gt;
&lt;P&gt;It checks for the first 5 characters of the operation comment and if it Board or BOARD it will pass the comments else return the comment&lt;/P&gt;
&lt;P&gt;It should work let me know how it goes&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 20 Jun 2020 07:53:59 GMT</pubDate>
    <dc:creator>boopathi.sivakumar</dc:creator>
    <dc:date>2020-06-20T07:53:59Z</dc:date>
    <item>
      <title>If Operation-Comment includes text</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/if-operation-comment-includes-text/m-p/9590088#M7790</link>
      <description>&lt;P&gt;I am a first time poster here and a new Fusion 360 user.&amp;nbsp; I've played with it a few times primarily in design.&amp;nbsp; My relevant experience is with MasterCam and SolidWorks.&amp;nbsp; Until yesterday, I had never touched Javascript.&amp;nbsp; I have successfully, adjusted a stock post to put out everything as I would like with the exception of a conditional string of M-codes based on the toolpath name.&amp;nbsp; I've made a few failed attempts and have no idea if I am getting closer or farther away.&amp;nbsp; Looking for some help.&amp;nbsp; Below are some screenshots of what I want to do:&amp;nbsp; name certain toolpaths, run through the post and result in code that looks like the last photo.&amp;nbsp; The post in its current condition and the latest error log are attached.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Prepost" style="width: 290px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/785710i465B615CA73CEB59/image-size/large?v=v2&amp;amp;px=999" role="button" title="360 Toolpath.JPG" alt="Prepost" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Prepost&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Faulty Post Code" style="width: 673px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/785711i2EB29E6A8C748B24/image-size/large?v=v2&amp;amp;px=999" role="button" title="Code from Post.JPG" alt="Faulty Post Code" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Faulty Post Code&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Check Out That Feedrate!" style="width: 420px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/785712i4B784099B07D0D7E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Desired Output.JPG" alt="Check Out That Feedrate!" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Check Out That Feedrate!&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2020 17:42:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/if-operation-comment-includes-text/m-p/9590088#M7790</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-19T17:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: If Operation-Comment includes text</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/if-operation-comment-includes-text/m-p/9590811#M7791</link>
      <description>&lt;P&gt;Hi @Anonymous&lt;/P&gt;
&lt;P&gt;includes method is not supported currently so could use match method to achieve what you have wanted&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;  if (hasParameter("operation-comment")) {
    var comment = getParameter("operation-comment");
    var trim = comment.trim();
    var n =trim.match(/.{1,5}/g);  
    var k = n.slice(0,1);
    if (k){
        if ((k == "Board")|| (k == "BOARD")) {
          writeBlock(mFormat.format(05));
          writeBlock(mFormat.format(28));
          writeBlock(mFormat.format(122));
          writeBlock(mFormat.format(4001));
          writeBlock(mFormat.format(00) + ';Reload, then press Start');
          writeComment(comment);
          writeBlock('(UAO,99)');
          writeBlock(mFormat.format(121));
          writeBlock(mFormat.format(29));
          writeBlock(sOutput.format(spindleSpeed));
          writeBlock(mFormat.format(tool.clockwise ? 3 : 4));
        } else{
          writeComment(comment);
        }
    }
  }&lt;/LI-CODE&gt;
&lt;P&gt;It checks for the first 5 characters of the operation comment and if it Board or BOARD it will pass the comments else return the comment&lt;/P&gt;
&lt;P&gt;It should work let me know how it goes&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jun 2020 07:53:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/if-operation-comment-includes-text/m-p/9590811#M7791</guid>
      <dc:creator>boopathi.sivakumar</dc:creator>
      <dc:date>2020-06-20T07:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: If Operation-Comment includes text</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/if-operation-comment-includes-text/m-p/9595675#M7792</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8049428"&gt;@boopathi.sivakumar&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;This works exactly as desired.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2020 10:57:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/if-operation-comment-includes-text/m-p/9595675#M7792</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-23T10:57:43Z</dc:date>
    </item>
  </channel>
</rss>

