Most of the examples are taken from the standard postprocessors provided.
- ACODE
-
Grammar: ACODE
ACODE / val1, val2
Action:
Writes code A with value val1 to the ribbon file, subject to output conditions val2.
The variable ETAT0.xyzabc[4] and the runs are updated.
- val2 = 0 The code is generated according to its mode.
- val2 = 1 The code is generated regardless.
- val2 = -1 The code is not generated, but the variable ETAT0.xyzabc[4] is
updated.
ACODE without an argument: the value of A must be generated in the next motion block.
The address of the corresponding code is defined by the variable CODE.used[6]
Relevant variables: ETAT0.xyzabc[4]
LIMIT.max[4]
LIMIT.min[4]
CODE.used[6]
Macro call: no
Example: see XCODE
- APPEND
-
Syntax: APPEND / "filename"
Action:
Open a second NCTAPEfile for writing that has already been opened and closed using
OPEN and CLOSE. Each line is written to the end of the existing file using the WRITE
statement. If the file name is relative, the file must be located in the NCTAPE
directory.
APPEND / "test" Open the file 'test' WRITE /
"We continue" Appends 'test' to the end of the
file CLOSE Closes the 'test' file
Relevant variables: none
Macro call: none
- APTDEL
-
Syntax: APTDEL / 'filename'
Action:
Deletes the file in the specified APT directory.
Relevant variables: none
Macro call: none
- APTSRC
-
Syntax: APTSRC / 'filename'
Action:
Opens an APT file for reading, specified by its name. This file will also act as a
postprocessor. It is not consulted in the case of a search at the parent level. If the
file name is relative, it must be located in the default APT directory.
Relevant variables: none
Macro call: none
- AUTOPS
-
Grammar: AUTOPS
Action:
Movements are performed in the XY plane at the current point's coordinate. This
instruction is used with the GOFWD, GOLFT, and GORGT functions.
Relevant variables: none
Macro call: none
- AUXFUN
-
Syntax: AUXFUN / val1
Action:
Writes an M-code to a single block, equivalent to MCODE / val1 + EOB
Relevant variables: see MCODE
Macro call: yes
- BCODE
-
Syntax: BCODE
BCODE / val1, val2
Action:
Writes a B code with the value val1 to the ribbon file, subject to the output
conditions val2. The variable ETAT0.xyzabc[5] and the runs are updated.
- val2 = 0 The code is generated according to its mode.
- val2 = 1 The code must be generated
- val2 = -1 The code is not generated, but the variable ETAT0.xyzabc[5] is
updated.
BCODE without an argument: the value of B will be generated at the next motion block.
The address of the corresponding code is defined by the variable CODE.used
Relevant variables: ETAT0.xyzabc[5]
LIMIT.max[5]
LIMIT.min[5]
CODE.used[7]
Macro call: none
Example: see XCODE
- BREAK
-
Grammar:
BREAK / ON
BREAK / OFF
BREAK / val
BREAK / NOW
Action:
Whether or not to trigger the file break process when the number of lines or
characters inthe created file exceeds val. The BREAK macro is called if it exists, in
which a new file can be opened using the OPEN command.
- ON: Enables the process of calling the BREAK macro OFF: Disables this process
- val: the BREAK macro is called when the number of lines or characters exceeds
val
- NOW: Immediately calls the BREAK macro
- If BREAK.mode = 0: use lines
- IfBREAK.mode = 1: uses characters
Relevant variables:
- BREAK.on
- BREAK.nfile: number of calls to the
- BREAK macro
- BREAK.nline: number of current lines in the created file
- BREAK.maxline: maximum number of allowed lines
- BREAK.nchar: number of current characters in the created file
- BREAK.maxchar: maximum number of characters allowed
Macro call: none
Example: Excerpt from the INIT file followed by the BREAK file for MAHO; the BREAK
file contains the opening of a new file and its initializations.
$$ INIT BREAK
file / 4000, ON number = 1
$$ BREAK file EOB
GCODE / 0
y = STATUS0.xyzabc[2] + 50 YCODE / y, 1
EOB MCODE / 30 EOB
WRITE / CHAR(4)
$$ CLOSE
number = number+1
OPEN / SGP.output "." FORMAT(2,number) WRITE "%PM"
WRITE "N" FORMAT(2,number+100)
$$
SEQNO / 1
$$
GCODE / 18.0, 1
CODE / 13, 1
MCODE / 67.0 EOB
CODE / 2, 93.0 EOB
$$
SPINDL.on = 0
SPINDL / RPM, SPINDL.val
$$ RAPID
STATE0.clear = 1 y1 = STATE0.pts[2]
GOTO / STATUS0.pts[1], y, STATUS0.pts[3]
STATE0.move = 1
STATE1.move = -1 FCODE / FEDRAT.upm, 1
GOTO / STATE0.pts[1], y1, STATE0.pts[3]
$$
- BREAKPOINT
-
Grammar: BREAKPOINT
Action:
Definition of a breakpoint for debugging the postprocessor; execution will stop on
the next line after the BREAKPOINT
Macro call: none
- BUFFER
-
Syntax: BUFFER / val1, val2, val3
Action:
Inserts a code into the decoded code stack using the inverse postprocessing
- val1 = code address
- val2 code value
- val3= -1, 0, 1: sign of the value
This instruction allows you to intercept the decoding of a code to perform a specific
Action:.
Relevant variables: none
Macro call: none
Example: CODABC functionto test brake release and decode rotary axes
$$
PRINT " val " ARG1.val[1] " code " ARG1.val[2] " sign " ARG1.val[6]
$$
IF ( ARG1.val[2] = 96 ) THEN $$ axis A
$$
BUFFER / 6, ARG1.val[1], ARG1.val[6]
$$
IF ( CLAMP.a ) ERROR "Brakes A locked"
$$
ELSE IF ( ARG1.val[2] = 97 ) $$ B-axis
$$
BUFFER / 7, ARG1.val[1], ARG1.val[6]
$$
IF ( CLAMP.b ) ERROR "Brakes B locked"
$$
ELSE IF ( ARG1.val[2] = 98 ) $$ axis c
$$
BUFFER / 8, ARG1.val[1], ARG1.val[6]
$$
IF ( CLAMP.c ) ERROR "C brakes locked"
$$ ENDIF
- CCODE
-
Grammar:
CCODE
CCODE / val1, val2
Action:
Writes a C code with the value val1 to the ribbon file, while adhering to the output
conditions val2. The variable ETAT0.xyzabc[6] and the runs are updated.
- val2 = 0 The code is generated according to its mode.
- val2 = 1 The code is generated regardless.
- val2 = -1 The code is not generated, but the variable ETAT0.xyzabc[6] is
updated.
CCODE without an argument: the value of B will be generated in the next motion block.
The address of the corresponding code is defined by the variable CODE.used[8]
Relevant variables:
ETAT0.xyzabc[6]
LIMIT.max[6]
LIMIT.min[6]
CODE.used[8]
Macro call: none
Example: see XCODE
- CHANNEL
-
Syntax: CHANNEL / n
Action:
Selection of the write channel; n represents the channel number. The file
corresponding to the channelis created by default with the name SGP.output-(n-1). This
file can be renamed using the RENAME instruction. Each channel has its own status data
(STATUS0 and STATUS1) along with machining time and travel distances (LIMIT0 and
LIMIT1).
Relevant variables: CHANNEL.num
Macro call: none
- CIR2PT
-
Syntax: CIR2PT / val1, val2, val3, val4
Action:
In post processor mode, the CIR2PT macro is called by circular interpolation (GOCIR)
when MODE.circle = 4 in order to define one or more circles using two points (Siemens
CIP instruction)
Ifval1 = 1, 3, 5: the coordinates of the intermediate point are (val2, val3, val4) If
val1 = 2, 4, 6: the coordinates of the final point are (val2, val3, val4).
Inreverse mode, CIR2PT allows you to send the intermediate point and the end point to
calculate the corresponding circle
If val1 = 1: definition of the intermediate point with coordinates (val2, val3,
val4)If val1 = 2: definition of the final point with coordinates (val2, val3,
val4).
Relevant variables: MODE.circle
Macro call: yes
Example: CIR2PT macro for Siemens
$$
xyz = XYZ(ARG1.val[2],ARG1.val[3],ARG1.val[4])
$$
IF ( MODULO(ARG1.val[1],2) ) THEN $$ intermediate point CODE
/ 25 , xyz[1] CODE / 26, xyz[2] CODE / 27, xyz[3]
ELSE $$ end point
CODE / 28, 0
XCODE / xyz[1] YCODE / xyz[2] ZCODE / xyz[3] EOB
ENDIF
$$
- CIRCLE
-
Syntax:
CIRCLE / val1, val2, val3, val4
CIRCLE / CENTER, val1, val2, val3, RADIUS, val4 CIRCLE
/ point, RADIUS, val4
Action:
Defines a circle entity by its center and radius.
- (val1,val2, val3): XYZ coordinates of the center of the part
- coordinate system: center point
- val4: radius of the circle
Variables involved: none
Macro call: no
Example: Movement along acircle, excerpt from an APT file
TLON,GOFWD/ (CIRCLE/ -22.55961, 35.93804, 48.00000,$
10.00000),ON,(LINE/ -22.55961, 35.93804, 48.00000,$
-32.45586, 37.37480, 48.00000)
- CIRTOL
-
Grammar:
CIRTOL / val1, val2, val3
CIRTOL / ON
CIRTOL / OFF
Action:
Conversion of linear movements into circular movements to reduce the number of blocks
and improve surface finish. The following conditions must be met.
- The movements are performed at working speed
- If CIRTOL.axis = 0, 1, or 2, the movements must lie in a G17, G18, or G19 plane
with a tolerance of val3
- If CIRTOL.axis = 3, the circles are calculated in any plane
- The angle between two movements must be less than val2 in degrees
- The distance from each point to the circle must be less than val1
- ON: the process is active
- OFF: the process is disabled
- val1: maximum distance of each point from the calculated circle (default = 0.01)
- val2: maximum angle between two linear displacements (default = 3.0)
- val3: maximum distance from the point to the interpolation plane (default =
0.005)
Related variables:
CIRTOL.on
CIRTOL.val[3]
CIRTOL.axis
CIRTOL.angle: maximum angular travel
Macro call: yes
- CLFILE
-
Syntax: CLFILE / 'filename'
Action:
Opens a CLFILE file specified by its name for reading. This file will also act as a
postprocessor.It is not consulted during a search at the parent level. If the file
name is relative, it must be located in the default CLFILE directory.
On Windows, CLFILE binary files may originate from a UNIX source. The conversion of
binaries is performed by SGPOST.
Related variables: none
Macro call: no
- CLFILE
-
Syntax: CLOSE / n
Action:
Closes a file opened for writing by OPEN if n= 0 or omitted. Closes the file for
channel n.
These files are closed anyway at the end of processing.
Related variables: none
Macro call: no
Example: See BREAK
- CLOSER
-
Grammar: CLOSER
Action:
Closes a file opened for writing by OPENR. The file is closed anyway at the end of
processing
Related variables: none
Macro call: no
- CLOSE1, CLOSE2, CLOSE3, CLOSE4, CLOSE5
-
Grammar:
CLOSE1
CLOSE2
CLOSE3
CLOSE4
CLOSE5
Action:
Closes an nctapefile for n = 1, 3, 4, 5 and anapt file for n = 2 that was opened for
writing by OPENn. The file is closed regardless at the end of processing.
Related variables: none
Macro call: no
- CODE
-
Syntax:
CODE / val1, val2, val3
Action:
Writes the code defined by its address val1 in the 'data' file to the ribbon file,
with the value val2, while respecting the output conditions val3.
- val3= 0 The code is generated in the block
- val3= 1 The code is generated in an X, Y, or Z motion block
- val3= 2 The code is generated in a block for movement perpendicular to the work
plane
- val3= 3 The code is generated in a motion block in the work plane
- val3 = 4 The code is generated in a block containing a movement axis
- val3= 5 The code is generated in a block containing a rotary axis
- val3 = 11 The code is generated in a block containing an X-axis
- val3 = 12 The code is generated in a block containing a Y-axis
- val3 = 13 The code is generated in a block containing a Z-axis
- val3 = 14 The code is generated in a block containing an A-axis
- val3 = 15 The code is generated in a block containing a B-axis
- val3 = 16The code is generated in a block containing a C-axis
Affected variables: none
Macro call: no
Example: DELAY macro
$$
IF ( ARG("VALUE") ) THEN EOB
GCODE / 4.0, 1.0
CODE / 16, VAL("VALUE",1) EOB
ETAT0.time = ETAT0.time + ARG1.val[1] ENDIF
$$
- COMMENT
-
Grammar:
$$ comment
Action:
Calls the COMMENT macro for each APT comment. This function is used to retrieve
information from a comment.
Relevant variables: none
Macro call: yes
Example: The COMMENT macro below decodes the APT comment: $$CUTTER
10.0
$$
IF ( ARG0[4,9] = "CUTTER" ) THEN diameter = STRVAL(ARG0[13,25])
TOLIB / LOADTL.num, diameter
ENDIF
$$
- COPY
-
Grammar:
COPY / val1, TRANSL, val2, val3, val4, val5
COPY / val1, XYROT, val6, val5
COPY / val1, YZROT, val7, val5
COPY / val1, ZXROT, val8, val5
COPY / val1, SAME, val5
COPY / val1, MODIFIY, (MATRIX/va9,val3……val20), val5
Action:
Repetition of a group of lines defined by INDEX val1 after translation or
rotation.
- (val2, val3, val4): translation vector in the part coordinate system
- val6: rotation value about the Z-axis
- val7: rotation angle about the X-axis
- val8: rotation angle about the Y-axis
- val5: number of repetitions
- val9-val20: the 12 values of the 4×3 transformation matrix
Variables involved: none
Macro call: yes
- CPRINT
-
Syntax: CPRINT / ‘color,comment’
Action:
Writes a comment in color in the SGPOST processing window. Color defined as #rrggbb
or red, green, blue, cyan, orange, black, white, yellow, magenta.
Related variables: none
- CUTCOM
-
Syntax:
CUTCOM / LEFT, val1
CUTCOM / RIGHT, val1
CUTCOM / ON, val1
CUTCOM / OFF
CUTCOM / val1 CUTCOM / OSETNO, val1
Action:
Definition and activation of the radius compensator (G41, G42, G40)
CUTCOM.osetno = val1: radius compensator
The values for G40, G41, and G42 are defined in the data file and via
GCODE.val[40-42] The radius compensation is defined by the DCODE property in the data
file.
Related variables:
CUTCOM.on = 0 if OFF and 1 if ON, LEFT, or RIGHT
CUTTER.mode = 1 if LEFT and 2 if RIGHT
CUTTER.osetno
Macro call: yes
- CUTTER
-
Syntax:
CUTTER / val1, val2, val3, val4, val5, val6, val7
Action:
- Definition of the current tool
- val1 = tool diameter
- val2= radius of the tool shape circle
- val3= horizontal distance from the center of the profile circle
- val4 = vertical distance from the center of the profile circle
- val5 = tip angle
- val6= taper angle
- val7= height

Related variables:
CUTTER.d = val1
CUTTER.r = val2
CUTTER.e = val3
CUTTER.f = val4
CUTTER.A = val5
CUTTER.B = val6
CUTTER.h = val7
Macro call: yes
- CYLNDR
-
Syntax: CYLNDR / val1, val2, val3, val4, val5, val6, val7
Action: Defines a cylinder entity by its axis and radius
- (val1,val2, val3): coordinates of a point on the axis
- (val4, val5, val6): coordinates of the axis’s direction vector
- val7: radius of the cylinder
Variables involved: none
Macro call: No
Example: circular interpolation in space, excerpt from an APT file.
INDIRV/ .00000, -1.00000, .00000
TLON,GOFWD/(CYLNDR/ 198.99785, -41.64583, -30.93251,$
.00000, .00000, -1.00000, 2.00000),ON,$ (PLANE/PERPTO,$
(PLANE/(POINT/ 198.99785, -41.64583, -30.93251),PERPTO,$
(VECTOR/ .000000, .000000, -1.000000)),$
(POINT/ 198.99785, -41.64583, -30.93251),$
(POINT/ 198.99785, -43.64583, -30.93251))
|