Post Processor Lessons - Lesson 3

 

 
Parent    Previous    Next

POST MODIFICATION LESSON 3:  USING POST QUESTIONS/SWITCHES

In the BobCAD-CAM posting engine there is a large amount of logic that is already built into the posting engine to handle common output needs. The BobCAD-CAM development team has done a wonderful job creating posting questions that are used to control and format the output of the NC program without complex alterations being made to the post processor itself.
In the Mill post processor you can find the post questions starting at Post Block 200.

Example Post Questions:

200. Is X modal? y
201. Is Y modal? y
202. Is Z modal? y
203. Are the g codes modal? y
204. Are the g codes (G02 and G03) modal in arc milling? y
205. Are the XY (or YZ or XZ) coordinates modal in arc milling? n
206. Are work coordinates modal ?n
207. Output sequence numbers in sub programs ?y
208. Output sequence numbers? y
209. Number of places for sequence numbers? 2
210. Delete the decimal point? n
211. Delete leading zeros? n
212. Delete trailing zeros? y
213. English or Metric format (E/M)? e
214. Places before decimal point for reals (X,  Y,  Z)? 1
215. Number of places for Tool Numbers? 1
216. Places after decimal for feed rate ? 4
217. Scale factor for feed rate ? 1
218. Number of places for the program number? 4
219. Add spaces to the program? y


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 3.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


In this lesson we will be using these post questions to alter the output of the NC program to accomplish the following:

  • Turn OFF the sequence numbers for the NC program.
  • Change the program to use NO spaces between values.
  • Change the Arc output so the arc center is defined in Absolute Coordinates.
  • Change the Comment characters so that comments are output with a “;” leading character instead of “(“ starting and “)” closing brackets.
  • Replace “G00” code with “RAPID_MOVE:”
  • Replace “G01” code with “FEED_MOVE:”
  • Replace “G02” code with “CW_ARC:”
  • Replace “G03” code with “CWW_ARC:”

NOTE:In this lesson we will not be covering the opening, setup, of the post in the editor. We also will not be covering turning on the Debugging parameters. Please reference the prior lessons for information on these topics.


Lesson 3 - Step 1: 

To start this lesson we will be turning OFF the sequence numbers( also called line numbers) in the NC file output. In the post processor search for Post Block: 208.

208. Output sequence numbers? y

Change the value at the end of this line from “y” to “n”.


Save and run the post processor to generate the NC Code. Notice the sequence numbers have now been removed.


Lesson 3 – Step 2:

In this step we will be turning off the space output between values in the NC Code. In the post processor search for Post Block:  219.

219. Add spaces to the program? y


Change the value at the end of this line from “y” to “n”.

Save and run the post processor to generate the NC Code. Notice the spaces have now been removed in the program.


Lesson 3 – Step 3:

In this step we will modifying the values output in the NC code for the Arc Center definitions.In the post processor search for Post Block:  222.

222. Arc center (a=absolute,  b=incremental,  d=unsigned inc.,  e=radius)? b


Some post questions will have multiple specific settings that can be used. Notice this post question has multiple options. It is important that you only use valid defined characters .

Change the arc center output to Absolute change this setting from “b” to “a”.

Save and run the post processor to generate the NC Code. Notice that now the arc move center definitions are being output with absolute values.



Lesson 3 – Step 4:

In this step we are going to change the comment  output from using the “()” to enclose the comments to just outputting a “;” character at the beginning of comment lines. for this change you will see there are multiple post question blocks that need to be modified to achieve our desired results.
In the post processor search for Post Block:  630. This block controls the beginning comment character. A separate Post Block 631 controls the ending comment character. 

Change the comment  start character on Post Block 630.from “(“ to “;”.
Change the comment end character on Post Block 631. from “)” to “”.


Save and run the post processor to generate the NC Code. Notice that now most but not all of the comments start with the “;” character and there is no ending comment character. This is because some of the comments being output are setup as String Literal outputs. Previous post processor edits may contain string literals that need to be found and corrected. In the case of this post processor we find the Tool Comments and some toolchange comments have been hard coded.


NOTE: Hard Coded is another reference term for the output that has been created using String Literal output. It is commonly referred to Hard Coded output.


To find the additional locations that need to be modified simply start at the beginning of the post processor and use the Editor’s Search/Find command and look for the “(“  character.
Anywhere you see the “(“ character inside quote characters you will need to manually change that output. Example is found in the beginning of Post Block: 0.

     

0. File header
    default_add_spaces
    
    "O",prog_n,"(PROGRAM NUMBER)"
    "(PROGRAM NAME - ",prog_name,")"
    
    "(DATE - ",output_date,")"


In this example Post Block we have 3 lines that contain the comment brackets that we need to modify. Change the Post Block to match the following.

0. File header
    default_add_spaces
    
    "O",prog_n,";PROGRAM NUMBER"
    ";PROGRAM NAME - ",prog_name
    
    ";DATE - ",output_date


Continue looking through the post processor and change every occurrence like this when found. Save the post processor and generate the NC code to check your work often while making your post processor modifications. When you have replaced all occurrences of the comment output to now use the new format move on to the next step.

Lesson 3 – Step 5:

In this step we are going to update some of the Gcode output to use more conversational words. 

Many of the G and M codes that are output from the BobCAD-CAM posting engine are defined using post question blocks. The following are the post question blocks we need to change to modify and achieve the desired output.

  • G00 = Post Block: 680
  • G01 = Post Block: 681
  • G02 = Post Block: 682
  • G03 = Post Block: 683


To achieve the desired output modify the values for these Post Blocks to reflect the following:

680. G Code for Rapid Move? "RAPID_MOVE:"
681. G Code for Feed Move? "FEED_MOVE:"
682. G Code for Arc CW? "CW_ARC:"
683. G Code for Arc CCW? "CWW_ARC:"


Save and run the post processor to generate the NC Code. Notice that now the codes have been replaced throughout the NC program. If you find locations where the value was not changed this is due to string literal output or scripting blocks and they need to be individually addressed as we did in Step 4.

Review of Topics

So far this guide has covered the following:

  • Structure of the BobCAD-CAM post processor.
  • Terminology used in the BobCAD-CAM post processor
  • Post variables and how they are used.
  • Post Blocks, Post Lines, and Post question blocks.
  • 3 lessons that show how to make common modification using the information provided so far.

With the knowledge gained so far the majority of post processor modifications can be completed. Applying the knowledge of how Post Blocks are structured, how to use variables & string literals, and how the post questions work the output format of the post processor can be completely altered for most situations.


Lessons Continued

In the following sections we will begin exploring more advanced topics such as the following:

  • Using Command Variables to affect and control the output.
  • Changing a variable format on the fly
  • Using the VBScripting ability of the BobCAD-CAM posting engine to allow the post writer to use the full power of Visual Basic Scripting to perform calculations and alterations to the NC code output.
  • Using Advanced Posting Pages – The advanced posting pages allows the post writer to modify a dialog that will be displayed in a feature and allow the user to have input fields that are customized to the specific needs of the post writer. 


These lessons require that you have completed the previous sections. Please be sure you understand how the previous topics work before proceeding.