|
Subroutine Blocks
In case a subroutine is used, the following blocks are being generated, in that order:
Block |
Use and comments |
BEGINNING OF SUB: |
This block is executed once before any call to the subroutine takes place. It precedes all the actual subroutine body motion blocks. |
Subroutine body blocks |
These are the linear and circular motion blocks that define the subroutine body. |
END OF SUB: |
This block is executed once after all subroutine body blocks. |
SUBROUTINE CALL: |
One or more subroutine call blocks are generated, one for each Z level. |
SUBROUTINE RETURN: |
This block is invoked immediately following each SUBROUTINE CALL block. It is useful for commands that should be executed after the subroutine is called (and after it returns). |
Notes:
-
The order of execution is different than in old GPP. With GPP2, the subroutine is processed before any call to it is performed (in GPP, the first subroutine call is invoked before the subroutine definition). That way, GPP2 can "study" the subroutine and record its affect on the tool position and its expected execution time (both need to be known when a call to the subroutine takes place).
-
Unlike old GPP, the SUB_NUMBER parameter is available in the BEGINNING OF SUB block, and can be used as part of the output. The old practice of defining a user variable that is used instead of SUB_NUMBER is not necessary. Furthermore, setting such a number in the subroutine call block is too late, since the subroutine definition takes place before the call.
-
In each SUBROUTINE RETURN block, GPP2 presents the correct tool last position (X_LASTPOS, etc.). GPP2 calculates the motions that will be executed at runtime when the subroutine is called, and sets the variables accordingly.
|