|
System Calls
This GPP2 feature allows the execution of any "system" command to manipulate the files generated through the post-processing run. It is used to replace the execution of the batch (script) file of old GPP.
SYSTEM_CALL argument1 argument2 ...
The SYSTEM_CALL may only be used inside the POST SCRIPT block, which is the last block executed in the run, after all the output files have been closed.
The argument list is similar to the argument list of the OUTPUT statement. It may contain constant strings and variable names. New-line characters, control characters and the TAB_ argument are simply ignored, and should not be used.
GPP2 builds the full system command by formatting and adding up the arguments into one string, and executing that string with the "shell" operating system function.
GPP2 sets the "working folder" to the folder where all the output files are kept, so the system commands can use file names without the full path.
The FILE_NAME system variable is very useful in the SYSTEM_CALL statement, as it contains the toolpath name and the post name:
Example
SYSTEM_CALL "copy " FILE_NAME ".s* subs.txt";
This system command will copy all the subroutine files generated through the run to one file called subs.txt. Assuming the toolpath file is called "TP" and the post being used is called "DEMO", FILE_NAME will contain the value "TP.DEMO". GPP2 will execute the following command: "copy TP.DEMO.s* subs.txt".
SYSTEM_CALL "RENAME " FILE_NAME " OUTPUT";
This system command will rename the output G-code file. For the same file and post names, GPP2 will execute the following command: "RENAME TP.DEMO OUTPUT".
Note: If the output file name is changed using system calls, the EX2 program must "tell" GPP2 about the new file name, so it will be able to display the G-code file if requested. Simply assign the new name to FILE_NAME, inside the POST SCRIPT block.
FILE_NAME = "OUTPUT" ;
Similarly, if the output file is copied or moved to another folder, the EX2 program must tell GPP2 about the new folder. The current output folder name is held in the OUTPUT_DIR variable. The EX2 program must update its value as needed.
For instance, assume that a sub-folder name "SUB" needs to be opened under the current output folder and the G-code file must be moved to the new sub-folder.
SYSTEM_CALL "MD SUB" ; // create sub-folder
SYSTEM_CALL "MOVE " FILE_NAME " SUB" ; // move G-code file
OUTPUT_DIR = OUTPUT_DIR + "SUB\" ; // tell GPP2
|