APT Instructions D-F

This section provides basic information about the APT Instructions for for DELMIA SGPost processor.

Most of the examples are taken from the standard postprocessors provided.

DCODE

Grammar:

DCODE / val1, val2, val3

Action:

Writes a radius correction code with the value val1 to the ribbon file, subject to the output conditions val2 and val3. The variable CUTCOM.osetno is updated.

CUTCOM.osetno = val1
  • 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 is updated
  • val3 = 0 The code is generated within the block
  • val3 = 1 The code is generated in an XYZ 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 linear and rotary 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 = 16 The code is generated in a block containing a C-axis

The specific code is defined by the DCODE property in the data file and the corresponding address with CODE used.

Relevant variables:

CUTCOM.osetno 
CODE.used[25]

Macro call: no

DEFLABEL

Syntax:

DEFLABEL / ‘ :’

Action:

Creation of all codes with the ‘LABEL’ property that end with the character ‘ :’ during reverse decoding of an ISO file into SIEMENS format. These codes will be used by SIEMENS jump instructions (IF, REPEAT, WHILE, GOTO).

Affected variables: none

Macro call: no

DELAY

Grammar:

DELAY / val1

Action:

Generation of a delay block: G4F(val1).

The G code is defined by GCODE.val[4], and the delay code has the DWCODE property; the variable ETAT0.time is incremented by the corresponding time in seconds.

Relevant variables:

GCODE.val[4]
ETAT0.time

Macro call: no

DELCODE

Syntax:

DELCODE / val1, val2

Action:

If val1 is the only argument: deletes the code val1 if it is found in the output buffer. Ifval1 and val2 are provided: Replaces the code val1 with the value val2 if it is found in the output buffer.

Affected variables: none

Macro call: no

Example: GOCIR macro for an Andrea head.

$$
IF (head # 6) GOTOUW/ARG1.val[8],ARG1.val[9],ARG1.val[10] IF ( UAXIS.on ) THEN
UPDATE / OFF GOCIR
DELCODE / 3 $$ Remove the X UPDATE UPDATE / ON
ELSE GOCIR ENDIF
$$

DELETE

Grammar:

DELETE / ‘filename’

Action:

Deletes a file; if the filename is relative, the default directory is the NCTAPE directory

Relevant variables: none

Macro call: no

Example: see NCTAPE.

DELETE

Grammar:

DELETE / ‘filename’

Action:

Deletes a file; if the filename is relative, the default directory is the NCTAPE directory.

Relevant variables: none

Macro call: no

Example: see NCTAPE.

DISPLY

Grammar:

DISPLY / ‘comment’

Action:

Definition and writing of a comment in the ribbon file; the comment will be enclosed by the characters defined in the ‘comment = 2’ field of the data file.

Relevant variables: none

COMMENT2.start 
COMMENT2.end

Macro call: yes

DWCODE

Syntax:

DWCODE / val1

Action:

Writes the delay code to the ribbon file with the value val1 (in seconds), subject to the exit conditions val2 and val3. The variable ETAT0.time is updated. ETAT0.time= ETAT0.time + val1/60

  • 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 ETAT0 variable is updated
  • val3 = 0 The code is generated within the block
  • val3 = 1 The code is generated in an XYZ 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 linear and rotary 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 = 16 The code is generated in a block containing a C axis
The specific code is defined by the DWCODE property in the data file and the corresponding address with CODE.used.

Relevant variables:

ETAT0.time 
CODE.used[23]

Macro call: no

ELSE

Syntax:

ELSE

Action:

The IF ( ) THEN statement must appear among the preceding statements. The following lines up to ENDIF are executed if the preceding IF and ELSEIF tests are false.

IF ( test ) THEN
........ 
ELSE
c = 3 
ENDIF

Variables involved: none

Macro call: no

ELSEIF

Syntax:

ELSEIF ( test )

Action:

If test is true, the following lines are parsed until the next ELSE or ENDIF. The IF ( ) THEN statement must be among the preceding statements.

Test can take the following forms:

  • (val) true if val is not 0 ( val1
  • = val2 ) true if val1 equals val2
  • ( val1 # val2 ) true if val1 is not equal to
  • val2 (val1 > val2) true if val1 is greater than
  • val2 (val1 < val2) true if val1 is less than val2
  • (val1>= val2) true if val1 is greater than or equal to
  • val2 (val1 <= val2) true if val1 is less than or equal to
  • val2 (test1 & test2) true if both test1 and test2 are true
  • (test1 | test2) true if either test1 or test2 is true

Variables involved: none

Macro call: no

Example:

IF ( test ) THEN
........
ELSEIF ((a = 1) & (b = 2))
c = 3 
ENDIF

END

Grammar:

END

Action:

End-of-program statement: no action.

Affected variables: none

Macro call: yes

ENDIF

Syntax:

ENDIF

Action:

End of test. The IF ( ) THEN statement must be among the preceding statements

Relevant variables: none

Macro call: no

ENDLOOP

Syntax:

ENLOOP

Action:

End of loop. The LOOP statement must be among the preceding statements.

Relevant variables: none

Macro call: no

EOB

Grammar:

EOB

Action:

Close and write the current block to the nctape file. Affected.

Relevant variables: none

Macro call: no

Example: STOP macro to generate the block: N***M0.

EOB MCODE
/ 0.0 EOB

EOL

Syntax: none

Action:

Call the EOL macro if it exists

Relevant variables: ARG0 text of the line being written.

Macro call: no

Example: Testing limits and writing formatted text to another file.

IF ( STRLEN(ARG0) > 50 ) THEN WRITE1 / ARG0
RETURN ENDIF
$$
text = ARG0 + space text1 = text[1,55]
text1 = text1 + FORMAT(4,SGP.linenum) + " "
x = ETAT0.xyzabc[1] $$ + ETAT0.pts[4]*(CUTTER.h - AXE1.pivot[3])
y = ETAT0.xyzabc[2] $$+ ETAT0.pts[5]*(CUTTER.h-AXE1.pivot[3])
z = ETAT0.xyzabc[3] $$+ ETAT0.pts[6]*(CUTTER.h-AXE1.pivot[3]) z = z + AXE1.pivot[3]
$$
IF ( x < LIMIT.min[1] ) THEN 
ERROR / " OUT OF LIMIT FOR X-
WRITE1 / " OUT OF LIMIT FOR X-
ELSE IF ( x > LIMIT.max[1] ) 
ERROR / " OUT OF LIMIT FOR X+ 
WRITE1 / " OUT OF LIMIT FOR X+
ELSE IF ( y < LIMIT.min[2] )
 ERROR / " OUT OF LIMIT FOR Y-
WRITE1 / " OUT OF LIMIT FOR Y-
ELSE IF ( y > LIMIT.max[2] ) 
ERROR / " OUT OF LIMIT FOR Y+ 
WRITE1 / " OUT OF LIMIT FOR Y+
ELSE IF ( z < LIMIT.min[3] ) 
ERROR / " OUT OF LIMIT FOR Z-
WRITE1 / " OUT OF LIMIT FOR Z-
ELSE IF ( z > LIMIT.max[3] ) 
ERROR / " OUT OF LIMIT FOR Z+ 
WRITE1 / " OUT OF LIMIT FOR Z+
ENDIF
$$
text1 = text1 + FORMAT(7,x) + FORMAT(7,y) + FORMAT(7,z)
text1 = text1 + FORMAT(5,ETAT0.xyzabc[5]) + FORMAT(5,ETAT0.xyzabc[6]) text1
= text1 + " " + FORMAT(4,ETAT0.fedrat) + FORMAT(4,SPINDL.val)
text1 = text1 + FORMAT(5,ETAT0.time) WRITE1 / text1

ERROR

Grammar:

ERROR / ‘error message’

Action:

Displays an error message on the screen; the error variable is incremented. If SGP.error = 1, the error message is written to the ISO file or, if open, to the file opened by OPEN1.

Relevant variables:

  • SGP.error: number of processing errors
  • SGP.error:Indicator for copying to OPEN1 or ISO files

Macro call: no

Example: Excerpt from the GOTO 5-axis macro, angle test.

$$
IF ( abc[1] < LIMIT.min[4] ) THEN
ERROR / "position A" FORMAT(1,abc[1]) EXIT ELSE IF ( abc[1] > LIMIT.max[4] )
ERROR / "position A" FORMAT(1,abc[1]) EXIT ENDIF
$$
IF ( abc[2] < LIMIT.min[5] ) THEN
ERROR / "position B" FORMAT(1,abc[2]) EXIT ELSE IF ( abc[2] > LIMIT.max[5] )
ERROR / "position B" FORMAT(1,abc[2]) EXIT ENDIF
$$

EXEC

Grammar:

EXEC / ‘postprocessor options’

Action:

Execution of a postprocessor at the end of processing.

Affected variables: none

Macro call: no

Example: Creating 2 symmetric ISO files.

PPRINT / RIGHT FOOTER
RENAME / SGP.output + "-D.xpi"
$$
$$ left footer
$$
EXEC / SGP.input + " -2"	$$ Run SGPOST.def postprocessor number 2

EXIT

Grammar:

EXIT / ‘message’

Action:

Immediate termination of postprocessor processing. All files opened for reading and writing are closed. The EXIT macro can use the defined message (ARG0).

Relevant variables: none

Macro call: yes

Example: Excerpt from the 5-axis GOTO macro for angle testing.

$$
IF ( abc[1] < LIMIT.min[4] ) THEN
ERROR / "position A" FORMAT(1,abc[1]) EXIT ELSE IF ( abc[1] > LIMIT.max[4] )
ERROR / "position A" FORMAT(1,abc[1]) EXIT ENDIF
$$

EWRITE

Grammar:

EWRITE / 'string'

Action:

Writes a string at the end of a block, which may itself contain code. This string can consist of numeric or text variables.

Relevant variables: none

Macro call: no

Example: EWRITE "(tool number "+ FORMAT(2,tool) + " )" out →

N10 T2(tool number 2)

FCODE

Syntax:

FCODE / val1, val2, val3

Action:

Writes an F-code (advance) with the value val1 to the ribbon file, subject to the output conditions val2 and val3. The variable ETAT0.fedrat is updated.

  • val2 = 0 The code is generated according to the condition
  • val2 = 1 The code must be generated
  • val2 = -1 The code is not generated, but the variable ETAT0 is updated
  • val3 = 0 The code is generated within the block
  • val3 = 1 The code is generated in an XYZ 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 linear and rotary 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

FCODE without an argument; the value of F must be generated in the next motion block. Each feed mode corresponds to a specific code defined by the values CODE.used[18], CODE.used[19], and CODE.used[20].

Relevant variables:

ETAT0.fedrat
CODE.used[18] if FEDRAT.mode = 2 (G94 mode) 
CODE.used[19] if FEDRAT.mode = 1 (G95 mode) 
CODE.used[20] if FEDRAT.mode = 3 (G93 mode)

Macro call: no

Example: Excerpt from the GOCYCL macro for the MAHO postprocessor.

$$
XYZ = XYZ ( ARG1.val[1] , ARG1.val[2] , ARG1.val[3] ) XCODE / XYZ[1] , 1
YCODE / XYZ[2], 1 ZCODE / XYZ[3], 1
FCODE / CYCLE.fedval GCODE
/ 79
EOB
$$

FEDRAT

Grammar:

FEDRAT / val1 FEDRAT
/ MMPM, val1 FEDRAT / 
MMPR, val1 FEDRAT / 
IPM, val1 FEDRAT / IPR, 
val1 FEDRAT / INVERS

Action:

Definition of the feed rate value and unit; the corresponding modes (G93, G94, G95) and the feed rate value will be generated in the next motion block.

val1: feed rate value in the current unit (G94 = mm/min by default) MMPM: feed rate 
specified in mm/min (G94)
IPM: feed rate specified in inches/minute (G94) MMPR: 
feed rate specified in mm/revolution (G95) IPR: feed 
rate specified in inches/revolution (G95)

Relevant variables:

FEDRAT.mode = 1 if INVERS, 2 if MMPM, and 3 if MMPR 
FEDRAT.upm = val1 if MMPM or IPM
FEDRAT.upr = val1 if MMPR or IPR 
ETAT0.fedmod
ETAT0.fedrat

Macro call: yes

FEED

Grammar:

FEED / val, dist

Action:

Generation of the feed rate and, if necessary, the corresponding G0 or G1 code for a linear movement,including calculation of the travel time. The feed mode and its value are generated as needed.

  • val= 0 rapid traverse
  • val = 1working speed movement
  • val = 2movement in drilling cycle with feed generation
  • val = 3 movement in drilling cycle without feed generation
  • val = 10 rapid traverse and G0 output
  • val= 11 movement at working speed and G1 command generation
  • dist= travel distance; if this value is not specified, the distance used will be the distance defined by the distance between STATUS1.pts and STATUS0.pts.

Relevant variables:

ETAT0.move0 
ETAT0.fedmod 
ETAT0.fedrat 
CYCLE.fedmod 
CYCLE.fedval 
ETAT0.pts 
ETAT1.pts

Macro call: no

Example: excerpt from the GOCYCL macro.

$$
ETAT0.pts = VEC(ARG1.val[1], ARG1.val[2], ARG1.val[3]) FEED / 2
UPDATE
$$

END

Grammar: none

Action:

This function is a macro called when the APT or CLFILE file is closed. It contains the commands to close the ribbon file and the screen comments.

Affected variables: none

Macro call: yes

FORMAT

Syntax:

FORMAT / num, val1, val2

Action:

Modifies or creates the format num. This format may already be defined in the data file(s). Val1 represents the number of the field to be modified, and val2 represents the value.

  • Val1= 1 sign flag (0 or 1)
  • Val1= 2: leading zeros or spaces flag (–1 = space, 0 = no, 1 = ‘0’)
  • Val1 = 3: number of leading zeros or spaces
  • Val1= 4 decimal point definition (-1 = if necessary, 0 = never, 1 = always)
  • Val1 = 5 trailing zeros flag (0 = no, 1 = yes)
  • Val1= 6: number of trailing zeros

Affected variables: none

Macro call: no

FROM

Syntax:

FROM / val1, val2, val3
FROM / val1, val2, val3, val4, val5, val6

Action:

Definition of the starting point.

  • (val1, val2, val3): XYZ coordinates of the starting point in the part coordinate system
  • (val4, val5, val6): IJK orientation of the initial tool axis in the part

Coordinate system. The vector (val4, val5, val6) is normalized if it is not already normalized before processing.

Affected variables: ETAT0.from[6]

Macro call: yes

Example: excerpt from an APT file.

MULTAX LOADTL / 3
CUTTER/ 10.000000, 5.000000, .000000, 5.000000, .000000,$
.000000, 30.000000
SPINDL / 2500
FEDRAT/ 1250.0000
FROM /	.00000,	.00000, 100.00000, .000000, .000000, 1.000000 
PPRINT MOVEMENT TIP

FWRITE

Grammar:

FWRITE / n, 'string'

Action:

Writes a string at position n, preceded by the character "COPY," or at the end of the line if its length is greater than n.

Related variables: none

Macro call: no

Example: FWRITE / 10, "(toolnumber " + FORMAT(2,tool) + " )" out.

N10 T2	(tool number 2)