Control texts are the key element for the postprocessor export. All control texts can be edited by the user in the "Edit Postprocessor" dialog. Some control texts are always exported exactly once, others several times and others again are possibly not exported at all. Whether at all or how frequently a control text is exported depends on its type, on settings in the "Edit Postprocessor" dialog, and on settings in the dialogs "Manage Tool list" and "General Parameters"of the CAM plug-in as well as the selected objects.
The resulting NC file, for example with g-code commands according to DIN 66025 for a milling machine or HP-GL/2 commands for a large-scale cutter, is composed of a sequence of control texts. All variables inside these control texts are replaced by their respective content (character string) at the current point of time by the postprocessor. In addition all text statements (for example functional statements and numerical Term Statements) are evaluated (refer to Statements in Texts).
It is a good idea if you open the settings file Universal DIN-ISO.pps in the dialog "Edit Postprocessor" and then save the settings directly afterwards under a new name again, such as Test DIN-ISO.pps. In this way you can while reading try out how changes to the control texts or the settings affect the resulting NC file. For this purpose it is best to export a short curve (polyline) or a simple surface (rectangle).
From Drawing Objects Via Control Texts To The NC File
After the drawing objects were selected by the user for export by the postprocessor for each selected object is verified which machine tool number or logical tool index respectively is assigned to it according to the current tool list. In case an object is not assigned to any tool it is not exported.
The sequence of export object types to be created is determined by the sequence of objects in the drawing list. In addition the sequence of tools in the tool list can be applied as well, so that for example all objects that are assigned to tool no. 1 are exported before those that are assigned to tool no. 2.
A drawing object always has a unique start-point. All drawing objects with a contour, such as curves, surfaces, but also single lines, circular arcs, and Bézier curves, also have a direction or orientation respectively. When converting drawing objects these information is applied.
Let's take, for example, the drawing object rectangle (radius compensation is switched off): For that at first the control text for contour start is called. Inside that control text the tool is moved at rapid speed to the rectangle's start-point at clearance height (movement in X/Y plane), afterwards the tool is moved down at rapid speed to working height, and from there it is lowered to the current infeed depth (movement along the Z-axis). Then the control text for lines is called for each edge of the rectangle according to its orientation (infeed movements in X/Y plane), which means four calls of the control text for lines in total. The object variables are updated before each call correspondingly. Finally the control text for contour end is called. Inside that control text the tool is lifted from the current infeed depth to clearance height at rapid speed (movement along the Z-axis).
Table 1: Sequence of control text calls and related tool positions
Control text type
|
Point in time of control text call
|
Number
of calls
|
Z-Position of tool before call
|
Change of tool position inside the control text (X/Y-plane or Z-axis)
|
Program start
|
At the beginning of the NC file
|
One
|
Undefined
|
Always move to clearance height. (4)
|
Program end
|
At the end of the NC file
|
One
|
Clearance height
|
None
|
Contour subprogram start
|
Before each contour subprogram. Contour subprograms are called by special cycles (rough-out, finishing, etc.). The corresponding block instances of the active CAM library must have an attribute named "CONTOUR-SUBPROGRAM".
|
Variable (1)
|
Clearance height
|
Contour subprograms only contain movements in the X/Y plane (no change of the Z-axis). Possibly existing feed rate specifications or M functions are ignored.
|
Contour subprogram end
|
After each contour subprogram. Contour subprograms are called by special cycles (rough-out, finishing, etc.). The corresponding block instances of the active CAM library must have an attribute named "CONTOUR-SUBPROGRAM".
|
Variable (1)
|
Clearance height
|
Contour subprograms only contain movements in the X/Y plane (no change of the Z-axis). Possibly existing feed rate specifications or M functions are ignored.
|
Primary run / Material advance
|
After exporting the last object or when material adavance is active after exporting the last (clipped) object of the current advance window
|
Variable (1)
|
Clearance height
|
If necessary move to clearance height at the end. (4)
|
Before repeat
|
After completing all primary runs or material advances respectively
|
Variable (1)
|
Clearance height
|
If necessary move to clearance height at the end. (4)
|
Contour start
|
Before each contour (consisting of lines, circular arcs, and Bézier curves)
|
Once per contour (2)(7)
|
Clearance height or current working height
|
If necessary, at first move to contour start-point (X/Y-plane) at clearance height and then move down to the current working height. At the end always lower to the current infeed depth. (4)(6)
|
Contour end
|
After each contour (consisting of lines, circular arcs, and Bézier curves)
|
Once per contour (2)(7)
|
Current infeed depth or clearance height
|
Lift from the current infeed depth to clearance height or approach target point (X/Y-plane) at safety height. (4)(6)
|
Tool change
|
If according to the tool list a new physical tool has to be selected for the current object (for the very first object this is always true) or a logical tool change is coming up this control text is called. This control text is (if any) always called before the corresponding control text for contour start, cycles (attributes), or points (markings).
|
Variable (3)
|
Clearance height
|
After physical tool change move to clearance height afterwards (4), no change for a logical tool change.
|
Lines
|
For each export object type line to be created
|
Variable (2)
|
Current infeed depth
|
Infeed in X/Y-plane (5)
|
Circular arcs
|
For each export object type circular arc to be created
|
Variable (2)
|
Current infeed depth
|
Infeed in X/Y-plane (5)
|
Bézier curves
|
For each export object type Bézier curve to be created
|
Variable (2)
|
Current infeed depth
|
Infeed in X/Y-plane (5)
|
Cycles (attributes)
|
For each export object type cycle (attribute). Only valid for block instances of the active CAM library with matching cycle attribute name. The text content of the attribute or the referenced file is used as control text for the execution of the actual cycle.
|
Variable (2)
|
Clearance height
|
First move to destination-point (X/Y-plane) at clearance height, then execute cycle (drilling, thread cutting, etc.), and at the end move up to clearance height again. Also refer to chapter "CAM Block Types and Cycle/Control Attributes". (4)
|
Points (markings)
|
For each export object type point (marking). Other than the control text for cycles (attributes) this control text in addition to commands for positioning the tool also contains all infeed commands for the actual cycle.
|
Variable (2)
|
Clearance height
|
First move to destination-point (X/Y-plane) at clearance height. Afterwards move down to current working height, execute cycle (drilling, thread cutting, etc.) and at the end move up to clearance height again. (4)
|
Block numbers (line numbers)
|
At the beginning of a block (line)
|
According to number of lines (3)
|
n/a
|
n/a
|
(1) | Function has to be switched on by the user explicitly. |
(2) | Call depends on which export object types are created (depending on the settings in the dialog "Edit Postprocessor") and which drawing objects are selected. |
(3) | Function may switched off by the user. In case of tool change: If the enumeration of a contour subprogram is currently active then this control text is not called. |
(4) | Moving at, to, or from clearance height is always done at rapid speed. Otherwise lowering/infeeding and lifting/extracting is always executed at the respective speed specified for the current tool. |
(5) | Infeed is always carried out in the X/Y-plane at the current infeed depth at the feed rate specifed for the current tool. The Z-axis remains unchanged. Only exception: Bevelled infeed/extracting (has to be switched on by the user explicitly). |
(6) | Please refer to the description of the working variables ~UpdateXYPosition~,~X1~/~Y1~, and ~UseAuxPoint~. |
(7) | Please note the special case regarding the working variable ~UpdateCutterRotationOnly~. |
Calling a control texts consists of two steps: 1. All variables are resolved, i.e. replaced by their respective content (character string), and after that all text statements are evaluated (refer to Statements in Texts). 2. The resulting text section is appended to the current NC file. Exception: The resulting text sections of contour subprogram start/end are not appended to the current NC file directly but they are stored separately and in the end appended to NC file before the control text for program end is called.
To put it in a nutshell, all texts outside a pair of braces { } as well as outside a tilde pair ~ ~ are constant, i.e. they are copied one-to-one to the NC file. All variables including the enclosing tildes (for example ~X1~, ~Y1~) are replaced by their current content at the respective point in time. Afterwards all statements are evaluated and replaced including the braces by the respective result. A control text {+~X1~} becomes for example {+50.0} and finally +50. Assignment and comment statements never show up in the NC file. Even the conditional assignment can possibly yield an empty text (refer to Table 2, ~FirstContourElement~), i.e., in this case nothing is copied to the NC file. Please refer to the "CAD6 Reference", chapter "In-Depth View" for further information on statements in texts and term evaluation.
In the following example a rectangle with a start-point at X=50 / Y=100 mm, a width of 100 mm and a height of 50 mm is exported without radius compensation. Its orientation is clockwise. Clearance height is at 100 mm and the infeed depth is 20 mm. Lowering speed is 250 mm/min, infeed rate is 400 mm/min, a coolant is supplied and the spindle rotates at 4000 rpm. This example is based on the postprocessor "Universal DIN-ISO.pps" mentioned above. However, for a better understanding, the depiction of control texts is restricted to the relevant parts. You can find a detailed description of the variables used in the chapter "Variables for Control Texts".
Table 2: Sample showing the transformation of control texts into text sections in the NC file
Control text
|
Resulting text section in the NC file
|
Description
|
{=LineNumber{10}}
%~PrgName~
G17 {?~Units~==2||~Units~==3{$G70}{$G71}} G90
|
N10 %TEST-DIN-ISO
N20 G17 G71 G90
|
In the first line the initial value of 10 is assigned to the variable ~LineNumber~. Exporting and incrementing block numbers is done by the control text for block numbers. Such an assignment statement does not show up in the NC file! The second line of the control text for program start is the first line to show up in the NC file. The next lines consists of two constant texts G17 and G90. The result of the conditional statement (G70 oder G71) is then inserted between them.
|
T{#~MachineToolNo~} S{#~MillingSpindleRate~}
G00 G40 Z{+~ZClearance~}
|
N30 T1 S4000
N40 G00 G40 Z+100
|
In the control text for tool change the physical tool no. 1 is selected and the spindle rotation is set. In the second line the tool is moved to clearance height.
|
G00 G40 X{+~X1~} Y{+~Y1~}
G00 Z{+~ZWorking~} {?~MillingSpindleDir~{$M04}{$M03}}
G01 Z{+~Z1~} F{#~LoweringVel~} {?~ToolControl1~{$M08}}
|
N50 G00 G40 X+50 Y+100
N60 G00 Z+5 M03
N70 G01 Z-20 F250 M08
|
Moving to the first point of the contour at clearance height is always done in the control text for contour start. After that the tool is moved at rapid speed to working height (here equal to engage distance) and the spindle is switched on clockwise. Finally the tool is lowered to infeed depth with lowering speed and activated coolant supply.
|
G01 X{+~X1~} Y{+~Y1~}{?~FirstContourElement~ {$ F{#~MovingVel~}}}
|
N80 G01 X+50 Y+150 F400
N90 G01 X+150 Y+150
N100 G01 X+150 Y+100
N110 G01 X+50 Y+100
|
The control text for lines is called for each edge of the rectangle exactly once. All variables (here ~X1~/ ~Y1~ and ~FirstContourElement~) are updated according to the current state before each call. F400 shows up only once because ~FirstContourElement~ is only true (1) at the first call.
|
G00 Z{+~ZClearance~} M05{?~ToolControl1~{$ M09}}
|
N120 G00 Z+100 M05 M09
|
In the control text for contour end the tool is moved to clearance height again and the spindle as well as the coolant supply are switched off.
|
M30
|
N130 M30
|
The control text for program end contains only a constant text which is copied one-to-one.
|
Copy explicit number value (special character) to NC file
In order to copy an explicit number value or a special character respectively (e.g. escape = number value 27) to the NC file use the following sequence of characters in any control text:
\\\~XX
| XX is always a double-digit hexadecimal number (lowercase as well as uppercase characters are valid), for example \\\~1B is converted to the number value (escape special character) 27. Some plotters for example require a certain escape sequence to switch to HP-GL-mode. |
Use file injection to dynamically insert the content of an NC file into another
To insert the content of an existing NC file into any control text (and thus into another NC file) use the following sequence of characters:
\\\~*NAME*
| NAME represents the file name of the file to be inserted. Use a file name without a path to access the path of the fixed export file. You can use this functionality in a Postprocessor Chain, for example. A first post processor generates a list with the tools actually used and a post processor following in the chain then inserts this list into the Control Text for Program Start by file injection. For this purpose you can Define a Job that uses an extra file name. |
For further information please refer to Postprocessor Chain, File Injection, Job, and Shadow Mode.
|