<?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: Improved handling of Manual NC commands in HSM Post Processor Forum</title>
    <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9499622#M10976</link>
    <description>&lt;LI-CODE lang="general"&gt;%
O1001
G21
M110
M24
TEST START  *Pass through code as written*
M1          
M2
M3
M4
M5
M6
TEST END    *******************

N1(FACE2)
G0 G28 G53 B0. (SUB SPINDLE RETURN)
G28 U0. V0.
G28 W0.
M90
G54
G99 G18 M34
G50 S2500
T0101
M8
G97 S2465 M3 P11
G0 Z5.5
X90.4 Y0.
G96 S700 M3 P11
Z1.514
X70.4
G1 X63.228 F0.2
X60.4 Z0.1
X-1.8
X1.028 Z1.514
G0 X90.4
Z5.5
G97 S2465 M3 P11
M1  *Some of the Pass Through code has randomly made its way here*
M3  *********
M5  *********
TEST END **********&lt;/LI-CODE&gt;&lt;P&gt;It seems I'm still having trouble with erratic behaviour.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've attached the post, but I can't share the file that produced this code publicly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can pm you with the file if you would like to take a look?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 May 2020 16:14:22 GMT</pubDate>
    <dc:creator>Dave_Moxham1</dc:creator>
    <dc:date>2020-05-07T16:14:22Z</dc:date>
    <item>
      <title>Improved handling of Manual NC commands</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/8904847#M10968</link>
      <description>&lt;P&gt;The new entry function &lt;EM&gt;onManualNC&lt;/EM&gt; has been added to the post processor kernel in the latest version of Fusion, allowing for a single point of entry for handling Manual NC commands.&amp;nbsp; When the &lt;EM&gt;onManualNC&lt;/EM&gt; function is defined in your post processor, this function will be called for all Manual NC commands, rather than the method of calling different entry functions (onCommand, onPassthrough, onParameter, etc.).&amp;nbsp; If this function is not defined, then the standard method will be used, as it currently is in all generic post processors, so existing post processors do not have to be updated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A helper function, &lt;EM&gt;expandManualNC&lt;/EM&gt;, has also been added.&amp;nbsp; This function is not defined in the post processor, but rather is called to process a Manual NC command using the standard methods as described above.&amp;nbsp; Both of these functions are passed the command and value for the Manual NC command.&lt;/P&gt;
&lt;PRE&gt;function onManualNC(command, value)
expandManualNC(command, value)
&lt;/PRE&gt;
&lt;P&gt;The following example shows how the &lt;EM&gt;Display message&lt;/EM&gt; Manual NC command can be processed in the &lt;EM&gt;onManualNC&lt;/EM&gt; function and all other commands in their normal functions.&lt;/P&gt;
&lt;PRE&gt;function onManualNC(command, value) {
  switch (command) {
  case COMMAND_DISPLAY_MESSAGE: &lt;STRONG&gt;// prepend ‘MSG,’ to operator messages&lt;/STRONG&gt;
    writeComment("MSG, " + value);
    break;
  default:
    expandManualNC(command, value);  &lt;STRONG&gt;// normal processing of Manual NC command&lt;/STRONG&gt;
  }
}
&lt;/PRE&gt;
&lt;P&gt;Another benefit of these functions is the ability to buffer the Manual NC commands and output them wherever you desire in the program, rather than always prior to the &lt;EM&gt;onSection&lt;/EM&gt; call.&amp;nbsp; You do this by adding the following code to your post processor.&lt;/P&gt;
&lt;PRE&gt;&lt;STRONG&gt;/**
  Buffer Manual NC commands for processing later
*/&lt;/STRONG&gt;
var manualNC = [];
function onManualNC(command, value) {
  manualNC.push({command:command, value:value});
}

&lt;STRONG&gt;/**
  Processes the Manual NC commands
  Pass the desired command to process or leave argument list blank to process all buffered commands
*/&lt;/STRONG&gt;
function executeManualNC(command) {
  for (var i = 0; i &amp;lt; manualNC.length; ++i) {
    if (!command || (command == manualNC[i].command)) {
      switch(manualNC[i].command) {
     /* case COMMAND_DISPLAY_MESSAGE: &lt;STRONG&gt;// sample on explicit execution of Manual NC command&lt;/STRONG&gt;
        writeComment("MSG, " + manualNC[i].value);
        break;*/
      default:
        expandManualNC(manualNC[i].command, manualNC[i].value);
      }
    }
  }
  for (var i = 0; i &amp;lt; manualNC.length; ++i) {
    if (!command || (command == manualNC[i].command)) {
      manualNC.splice(i, 1);
    }
  }
}
&lt;/PRE&gt;
&lt;P&gt;You can now call the &lt;EM&gt;executeManualNC&lt;/EM&gt; command wherever you want the Manual NC commands to be output, simply by calling it with a parameter to specify which command you want processed at this time, or with a blank argument to process all buffered Manual NC commands.&amp;nbsp; The following example will output the &lt;EM&gt;Display message&lt;/EM&gt; command prior to the tool change block and all other commands after the tool change block.&lt;/P&gt;
&lt;PRE&gt;    executeManualNC(COMMAND_DISPLAY_MESSAGE);  &lt;STRONG&gt;// display Manual NC messages&lt;/STRONG&gt;
    writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6));
    if (tool.comment) {
      writeComment(tool.comment);
    }
    executeManualNC(); &lt;STRONG&gt;// process remaining Manual NC commands
&lt;/STRONG&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jul 2019 20:57:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/8904847#M10968</guid>
      <dc:creator>bob.schultz</dc:creator>
      <dc:date>2019-07-11T20:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Improved handling of Manual NC commands</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9148902#M10969</link>
      <description>&lt;P&gt;a good solution.&lt;/P&gt;&lt;P&gt;Can You also make an example with a few "Action" commands with values?&lt;/P&gt;&lt;P&gt;My JS is not very well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2019 13:28:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9148902#M10969</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-11-15T13:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: Improved handling of Manual NC commands</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9148941#M10970</link>
      <description>&lt;P&gt;You can find a good example of parsing Action commands, some with values, some without, in the &lt;A href="https://cam.autodesk.com/hsmposts?p=doosan_mill-turn_fanuc" target="_blank" rel="noopener"&gt;Doosan Mill/Turn&lt;/A&gt; post.&amp;nbsp; Take a look at the &lt;EM&gt;onParameter&lt;/EM&gt; function (all existing posts use the old method of parsing Manual NC commands).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will see a list of supported commands in the comments at the top of the post processor.&amp;nbsp; Let me know if you have any questions.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2019 13:41:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9148941#M10970</guid>
      <dc:creator>bob.schultz</dc:creator>
      <dc:date>2019-11-15T13:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: Improved handling of Manual NC commands</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9494572#M10971</link>
      <description>&lt;P&gt;I'm having trouble getting this to work in the Doosan Mill turn post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like manual NC to post after the machine homes and the M1 at the very end of each section, but also at the beginning if isFirstsection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have read the other threads on this subject, but I'm still struggling. Can someone help me out please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 23:18:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9494572#M10971</guid>
      <dc:creator>Dave_Moxham1</dc:creator>
      <dc:date>2020-05-05T23:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: Improved handling of Manual NC commands</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9494623#M10972</link>
      <description>&lt;P&gt;You can start with copying the following code into your post.&amp;nbsp; You can place it between any functions, for example just above the &lt;EM&gt;onParameter&lt;/EM&gt; function.&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;/**
  Buffer Manual NC commands for processing later
*/
var manualNC = [];
function onManualNC(command, value) {
  manualNC.push({command:command, value:value});
}

/**
  Processes the Manual NC commands
  Pass the desired command to process or leave argument list blank to process all buffered commands
*/
function executeManualNC(command) {
  for (var i = 0; i &amp;lt; manualNC.length; ++i) {
    if (!command || (command == manualNC[i].command)) {
      switch(manualNC[i].command) {
     /* case COMMAND_DISPLAY_MESSAGE: // sample on explicit execution of Manual NC command
        writeComment("MSG, " + manualNC[i].value);
        break;*/
      default:
        expandManualNC(manualNC[i].command, manualNC[i].value);
      }
    }
  }
  for (var i = 0; i &amp;lt; manualNC.length; ++i) {
    if (!command || (command == manualNC[i].command)) {
      manualNC.splice(i, 1);
    }
  }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now you will want to add a call to &lt;EM&gt;executeManualNC&lt;/EM&gt; where you want the commands processed.&amp;nbsp; For example, if you want the commands output after the home position move in the Doosan Mill/Turn post you would place it here.&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;  // Process Manual NC commands
  executeManualNC();

  // Consider part cutoff as stockTransfer operation
  if (!(machineState.stockTransferIsActive &amp;amp;&amp;amp; partCutoff)) {
    machineState.stockTransferIsActive = false;
  }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;The Manual NC commands&amp;nbsp; will be processed where ever you place this call.&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 23:40:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9494623#M10972</guid>
      <dc:creator>bob.schultz</dc:creator>
      <dc:date>2020-05-05T23:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: Improved handling of Manual NC commands</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9495847#M10973</link>
      <description>&lt;P&gt;Hi Bob,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your swift reply and I do apologise for making you post that section of code in these forums for what must be the 50th time!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have issues with the pass through text jumbling up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't post the part that I'm working on, but I'll model up a test part a bit later to try and demonstrate the issue.&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 11:41:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9495847#M10973</guid>
      <dc:creator>Dave_Moxham1</dc:creator>
      <dc:date>2020-05-06T11:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: Improved handling of Manual NC commands</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9495943#M10974</link>
      <description>&lt;P&gt;No worries, it is easier to post the code again than try to point someone to the correct block of code to include.&amp;nbsp; For the Pass Through text, here is a sample function that will output multiple lines of text separated by commas.&amp;nbsp; See if this solves your issue.&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;function onPassThrough(text) {
  var commands = String(text).split(",");
  for (text in commands) {
    writeBlock(commands[text]);
  }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 06 May 2020 12:16:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9495943#M10974</guid>
      <dc:creator>bob.schultz</dc:creator>
      <dc:date>2020-05-06T12:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: Improved handling of Manual NC commands</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9496854#M10975</link>
      <description>&lt;P&gt;Bob, you are the man!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 17:10:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9496854#M10975</guid>
      <dc:creator>Dave_Moxham1</dc:creator>
      <dc:date>2020-05-06T17:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: Improved handling of Manual NC commands</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9499622#M10976</link>
      <description>&lt;LI-CODE lang="general"&gt;%
O1001
G21
M110
M24
TEST START  *Pass through code as written*
M1          
M2
M3
M4
M5
M6
TEST END    *******************

N1(FACE2)
G0 G28 G53 B0. (SUB SPINDLE RETURN)
G28 U0. V0.
G28 W0.
M90
G54
G99 G18 M34
G50 S2500
T0101
M8
G97 S2465 M3 P11
G0 Z5.5
X90.4 Y0.
G96 S700 M3 P11
Z1.514
X70.4
G1 X63.228 F0.2
X60.4 Z0.1
X-1.8
X1.028 Z1.514
G0 X90.4
Z5.5
G97 S2465 M3 P11
M1  *Some of the Pass Through code has randomly made its way here*
M3  *********
M5  *********
TEST END **********&lt;/LI-CODE&gt;&lt;P&gt;It seems I'm still having trouble with erratic behaviour.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've attached the post, but I can't share the file that produced this code publicly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can pm you with the file if you would like to take a look?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 May 2020 16:14:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9499622#M10976</guid>
      <dc:creator>Dave_Moxham1</dc:creator>
      <dc:date>2020-05-07T16:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: Improved handling of Manual NC commands</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9500074#M10977</link>
      <description>&lt;P&gt;It seems you found an issue with the logic that we need to correct.&amp;nbsp; You can make the following change in the executeManualNC function to resolve this issue.&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;  for (var i = manualNC.length -1; i &amp;gt;= 0; --i) { // CHANGE THIS LINE
    if (!command || (command == manualNC[i].command)) {
      manualNC.splice(i, 1);
    }
  }&lt;/LI-CODE&gt;
&lt;P&gt;Walking forward through the array skips every other Manual NC command when removing them from the stack.&lt;/P&gt;</description>
      <pubDate>Thu, 07 May 2020 19:29:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9500074#M10977</guid>
      <dc:creator>bob.schultz</dc:creator>
      <dc:date>2020-05-07T19:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Improved handling of Manual NC commands</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9500175#M10978</link>
      <description>&lt;P&gt;Thanks Bob.&lt;/P&gt;</description>
      <pubDate>Thu, 07 May 2020 20:20:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/9500175#M10978</guid>
      <dc:creator>Dave_Moxham1</dc:creator>
      <dc:date>2020-05-07T20:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: Improved handling of Manual NC commands</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/13970063#M29841</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3704064"&gt;@bob.schultz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found this thread from another post:&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/fusion-manufacture-forum/post-help-m00-manual-stop-command/m-p/9321754" target="_blank"&gt;https://forums.autodesk.com/t5/fusion-manufacture-forum/post-help-m00-manual-stop-command/m-p/9321754&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking to achieve the same results but the solution does not seem applicable to my post. I am currently using a DS30Y post and looking for Manual NC and including pass-through codes to be output at the very end of the section after retraction to the safe position. After modifying my post with the buffering and execute codes as shown in the post processory training guide, I do not get any output at all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you offer any suggestions for this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jan 2026 23:55:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/improved-handling-of-manual-nc-commands/m-p/13970063#M29841</guid>
      <dc:creator>rdscinfo</dc:creator>
      <dc:date>2026-01-08T23:55:56Z</dc:date>
    </item>
  </channel>
</rss>

