www.kxcad.net Home > CAM Index > EdgeCAM Index >
The position (before main program, after main program or in-line) is supported via a Token SUBROUTINE, which is available in the Start and End Code Constructors.
If placed in the Start Code Constructor then subroutines will be output before the main program.
If placed in the End Code Constructor, subroutines will be generated after the main program.
If not present then the subroutine will be defined the first time it is encountered, then called by subsequent cycles that use it.
Tokens let you output either separate program or by block number reference subroutine types.
Example of Subroutines
Subroutines types separate program ;
* Turret No. : 4 Diameter :4.000 MM DRILL
* Turret No. : 5 Diameter :10.000 MM DRILL
%
:0001()
N10G21G90G40
N20G10L1Z15.0R2.0T04
N30G10L2Z0.0R5.0T05
N40G53X0.0Y0.0
N50G28G91Z0
N60G28X0Y0
N70G90
O80T04(USER DEFINED)
N90G53M06
N100T05M01
N110S1200M3M41M7
N120G0X0.0Y0.0
N130G43Z10.0H04
N140G98G81X0.0Y0.0Z-1R2.0F66.0
N150M98P0002
O160T05(10mm Drill)
N170G53M06
N180T04M01
N190S2000M3M41M7
N200G0X0.0Y0.0F250.0
N210G43Z10.0H05
N220G98G82X0.0Y0.0Z-10.0P2R2.0
N230M98P0002
N240G00Z60.0M09
N250Z0H00M19
N260M30
%
:0002
N10X10.0Y0.0
N20X20.0
N30X30.0
N40X40.0
N50G80
N60M99
and block number reference
* Turret No. : 4 Diameter :4.000 MM DRILL
* Turret No. : 5 Diameter :10.000 MM DRILL
%
:0001(TEST SUBROUTINES BY BLOCK NUMBER REF.)
N10G21G90G40
N20G10L1Z15.0R2.0T04
N30G10L2Z0.0R5.0T05
N40G53X0.0Y0.0
N50G28G91Z0
N60G28X0Y0
N70G90
O80T04(USER DEFINED)
N90G53M06
N100T05M01
N110S1200M3M41M7
N120G0X0.0Y0.0
N130G43Z10.0H04
N140G98G81X0.0Y0.0Z-10.0R2.0F66.0
N150X10.0Y0.0
N160X20.0
N170X30.0
N180X40.0
N190Y10.0
N200X30.0
N210X20.0
N220X10.0
N230X0.0
N240Y20.0
N250X10.0
N260X20.0
N270X30.0
N280X40.0
N290G80
O300T05(10mm Drill)
N310G53M06
N320T04M01
N330S2000M3M41M7
N340G0X0.0Y0.0
N350G43Z10.0H05
N360G98G82X0.0Y0.0Z-10.0P2R2.0F250.0
N370 N1=150N2=290
N380G98G83X0.0Y0.0Z-10.0Q2.0R2.0F762.0
N390 N1=150N2=290
N400G73X0.0Y0.0Q2.0D1.0F200.0
N410 N1=150N2=290
N420G00Z60.0M09
N430Z0H00M19
N440M30
%
are supported.
Incremental Subroutine co-ordinates
|
Function |
Outputs subroutine’s co-ordinates XY&Z as incremental moves. |
This applies to both subroutine types, program ID and block number reference.
All subroutine co-ordinates will be output as incremental if checked.
If outputting incremental subroutines within an absolute NC program, the code to return to absolute must be programmed as a literal in the Code Constructor Subroutine End.
Start Subroutine Program Numbers (Blank = Progid+1)
|
Function |
Start Subroutine numbering of separate program type. |
If unspecified (blank), the number of the main program will be used.
The following shows the output if the main program is 1 and Start Subroutine Program Numbers is not set:
:0001 * Main program
number
(Subroutines as separate program - progid = 1)
N10G17G21G90G40
N15G0X-54.177Y-72.852S250M3
N20G43Z60.0H03
N25Z10.0
N30M98P0002 * Call subprogram
N35X145.823Y-72.852Z10.0
N40G92X-54.177
N45M98P0002 * Call subprogram
N50G92X145.823Y-72.852Z10.0
N55G28Z0M19
N60X0Y0
N65M30
:0002 * Subprogram
N70X-55.0Y-60.0
N75Z2.0
N80G1Z-10.0F66.0
N85X55.0
N90G3X85.0Y-30.0I0.0J30.0F3000.0
N95G1Y30.0Z-10.0F66.0
N100G3X55.0Y60.0I-30.0J0.0F3000.0
N105G1X-55.0Z-10.0F66.0
N110G3X-85.0Y30.0I0.0J-30.0F3000.0
N115G1Y-30.0Z-10.0F66.0
N120G3X-55.0Y-60.0I30.0J0.0F3000.0
N125G0Z1.0
N130M99
In the above, the Token SUBROUTINE was in the End Code Constructor.