Post Processor Lessons - Lesson 4

 

 

Parent    Previous    Next

POST MODIFICATION LESSON 4: USING COMMAND VARIABLES

In this lesson we will be covering what is referred to as a Command Variable. A command variable is used like a normal variable in the post processor however it does not output a value but instead it changes or controls the way that other specific variables output. There are multiple command variables that exist in the BobCAD-CAM posting engine but for this lesson we will only be covering a few. An example of a command variable that we have already used is the “debug_on” and “debug_off” variable.

 Below are the command variables we will be using in this lesson:

  • force_no_add_spaces
  • default_add_spaces
  • start_add_block_delete
  • stop_add_block_delete

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 4.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 look at the toolchange block and the stock definition blocks to alter the following:

  • Suppress the space output for a range of output lines.
  • Output block skip characters for a range of output lines.


Lesson 4 – Step 1:

With the post processor opened in your editor, turn on the post debugging and generate the NC Code and open in the editor. We are going to modify the range of code that is output for the actual profile cutting of the part. Looking at the NC code below we are going to modify the range between output lines: N06 and N12. (Shown below)

(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
*************50. Line rapid move Z - Z retract*************
N06 Z0.1
*************51. Line feed move Z*************
N07 G01 Z-0.375 F6.6738
*************56. Line feed move XY on lead-in*************
*************56 - 12. Cutter compensation left*************
N08 G41 D1 X1.9149 Y-1.3826 F13.3476
*************64. Arc move XY*************
N09 G17 G03 X2.235 Y-1.25 I0.1326 J0.1326
*************64. Arc move XY*************
N10 X1.265 Y-1.25 I-0.485 J0.
*************64. Arc move XY*************
N11 X2.235 Y-1.25 I0.485 J0.
*************64. Arc move XY*************
N12 X1.9149 Y-1.1174 I-0.1875 J0.
*************57. Line feed move XY on lead-out*************
*************57 - 11. Cancel cutter compensation*************
N13 G40 G01 X1.7823 Y-1.25
*************50. Line rapid move Z - Z retract*************
N14 G00 Z0.2
*************71. End of operation*************
*************50. Line rapid move Z - Z retract*************
N15 Z1.
*************197. End of operation - Toolchange*************
*************3. Tool change*************
N16 M09
N17 M05
N18 G90
N19 M01


Looking at the Debugging lines we can determine that the two Post Blocks we are looking for should be:


Lesson 4 – Step 2:

In the post processor, search or scroll to Post Block: 56. Notice this Post Block already includes a Post Line for output. What we are going to do is insert the command variable “force_no_add_spaces” to a new line proceeding the existing Post Line as shown in the following code.

56. Line feed move XY on lead-in
    force_no_add_spaces
    n,cc,feed_move,x_f,y_f,feed_rate

Lesson 4 – Step 3:

Save and generate the NC output code from the post processor. Notice the output of the program now is altered. The spacing has been removed from most of the program starting at N07 and continuing to the end of the program(See Note Below). This is because we turned off the spacing option in the posting engine using the “force_no_add_spaces” command variable. In the next step we will be turning it back on.

NOTE:  Some variables do not pay attention to the spaces option in the posting engine. This is because they are intended to be used by manually assigning a string literal prefix. This is older logic in the posting engine that exists to support legacy post processors.


Lesson 4 – Step 4:

In the post processor, search or scroll to Post Block: 57. Notice this Post Block already includes a Post Line for output. What we are going to do is insert the command variable “default_add_spaces” to a new line after the existing Post Line as shown in the following code:

57. Line feed move XY on lead-out
    n,cc,feed_move,x_f,y_f,feed_rate
    default_add_spaces


Using the “default_add_spaces” command variable resets the posting engine to the state defined on Post Question: 219.


Lesson 4 – Step 5:

Save and generate the NC output code. Notice the output now has been modified to only remove the spaces from the specific lines N8 thru N13.

Here is the output after these steps have been completed and the debugging is turned off:


(TOOL #1 0.25 1/4 FLAT ENDMILL - STANDARD)
N02 T1 M6
N03 G00 G90 G54 X1.7823 Y-1.25 S1191 M03
N04 G43 H1 D1 Z1. M08
N05 Z0.2
N06 Z0.1
N07 G01 Z-0.375 F6.6738
N08G41D1X1.9149Y-1.3826F13.3476
N09G17G03X2.235Y-1.25I0.1326J0.1326
N010X1.265Y-1.25I-0.485J0.
N11X2.235Y-1.25I0.485J0.
N12X1.9149Y-1.1174I-0.1875J0.
N13G40G01X1.7823Y-1.25
N14 G00 Z0.2
N15 Z1.
N16 M09
N17 M05
N18 G90
N19 M01

Lesson 4 – Step 6:

Now we are going to use the command variables “start_add_block_delete”  and
stop_add_block_delete” to turn on and off the block delete output for the same range of code we modified in the previous steps.

In the post processor, search or scroll to Post Block: 56. What we are going to do is insert the command variable “start_add_block_delete” to a new line proceeding the existing Post Line as shown in the following code.

56. Line feed move XY on lead-in
start_add_block_delete
 force_no_add_spaces
 n,cc,feed_move,x_f,y_f,feed_rate


Lesson 4 – Step 7:

In the post processor, search or scroll to Post Block: 57. Insert the command variable “stop_add_block_delete” to a new line after the existing Post Line as shown in the following code:

57. Line feed move XY on lead-out
    n,cc,feed_move,x_f,y_f,feed_rate
    default_add_spaces
    stop_add_block_delete



Save the post processor and generate the NC code output. Your output should look like the following:


(TOOL #1 0.25 1/4 FLAT ENDMILL - STANDARD)
N02 T1 M6
N03 G00 G90 G54 X1.7823 Y-1.25 S1191 M03
N04 G43 H1 D1 Z1. M08
N05 Z0.2
N06 Z0.1
N07 G01 Z-0.375 F6.6738
/N08G41D1X1.9149Y-1.3826F13.3476
/N09G17G03X2.235Y-1.25I0.1326J0.1326
/N010X1.265Y-1.25I-0.485J0.
/N11X2.235Y-1.25I0.485J0.
/N12X1.9149Y-1.1174I-0.1875J0.
/N13G40G01X1.7823Y-1.25
N14 G00 Z0.2
N15 Z1.
N16 M09
N17 M05
N18 G90
N19 M01


Notice that now the block delete character (Defined on Post Question: 656) is being output at the beginning of the N08 thru N13 NC output lines.