Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Haas ST20Y Lathe Post = ManualNC Passthru issues

rw_skinner
Advocate

Haas ST20Y Lathe Post = ManualNC Passthru issues

rw_skinner
Advocate
Advocate

I tried this over on Fusion Mfg forum but no help.  See below please.  

 

ManualNC and PassThru on Generic Haas ST20Y post

ManualNC Multiline passthrough is leaving fragments of the Passthrough G-Code in several places after the initial entry.  The onClose section is picking up random lines of the preexisting passthru buffer.

 

Here is my "test" passthru - Just make believe stuff so I can easily identify it.

(PASS THRU TEST)

M30

M1

P4

 

 

Here is the section it puts it in, exactly where I want it.

N1980 G53 Y0.
N1990 G53 X-4.
N2000 G53 Z-15.

N2010 (PASS THRU TEST)
N2020 M30
N2030 M1
N2040 P4

(Cleanup Profile)
N2050 M1
N2060 T202
 
Now, here are the comments further down:
N2250 M30
N2260 P4
(Test after tool change and then empty bin)
 
And even further down:
N2440 G53 G0 Y0.
N2450 P4
(End of Program)
N2460 M30
%

 

Here is the ExecuteNc function.

/**
3/5/2024 RWS added   
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 < manualNC.length; ++i) { 
  //for (var i = manualNC.length -1; i >= 0; --i) { // <<< ADD THIS LINE - Didn't work, made all my passthru code backwards
    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;

        case COMMAND_STOP:
          writeBlock(mFormat.format(0));
          break;

        case COMMAND_COMMENT:
          writeComment(manualNC[i].value);
          break;

        case COMMAND_PASS_THROUGH:
          var newLine = ";";
          var commands = String(manualNC[i].value).split(newLine);
          //var commands = String(manualNC[i].value).split(",");
          for (text in commands) {
            writeBlock(commands[text]);
          }
          break;        
 
       default:
        expandManualNC(manualNC[i].command, manualNC[i].value);
      }
    }
  }
    for (var i = 0; i < manualNC.length; ++i) {
      if (!command || (command == manualNC[i].command)) {
        manualNC.splice(i, 1);
    }
  }
}
0 Likes
Reply
Accepted solutions (1)
531 Views
5 Replies
Replies (5)

aju_augustine
Autodesk
Autodesk

Hi @rw_skinner ,

 

You will have to replace a line in the post as shown below:

 

Original:

for (var i = 0; i < manualNC.length; ++i) {

 

Modified:

for (var i = manualNC.length - 1; i >= 0; --i) {

 

Output should look like the screenshot below:

1.png

 

I hope this helps!



Aju Augustine
Technology Consultant
0 Likes

rw_skinner
Advocate
Advocate

Thanks.  I originally had that, but then it post my multiline Passthru backwards from the bottom up instead of the top down but let me try it again.

0 Likes

rw_skinner
Advocate
Advocate

Yep, now the code is posted in reverse order.

My ManualNC code is:

G04 P2.0  (Wait for spindle to stop)

M22 (Tailstock Retrack)

 

Here is how it's posted in the gcode:

N680 M22 (Tailstock Retrack)
N690 G04 P2.0 (Wait for spindle to stop)
 

 

0 Likes

aju_augustine
Autodesk
Autodesk
Accepted solution

Hi @rw_skinner ,

 

Just replace the whole codes with with ones shown below:

 

/**
  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 < 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 = manualNC.length - 1; i >= 0; --i) {
    if (!command || (command == manualNC[i].command)) {
      manualNC.splice(i, 1);
    }
  }
}

 

I am assuming you have also added the following line before operation comment:

 

2.png

 

 

  executeManualNC();

 

It should work, if the problem still persists please share your post.

 



Aju Augustine
Technology Consultant
0 Likes

rw_skinner
Advocate
Advocate

Thanks, that fixed it.  I had modified the line under the function call instead of the last block of the function which makes sense why everything was backwards!!

function executeManualNC(command) {
    for (var i = manualNC.length -1; i >= 0; --i)

 

0 Likes