Modifying Postprocessor for Mach4

Modifying Postprocessor for Mach4

trains420
Participant Participant
1,773 Views
6 Replies
Message 1 of 7

Modifying Postprocessor for Mach4

trains420
Participant
Participant

Hello, I use Mach 4 on two machines. I have a problem with tool diameter compensation. In mach4, tool diameter correction can be entered in two ways:

 

Format 1: G00 / G01 G41 / G42 D__ X__ Y__ F__
Format 2: G00 / G01 G41 / G42 P__ X__ Y__ F__

 

Format 1 uses D to determine the tool diameter from the tool table.
Format 2 uses P to specify the tool radius (P5, P8, ...)

 

The point is that the Postprocessor for Mach 4 generates P, and I need to generate D with the appropriate tool number. When there is P in the program, I cannot edit tool corrections in the machine.

 

Can you help me ? Thank you in advance.

0 Likes
Accepted solutions (1)
1,774 Views
6 Replies
Replies (6)
Message 2 of 7

seth.madore
Community Manager
Community Manager

So you want it to post out:

T1M6

G43H1

G1G41X__Y__D1

 

Is the above correct?

 


Seth Madore
Customer Advocacy Manager - Manufacturing


0 Likes
Message 3 of 7

trains420
Participant
Participant
Yes. The "D" with the correct tool number must be used wherever "P" is now (at multiple depths).
0 Likes
Message 4 of 7

seth.madore
Community Manager
Community Manager
Accepted solution

So, it's going to take a couple small edits. The changes that I've listed below are from a STOCK Mach4 post, so it may differ slightly if you are running any changes

At line 118, we are going to change this:

var pFormat = createFormat({prefix:"P", decimals:(unit == MM ? 3 : 4), scale:0.5});

to this:

var pFormat = createFormat({prefix:"D", decimals:0});

And then we are going to scroll all the way down to line 1234 and 1238

and change the cutter comp sections from:

writeBlock(gMotionModal.format(1), gFormat.format(41), x, y, z, f, pOutput.format(tool.diameter));

to:

writeBlock(gMotionModal.format(1), gFormat.format(41), x, y, z, f, pOutput.format(tool.number));

Seth Madore
Customer Advocacy Manager - Manufacturing


0 Likes
Message 5 of 7

trains420
Participant
Participant

Yes, it looks like it works. Thank you very much for your help.

0 Likes
Message 6 of 7

Stuart-H
Collaborator
Collaborator

@seth.madore wrote:

So, it's going to take a couple small edits. The changes that I've listed below are from a STOCK Mach4 post, so it may differ slightly if you are running any changes

At line 118, we are going to change this:

var pFormat = createFormat({prefix:"P", decimals:(unit == MM ? 3 : 4), scale:0.5});

to this:

var pFormat = createFormat({prefix:"D", decimals:0});

And then we are going to scroll all the way down to line 1234 and 1238

and change the cutter comp sections from:

writeBlock(gMotionModal.format(1), gFormat.format(41), x, y, z, f, pOutput.format(tool.diameter));

to:

writeBlock(gMotionModal.format(1), gFormat.format(41), x, y, z, f, pOutput.format(tool.number));

Seth. don't forget the other bit

 

case RADIUS_COMPENSATION_RIGHT:
dOutput.reset();
writeBlock(gMotionModal.format(1), gFormat.format(42), x, y, z, dOutput.format(d), f );
break;
default:
writeBlock(gMotionModal.format(1), gFormat.format(40), x, y, z, f);

 

Taken from my PP for Mach 4

Mac Studio M1Max and MacBook Pro M1
0 Likes
Message 7 of 7

seth.madore
Community Manager
Community Manager

@Stuart-H yes, that was the "and 1238" bit, I should have clarified.

1234 was the section for comp Left

1238 was the section for comp Right

Both need changing

 


Seth Madore
Customer Advocacy Manager - Manufacturing


0 Likes