Manual NC

Manual NC

uladzimiruser
Advocate Advocate
2,164 Views
14 Replies
Message 1 of 15

Manual NC

uladzimiruser
Advocate
Advocate

Hello. That is the question that arose. How in a postprocessor to move a line with a manual code to another place.

Postprocessor output like this:

N6( D27.5)
G0 G28 U0.
G28 W0.
M60
G98 G18
T0909
(DRILL D27.5-1)
M8
G97 S850 M3 P11
G0 Z7.
X0.
G80
G0 Z2.
G83 Z-56. R-1. Q10000 F59.5
G80
G0 Z7.
M301
M9
G28 U0.
G28 W0.
M1

 

Required like this:

N6( D27.5)
G0 G28 U0.
G28 W0.
M60
G98 G18
T0909
(DRILL D27.5-1)
M8
G97 S850 M3 P11
G0 Z7.
X0.
G80
G0 Z2.
G83 Z-56. R-1. Q10000 F59.5
G80
G0 Z7.
M9
G28 U0.
G28 W0.
M1

M301

 

Postprocessor doosan_20mill-turn_fanuc , samsung_20mill-turn_fanuc .

0 Likes
Accepted solutions (2)
2,165 Views
14 Replies
Replies (14)
Message 2 of 15

bob.schultz
Alumni
Alumni

Section 5.1.2 Delay Processing of Manual NC Commands  of the Post Processor Training Guide explains how to delay the output of Manual NC commands (output them in whatever location you want).  Please take a look at this document and see if it explains well enough.  Feel free to ask questions concerning this logic if necessary.



Bob Schultz
Sr. Post Processor Developer

Message 3 of 15

uladzimiruser
Advocate
Advocate

I found the function itself

(function onPassThrough(text) {
writeBlock(text);
}),

but I still can’t understand its logic. When entering at the beginning of the program, this function is in the right place, and if this function is located between processing transitions, it is displayed a little out of place. As far as I understand, is it enough for me to register (executeManualNC) anywhere where I want to see this function?

0 Likes
Message 4 of 15

bob.schultz
Alumni
Alumni
Accepted solution

You will need to add the following functions to your post first.  You can copy and paste this code before the onSection function.

/**
 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)) {
      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);
    }
  }
}

Now you will add the executeManual call in the location where you want to execute the Manual NC command, in your case the Pass Through command.

    if (!isFirstSection() && properties.optionalStop) {
      onCommand(COMMAND_OPTIONAL_STOP);
    }
    
    executeManualNC();  // ADD THIS LINE

The previous section is always ended at the beginning of the onSection function, which is why you are seeing your M-code output in the wrong place.  Adding these functions and call allows you to process the Manual NC command anywhere in your program that you want.

 



Bob Schultz
Sr. Post Processor Developer

Message 5 of 15

uladzimiruser
Advocate
Advocate

Everything seems to work out. But now there was such a misfortune. Before the introduction of this function, commands written in manual mode at the beginning of the program were displayed correctly.
1 Attachment 1.nc
And when adding this function, they were transferred to the very bottom of the program, where I indicated this function.
2 Attachment .nc

As far as I understand, I now need a function
   if (! isFirstSection () && properties.onPassThrough) {
       onCommand (COMMAND_PASS_THROUGH);
     }
    
     executeManualNC (); // ADD THIS LINE
Move to the beginning of the program?

 

 

0 Likes
Message 6 of 15

bob.schultz
Alumni
Alumni
Accepted solution

You should be able to insert the following code at the top of the onSection function to execute the Manual NC commands placed before the first operation.

function onSection() {
  
  if (isFirstSection()) {
    executeManualNC();
  }

 

 



Bob Schultz
Sr. Post Processor Developer

Message 7 of 15

tomae
Collaborator
Collaborator

I have essentially the same problem as this thread describes.  But try as I might I can't get the right combination of commands to post things where I want.  See this post:  

https://forums.autodesk.com/t5/fusion-360-manufacture/manual-nc-posting-before-machine-retracts/td-p...

 

-Tom

 

0 Likes
Message 8 of 15

bob.schultz
Alumni
Alumni

There is a mistake in the shown code for the executeManualNC command listed in this thread.  It should look like the following, otherwise multiple consecutive Manual NC commands will leave remnants for the following section (they will be processed twice).

  for (var i = manualNC.length -1; i >= 0; --i) {  // THIS LINE IS CHANGED
    if (!command || (command == manualNC[i].command)) {
      manualNC.splice(i, 1);
    }
  }

 



Bob Schultz
Sr. Post Processor Developer

Message 9 of 15

tomae
Collaborator
Collaborator

Thanks, that did it!

-Tom

0 Likes
Message 10 of 15

militiaproducts
Contributor
Contributor

I just want to say thank you. I have probably spent 20 hrs trying to figure out how to do this.

Cw

Message 11 of 15

militiaproducts
Contributor
Contributor

I am revisting this issue. I thought I had it handled, but really it isnt. I want the pass through to be at the end of the tool, after it goes home, and it is always before the M5,M8,home move, so I always manually enter that in my pass through to be safe. I am sure there is a correct way to do this. I tried to copy and paste in your above commands, and it changed things, but its not correct. I will attatch the "test" post I have been messing with, along with the good one I use all the time.

 

Another thing that I would like to have is as in this instance, there are 2 features with the same tool. I would like it to post the 2nd one with all the required info so I can start at that point if needed. In all situations. Like if you are rough turning with T5, then finishing with T5, I may want to re run the finish. I have to reenter the needed info manually.

Thanks

cw

 

N2(DRILL4)
G00 G28 U0.
G53 Z-4.
M69
G54
G98 G18 M46
T1111
M621
G97 S382 M03
G00 Z0.625
X0.
G80
G00 Z0.225
G83 Z-2.8253 R-0.085 F1.91
G80
G00 Z0.625
G28 U0.
G53 Z-4.
                                 (should have the M100 p12 here)
(DRILL4 2)
G97 S509 M03
G01 X0. Z0.625 F10.
G00 Z0.225
G83 Z-6.4253 R-2.2871 F1.528
G80
G00 Z0.625
G28 U0.
G53 Z-4.
M05
M622
M100 P12  (this should be after home move above)
M105 P12
M110 P12
0 Likes
Message 12 of 15

bob.schultz
Alumni
Alumni

It is important to know that buffered Manual NC commands will be output whenever the executeManualNC command is processed so you must place these calls in the exact location where you want Manual NC commands executed, or in your case where you want the Passthrough text output.  To process these commands just before the new operation starts, you should place the executeManual NC command just prior to where the operation comment is output.

 

  // Output the operation description
  writeln("");
  executeManualNC();  // <<< executes the Manual NC commands at this location
  if (hasParameter("operation-comment")) {

 

Likewise, in the onClose function you should place the call immediately after the call to goHome.

 

  // Move to home position
  goHome();
  executeManualNC();  // ADD THIS LINE

 

You will also want to move the definition of the onPassThrough function outside of the onClose function.  You shouldn't place a function definition within another function definition.

 

function onPassThrough(text) {
  writeBlock(text);
}
  
function onClose() {

 

You can force out a tool change between operations that use the same tool by using the Force tool change Manual NC command.

 

bobschultz_0-1638206340789.png

 



Bob Schultz
Sr. Post Processor Developer

0 Likes
Message 13 of 15

militiaproducts
Contributor
Contributor

I am closer, but why would it post the second line of the first pass through again at the beginning of the second?

 

G28 U0.
G53 Z-4.
M01

M100 P12
M105 P123  (first correct time)
N3(DRILL4 2)
G00 G28 U0.
G53 Z-4.
M69
G54
G98 G18 M46
T1111
M08
G97 S509 M03
G00 Z0.625
X0.
G00 Z0.225
G83 Z-6.4253 R-2.2871 F1.528
G80
G00 Z0.625
G28 U0.
G53 Z-4.
M05
M09

M201 (CHIP CONVEYOR STOP)
G00 G28 U0.
G53 Z-4.
M105 P123    (2nd  incorrect time)
M110 P12
M46
G54

M30
%
0 Likes
Message 14 of 15

bob.schultz
Alumni
Alumni

The code you used in executeManualNC is old code that is incorrect.  You should replace the following ...

  for (var i = 0; i < manualNC.length; ++i) {
    if (!command || (command == manualNC[i].command)) {
      manualNC.splice(i, 1);
    }
  }

 

... with this code.

 

  for (var i = manualNC.length - 1; i >= 0; --i) {
    if (!command || (command == manualNC[i].command)) {
      manualNC.splice(i, 1);
    }
  }

 



Bob Schultz
Sr. Post Processor Developer

0 Likes
Message 15 of 15

militiaproducts
Contributor
Contributor

well that worked. I will play around with this.

I really want to thank you for your help with this. It is priceless.

I wish I understood what the language meant. I am limited to copy and pasting what you said.

Thanks again.

cw

0 Likes