Post Processor Lessons - Lesson 2
Post Modification Lesson 2: Moving Tool change Variables
In this lesion we will cover making some common modifications to the tool change blocks that may be required for your machine tool. We are going to use the following files for this lesson:
Machine File: BC_3x_Mill
Post Processor: BC_3x_Mill.BCPst
Part File: Post Guide – Lesson 2.bbcd |
|
This test file includes multiple machining features. Each feature contains multiple operations to complete the part. It is important when creating, customizing, or modifying post processors that you test all machining scenarios to ensure the post processor is working fully on the machine tool.
This includes but is not limited to:
-
Profile Milling with and without machine cutter compensation
-
All drilling canned cycles supported by the software and the machine
-
Tool Change blocks
-
Subprogram output
-
File ending
For this modification we will alter the tool change blocks to accomplish the following:
-
Move M06 to line after the tool call line
-
Move Spindle Speed and Spindle On codes onto their own line after the initial position move.
-
Move the Coolant On code onto it’s own line after the initial Z down.
Lesson 2 - Step 1:
Open the post processor file in your text editor, Turn ON the post Debugging, and get the post and NC output file opened and ready to edit.
NOTE: See Lesson 1 for details on the text editor and turning on the debugging parameter.
*************15. First Machine Setup*************
(FIRST MACHINE SETUP - Machine Setup - 1)
*************2. Start of file standard*************
N01 G00 G17 G40 G49 G80 G20 G90
(FIRST CUT - FIRST TOOL)
(Machine Setup - 1-MILL CENTER BORE-Profile Rough)
(MILL CENTER BORE)
(TOOL #1 0.25 1/4 FLAT ENDMILL - STANDARD)
N02 T1 M06
N03 G00 G90 G54 X1.7823 Y-1.25 S1191 M03
*************2 - 14. Tool length compensation*************
N04 G43 H1 D1 Z1. M08
*************40. Start of operation*************
*************27. First Rapid Move Z*************
N05 Z0.2
Notice that currently the tool change line combines the T1 and M06 on the same line. We will correct this first.
Lesson 2 - Step 2:
To determine what Post Block this is output from look in the program for the previous debugging line. In this example the previous debugging line is showing us:
*************2. Start of file standard*************
This tells us that we need to look in the post processor for Post Block 2.
Lesson 2 - Step 3:
Looking at Post Block 2. in the Post Processor we see the following:
2. Start of file standard
n,"G00 G17 G40 G49",cancel_drill_cycle,measure_mode,absolute_coord
" "
"(FIRST CUT - FIRST TOOL)"
system_comment
feature_name_comment
" "
"(TOOL #",list_tool_number," ",tool_diameter," ",tool_label,")"
n,t,"M06"
force_no_add_spaces
output_rotary_angle
output_second_rotary_angle
default_add_spaces
n,rapid_move,absolute_coord,work_coord,force_x,xr,force_y,yr,p_rot,s_rot,s,spindle_on
n,rapid_move,length_offset,d_offset,zr,coolant_on
machining_mode
We are interested in the line showing:
n, t, “M06”
On this line there are two variables, and a string literal being output. Variables are separated by the “,” character.
The “n” variable outputs the sequence/line number. Most output lines will begin with the “n” variable.
The “t” variable outputs the current tool number.
The “M06” is the string that is to be output on this line of code. Please note that whenever a string literal is output there is no modality applied, meaning that it will always be output regardless if other data on the line is output or not.
We are going to modify this line to create two separate output lines. Modify the line to the following:
n, t
n, “M06”
Explanation of code:
1st line – n, t
The “n” variable outputs the sequence/line number. Most output lines will begin with the “n” variable.
The “t” variable outputs the current tool number.
2nd line – n, “M06”
The “n” variable outputs the sequence/line number. Most output lines will begin with the “n” variable.
The “M06” is the string to be output on this line of code.
Lesson 2 - Step 4:
Save the post processor and generate the code. The output should now look like the following:
*************2. Start of file standard*************
N01 G00 G17 G40 G49 G80 G20 G90
(FIRST CUT - FIRST TOOL)
(Machine Setup - 1-MILL CENTER BORE-Profile Rough)
(MILL CENTER BORE)
(TOOL #1 0.25 1/4 FLAT ENDMILL - STANDARD)
N02 T1
N03 M06
N04 G00 G90 G54 X1.7823 Y-1.25 S1191 M03
*************2 - 14. Tool length compensation*************
N05 G43 H1 D1 Z1. M08
*************40. Start of operation*************
*************27. First Rapid Move Z*************
N06 Z0.2
Lesson 2 - Step 5:
Now to move the Spindle Speed and the Spindle ON codes to their own line after the initial position move we see that they also are output from the Post Block 2.
Using the Post Variable and API Reference document you can look up each variable in the block to determine which is responsible for the output. In this case the variables we are looking for are:
- s
- spindle_on
Looking at Post Block 2. we find these variables at the end of Post Line:
n,rapid_move,absolute_coord,work_coord,force_x,xr,force_y,yr,p_rot,s_rot,s,spindle_on
To create a new post output line we will move these variables to the line below and include the “n” variable at the beginning of the line as shown in the following:
n,rapid_move,absolute_coord,work_coord,force_x,xr,force_y,yr,p_rot,s_rot
n, s,spindle_on
Save the post processor after making this change and generate the code. The output should now look like the following:
*************2. Start of file standard*************
N01 G00 G17 G40 G49 G80 G20 G90
(FIRST CUT - FIRST TOOL)
(Machine Setup - 1-MILL CENTER BORE-Profile Rough)
(MILL CENTER BORE)
(TOOL #1 0.25 1/4 FLAT ENDMILL - STANDARD)
N02 T1
N03 M06
N04 G00 G90 G54 X1.7823 Y-1.25
N05 S1191 M03
*************2 - 14. Tool length compensation*************
N06 G43 H1 D1 Z1. M08
*************40. Start of operation*************
*************27. First Rapid Move Z*************
N07 Z0.2
Lesson 2 - Step 6:
We will now focus on moving the coolant on command onto it’s own line in the NC output.
In the post processor we are using this is the “M08” command on line N06 in the current output.
Notice that the debugging comment above this line looks a little different than the previous debugging comments we have seen.
*************2 - 14. Tool length compensation*************
This debugging line has two sets of numbers. This indicates that there are nested Post Blocks, meaning that one Post Block has a command variable used that is causing the posting engine to call a 2ndPost Block. The first number shows the original Post Block “2” in this case. The 2nd number is showing the last Post Block called “14” in this case. It is important to understand how this works to eliminate confusion when trying to modify the output of a post processor.
Looking at the post processor block 2. we see the following:
n,rapid_move,length_offset,d_offset,zr,coolant_on
On this line the “coolant_on” variable is the one we are interested in but I want to point out that the “length_offset” variable is the one responsible for Post Block 14. being called.
To modify this Post Line to give us the desired output we need to alter the Post Line into to two separate lines as shown below:
n,rapid_move,length_offset,d_offset,zr
n, coolant_on
Lesson 2 – Step 7:
Save the post processor and generate the Gcode. Now you will see the output has been altered to give us the desired format for this tool change.
*************2. Start of file standard*************
N01 G00 G17 G40 G49 G80 G20 G90
(FIRST CUT - FIRST TOOL)
(Machine Setup - 1-MILL CENTER BORE-Profile Rough)
(MILL CENTER BORE)
(TOOL #1 0.25 1/4 FLAT ENDMILL - STANDARD)
N02 T1
N03 M06
N04 G00 G90 G54 X1.7823 Y-1.25
N05 S1191 M03
*************2 - 14. Tool length compensation*************
N06 G43 H1 D1 Z1.
N07 M08
*************40. Start of operation*************
*************27. First Rapid Move Z*************
N08 Z0.2
Lesson 2 – Step 8:
Looking at the rest of the nc program you will see that the changes we have made have only applied to the 1sttoolchange at the beginning of the program (See N23). For the additional tool change blocks we need to make changes in additional Post Blocks.
Scrolling down to N23 notice the debugging line that has been output prior is calling to Post Block 3. Looking at Post Block 3. you will see it is titled “Tool Change”. This Post Block is used for all tool changes with exception to the 1st one in the program.
NOTE: There are several tool change Post Blocks found in a post processor. In a Milling post processor you will find the following tool change Post Blocks:
- 2. – First Tool change
- 3. – Tool Change (Every tool change where the Tool Number is actually different from one operation to another).
- 4. – Null Tool Change – This is called when two operations are output one after the other and both operations are using the same tool number. In the system a null tool change is triggered and this Post Block allows you to modify the output between these two operations even though the physical machine does not need to change the tool in the spindle.
In Post Block 3. the line n, t, “M06”needs to be broken into two lines as we did in Lesson 2 – Step 3. Modify the line to read as shown below.
n, t
n, “M06”
Save and generate the NC program and now you will see that all other tool change blocks in the NC program have the format of this output line changed to have the tool number and “M06” on separate lines.
Output Example:
2ndToolchange
(TOOL #20.251/4 FLAT ENDMILL - STANDARD)
N23 T2
N24 M06
N25 G00 G90 G54 X1.875 Y-1.25 S1191 M03
3rdToolchange
(TOOL #30.43755 CENTER DRILL)
N40 T3
N41 M06
N42 G00 G90 G54 X0.75 Y-0.75 S681 M03
4thToolchange
(TOOL #40.3753/8 DRILL)
N56 T4
N57 M06
N58 G00 G90 G54 X0.75 Y-0.75 S794 M03
NOTE: It’s important to realize that the first toolchange block in the program is controlled by the Post Block 2. All other toolchanges (Where the tool number actually differs) is controlled by Post Block 3.
Lesson 2 – Step 9:
In this step we will be modifying block 3 to reflect the correct output for the following:
• Move Spindle Speed and Spindle On codes onto their own line after the initial position move.
• Move the Coolant On code onto it’s own line after the initial Z down.
NOTE: These changes will be completed the same as in Lesson 2 – Step 4 & 5. For more details on these modifications please reference the previous steps.
Looking at Post Block 3 we find these variables at the end of Post Line:
n,rapid_move,absolute_coord,work_coord,force_x,xr,force_y,yr,p_rot,s_rot,s,spindle_on
To create a new post output line we will move these variables to the line below and include the “n” variable at the beginning of the line as shown in the following:
n,rapid_move,absolute_coord,work_coord,force_x,xr,force_y,yr,p_rot,s_rot
n, s,spindle_on
Looking at the post processor block 3 we see the following:
n,rapid_move,length_offset,d_offset,zr,coolant_on
To modify this Post Line to give us the desired ouput we need to alter the Post Line into to two separate lines as shown below:
n,rapid_move,length_offset,d_offset,zr
n, coolant_on
Save the post processor after making these change and generate the code.
Now all of the toolchange output for all toolchanges in the NC program should show the desired output for these blocks.