M code after Tapping Cycles

ifuASTJY
Advocate
Advocate

M code after Tapping Cycles

ifuASTJY
Advocate
Advocate

I need a M128 after tapping cycles in generic FANUC turning post.

the structure is like this:

G0 Z5.
M129 S400
G84 X0. Z-22.5 R4.5 P0 F500.
G80
Would need here M128
Z15.
M5
G28 U0.
 
Thanks!
0 Likes
Reply
Accepted solutions (1)
434 Views
4 Replies
Replies (4)

Marco.Takx
Mentor
Mentor

Hi @ifuASTJY,

 

Try visual studio to make your easy modifications.

Check this link below.

Post Processor editing 

If my post answers your question Please use  Mark Solutions!.Accept as Solution & Give Kudos!Kudos This helps everyone find answers more quickly!

Met vriendelijke groet | Kind regards | Mit freundlichem Gruß

Marco Takx
CAM Programmer & CAM Consultant



1 Like

jameshorne0503
Advocate
Advocate

I agree with Marco on using visual studio code to learn how to make generic changes and tune in your post but for a direct answer you'll need to edit the section of your post that begins on the line:

 

function onCycleEnd() {

 

As a default this will be followed by:

 

if (!cycleExpanded) {
switch (cycleType) {
case "thread-turning":
forceFeed();
xOutput.reset();
zOutput.reset();
g92ROutput.reset();
break;
default:
writeBlock(gCycleModal.format(80));
}
}

 

You will need to add in the cycles you want inbetween cycleType and default. For example to add you M-code for only tapping (standard tapping only, this will not add to the tapping with chip breaking etc):

 

if (!cycleExpanded) {
switch (cycleType) {
case "thread-turning":
forceFeed();
xOutput.reset();
zOutput.reset();
g92ROutput.reset();
break;

case "tapping":

writeBlock(gCycleModal.format(80));

writeBlock(mFormat.format(128));

break;
default:
writeBlock(gCycleModal.format(80));
}
}

 

If you need other tapping cycles to act the same you can sort of stack the cases:

 

if (!cycleExpanded) {
switch (cycleType) {
case "thread-turning":
forceFeed();
xOutput.reset();
zOutput.reset();
g92ROutput.reset();
break;

case "tapping":

case "left-tapping":

case "right-tapping":

case "tapping-with-chip-breaking":
case "left-tapping-with-chip-breaking":
case "right-tapping-with-chip-breaking":

writeBlock(gCycleModal.format(80));

writeBlock(mFormat.format(128));

break;
default:
writeBlock(gCycleModal.format(80));
}
}

 

For basic edits like this I like to use Notepad++ and I set the language to JavaScript to highlight what it should but equally these edits can be done in Visual Studio Code.

 

Does this answer your question?

0 Likes

jameshorne0503
Advocate
Advocate
Accepted solution

I agree with Marco about using VS Code for general edits and tuning of the post processor but I think this may be a more direct answer to your question:

 

I would personally do these edits in Notepad++ with Javascript set as the language but this could equally be done in VS Code.

 

In the Fanuc Turning post processor you'll need to find the line:

 

function onCycleEnd() {

 

This defines what's put after each cycle based on cycle type. As a default only the thread-turning has specific end of cycle code. You'll have to edit your Post as follows:

 

function onCycleEnd() {
if (!cycleExpanded) {
switch (cycleType) {
case "thread-turning":
forceFeed();
xOutput.reset();
zOutput.reset();
g92ROutput.reset();
break;

case "tapping":

writeBlock(gCycleModal.format(80));

writeBlock(mFormat.format(128));

break;
default:
writeBlock(gCycleModal.format(80));
}
}
}

 

It's worth noting that this will only add that M-code to tapping. If you wanted to add that to other types of tapping you would have to add those too. To avoid typing the whole block out multiple times you can stack the cases like so:

 

function onCycleEnd() {
if (!cycleExpanded) {
switch (cycleType) {
case "thread-turning":
forceFeed();
xOutput.reset();
zOutput.reset();
g92ROutput.reset();
break;

case "tapping":

case "left-tapping":

case "right-tapping":

case "tapping-with-chip-breaking":
case "left-tapping-with-chip-breaking":
case "right-tapping-with-chip-breaking":

writeBlock(gCycleModal.format(80));

writeBlock(mFormat.format(128));

break;
default:
writeBlock(gCycleModal.format(80));
}
}
}

 

I hope this helps!

1 Like

ifuASTJY
Advocate
Advocate

Hi guys,

Thanks for the code, I went for the easy way this time I admit.

I do use visual code for editing posts and also for view/edit nc programs.

I  always try and fix my posts my self and get the logic behind the post structure but I use visual/javascipt not that often now that we have all our post running ok on most of our machines.

Thanks!

 

1 Like