Anda di halaman 1dari 31

**************************************************************************

* Machine independant Code Generator include file


*
* Filename: mill-initialise.cgi
*
Author:
RHA
* Date:
11 November 2005
*
* New file for adaptive milling templates derived from earlier multiplane templa
te
*
**************************************************************************
* Change History
* Version 10.5
*
FIRST ISSUE
* 20/02/06 RHA DEV00016344 Implement IJK vector for 5 axis cycle
* 27/02/06 RHA DEV00016236 Spindle control fixes
* 10/03/06 RHA DEV00016621 Add TNC movement code token
* 16/03/06 RHA DEV00016660 Change to IF tokens for TNC Datum Shifting
* Version 10.75
* 11/05/06 RHA DEV00017093 Variables in user tokens USER11 onwards
* 16/05/06 RHA DEV00017213 Correct index handling for no rotation cases
* Version 11.0
* 01/08/06 RHA DEV00017818 Hole cycle clearance and level options IF token
* 01/08/06 RHA DEV00017490 Make spindle start warning optional
* 04/08/06 RHA DEV00017771 Number of turns token for ISO
* Version 11.5
* 20/09/06 RHA DEV00017909 Expand trace options
* 26/10/06 RHA DEV00018471 HPCC improvements
* 24/11/06 RHA DEV00017338 Move CPLNAME to a template variable
* 08/01/07 RHA DEV00018930 Make ZSAFE value available as a token for hole cycles
* Version 11.75
* 30/04/07 RHA DEV00019883 Tokens etc for Euler angles in Index output
* 14/05/07 RHA DEV00019985 Tokens for XINC etc., improve XABSORIGIN Description
* 21/05/07 RHA DEV00020096 Implement Maintain Index Option at ToolChange
* 24/05/07 RHA DEV00019981 Orthogonal plane cycle controls
* Version 12.00
* 10/08/07 RHA DEV00020285 Add new ISO Datum Shift Tokens
* 25/09/07 RHA DEV00021119 Add setvars and tokens for pivot mode control
* 27/09/07 RHA DEV00021119 Give pivot code its own format entry
* Version 12.25
* 18/10/07 RHA DEV00021382 Correct use of #TMP - #COMPTEMP
* 04/12/07 RHA DEV00021534 Enable longhand tapping
* Version 12.50
* 17/01/08 RHA DEV00022021 Incremental option for Z Clear
* 18/01/08 RHA DEV00021841, DEV00021908 New optional warnings
* 22/01/08 RHA DEV00022142 Clearance options applied to all clearance tokens
* 19/03/08 RHA DEV00022891 Allow concecutive coincident indexes to CPL
**************************************************************************
*
***************************************************************************
***************************************************************************
* SPLINE OUTPUT
***************************************************************************
*
* NC Output control for PCIs (ECS2700)
*
Block Numbering
*
G (preparatory) codes
*
Circular Interpolation
*
Spindle / Gears
*
General Coordinate Systems
*
Rapid Traverse

*
Hole Cycles
*
Toolchange / Tooling
*
Subroutines
*
Cutter Radius Compensation
*
*
Datum Shifting
* #RECORD
*
Multi-plane / Rotary
*
M-FUNCTIONS
*Thread Mill
* Variables for Thread Mill canned cycle
*Extra Variables for TNC
************ Check useage and remove if not required
*User variables for
*
*
Constants for start of G function in DATA1 & M function in DATA2 stateme
nts
*
*
*
*
*
*********************************
*
Tokens - Use in Code Constructor
*
*********************************
*
*
*
G-Codes
*
M Codes
*
General
*
Toolchange / Tooling
* Rapid to Home or ToolChange
*
Cutter Radius Compensation
*
Circular Interpolation
*
Hole Cycles
* Added for Sinumerik840 & Fadal cycles
*
Datum Shift : Translate / Index
* Origin shift for TNC
*
* Datum shift for ISO
*
Tooling Sheet / Program Information
*
Subroutines
*
By block number
*
Position : Before, after, in-line with main NC Program
*
Datums
*
Rotary Axes / Milling
* 5 Axis IKJ
* Pivot options
* Spline Output
* Fanuc specific
* Heidenhain specific
* Tap cycle tokens for different addresses
* Thread Mill Canned Cycle
***********************************************************
* Job Record Tokens
***********************************************************
***********************************************************
* User tokens for
***********************************************************
*
Heidenhain TNC Only
* modal lines in Drill Cycle Modify

* Euler angles for Workplane


***********************************************************
*
M-Functions (Used to create default Code Constructor)
***********************************************************
**************************************************************************
* Machine independant Code Generator include file
*
* Filename: mill-iso-mach-mm.cgi
*
Author:
RHA
* Date:
11 November 2005
*
* New file for adaptive milling templates derived from earlier multiplane templa
te
*
**************************************************************************
* Change History
* Version 10.5
*
FIRST ISSUE
* 16/12/05 RHA DEV00015566 Spline output enabled
* 20/02/06 RHA DEV00016344 New MM line switch for 5 axis IJK
* 02/03/06 RHA DEV00016506 Change default Home and Tool Change locations
* 07/03/06 RHA DEV00015555 High Speed mode tolerance
* Version 11.0
* 18/07/06 RHA DEV00017692 Tidy Code Generator options in hole macros
* 28/07/06 RHA DEV00017797 New MM and MT line switches
* 07/08/06 RHA DEV00012241 Add High speed and coolant controls to Tool Change*
* 08/08/06 RHA DEV00017341 Correct Tool Length Offset setting
* 13/09/06 RHA DEV00018145 Correct High Speed Mode Q var macro setting
* Version 12.00
* 03/04/07 RHA DEV00020278 Allow Macro15 access to USERVAR2
* Version 12.50
* 06/02/08 RHA DEV00022190 Set default helical interpolation
* 19/03/08 RHA DEV00022891 Allow concecutive coincident indexes to CPL
**************************************************************************
**********************************************
* Setting up spindle defaults
**********************************************
* Code Generator Options
* Tapping Modifiers
* Longhand^No^Yes
* CRC Register
* Work Datum Override
* Tap Cycle Type^Floating^Rigid
* Tap CycleTap Cycle^Right Hand^Left Hand
*Chord
Enter chord length for arc splitting
*Full Canned Cycle
* High speed tolerance
* High Speed Mode^Off^On
* Coolant^Off^Flood^Mist
* Tool Length Offset
*
********************************************************************************
**********************
*
Gcodes
20
30
35
40
45
*
Mcodes
*
**************************************************************************
* Machine independant Code Generator include file
*
* Filename: mill-default-kt.cgi

*
Author:
RHA
* Date:
11 November 2005
*
* New file for adaptive milling templates
**************************************************************************
* Change History
* Version 10.5
*
FIRST ISSUE
* 13/03/06 RHA DEV00016683 Alter horizontal machine width
* Version 11.75
* 23/04/07 RHA
Change gantry default size
**************************************************************************
* Base=Height, Width, Length, Thickness
* Mount=Length,Width,Height would be used in case of trunnion table
*lower mount would be used as the default mount
*side mount is for machines with a vertical mount
*saddle mount is for machines with a saddle
* Table=Length, Width, Height, Lead, Angle, Radius
* the line below is used for table in case of horizontal machines with B primary
axis
* Head=Type,Length, Width, Height,Lead, Angle,Protrusion Length,Protrusion Width
,Protrusion Ht,SpindleLocation
* Head=Type,Length, Width, Height,Protrusion Length,Protrusion Width,Protrusion
Ht
* KTTILTTABLE Length, Width, Height, Lead, Angle, Radius
* cylinder KTROTUNIT Length, Radius
* KTSADDLE Length, Radius,thickness,width,height
* KT Chuck Type, Length,Diameter,Bore,JawLength,JawHeight,JawWidth,Protrusion,No
Jaws,NoSteps
*KT ATC - Length Width Depth Lead Angle Diameter Protrusion
*
**************************************************************************
* Machine independant Code Generator include file
*
* Filename: mill-iso.cgi
*
Author:
RHA
* Date:
11 November 2005
*
* New file for adaptive milling templates derived from earlier multiplane templa
te
*
**************************************************************************
* Change History
* Version 10.5
*
FIRST ISSUE
* 16/12/05 RHA DEV00015647 Add R in XY Only Option
* 31/01/06 RHA DEV00012212 Align code constructor trace text
* 06/02/06 RHA DEV00007742 Single helix option for Thread Mill
* 10/02/06 RHA DEV00016236 Spindle control fixes
* 14/02/06 RHA DEV00016311 Change index defaults
* 15/02/06 RHA DEV00016297 Incremental datum shift
* 20/02/06 RHA DEV00016344 Implement IJK vector for 5 axis cycle
* 24/02/06 RHA DEV00016420 Dwell token in peck drill codecon
* 27/02/06 RHA DEV00016236 Spindle control fixes
* 28/02/06 RHA DEV00016369 Fix Convert rapid to feed
* 01/03/06 RHA DEV00016487 Set modality of inex direction M code
* 02/03/06 RHA DEV00016511 G54 default format to be 2.2
* 07/03/06 RHA DEV00015555 High Speed mode tolerance, Reposition ZMOVE in Rapid
codecon
* 07/03/06 RHA DEV00014230 Rotation axes range correction
* 14/03/06 RHA DEV00016367 Spindle control - add spindir to rapid codecon

* 15/03/06 RHA DEV00015533 Add format table entries for toolstore tokens
* 15/03/06 RHA DEV00015655 Add GEARMCODE token to hole cycles
* 21/03/06 RHA DEV00007321 Correct Datum setting - limits
* Version 10.75
* 12/04/06 RHA DEV00010822 Designate logical tokens by colour
* 12/04/06 RHA DEV00016781 Document use of UARRAY1 in template
* 12/04/06 RHA DEV00016809 Colour code tokens
* 20/04/06 RHA DEV00016925 Add PLANEGCODE to Rapid After ToolChange
* 22/05/06 RHA DEV00017232 Add FEEDMODEGCODE for Inverse Time Feeds
* Version 11.0
* 25/07/06 RHA DEV00016799 Remove force output in Rapid After ToolChange
* 26/07/06 RHA DEV00017767 Correct g98g99 terminology - all amachines
* 01/08/06 RHA DEV00017818 Hole cycle clearance and level options
* 01/08/06 RHA DEV00017490 Make spindle start warning optional
* 03/08/06 RHA DEV00017814 Add WORKGCODE token to Rapid Home & Rapid TC
* 04/08/06 RHA DEV00017771 Number of turns token for ISO
* 24/08/06 RHA DEV00017771 Suppress P0 in helix
* Version 11.5
* 20/09/06 RHA DEV00017909 Expand trace options
* 26/10/06 RHA DEV00018471 HPCC improvements
* 03/11/06 RHA DEV00018471 ToolChange HPCC call should only be via a token
* 21/12/06 RHA DEV00018873 Call 5 axis off at end if still active
* 04/01/07 RHA DEV00018873 5 Axis cancel, correct for 3 axis machines
* 08/01/07 RHA DEV00018930 Make ZSAFE value available as a token for hole cycles
* 07/02/07 RHA DEV00018471 Correct Highspeed output in CORE TC
* 07/02/07 RHA DEV00018873 try again
* Version 11.75
* 30/04/07 RHA DEV00019883 Tokens etc for Euler angles in Index output
* 14/05/07 RHA DEV00019985 Tokens for XINC etc.
* 24/05/07 RHA DEV00019981 Orthogonal plane cycle controls
* 29/05/07 RHA DEV00019981 Force longhand holes in mc coords
* Version 12.00
* 09/08/07 RHA DEV00020648 Implement pitch suppression in ISO mill
* 10/08/07 RHA DEV00020285 Add new ISO Datum Shift Tokens
* 25/09/07 RHA DEV00021119 Add setvars and tokens for pivot mode control
* 27/09/07 RHA DEV00021119 Give pivot code its own format entry
* Version 12.25
* 03/12/07 RHA DEV00021534 Enable longhand tapping
* Version 12.50
* 17/01/08 RHA DEV00022021 Incremental option for Z Clear
* 04/02/08 RHA DEV00016982 Make tool user tokens available in tool set up
* 18/02/08 RHA DEV00022063 Fix single helix and tidy call structure
**************************************************************************
*
*************************
*
*
Template Notes Area
*
*
*************************
* Notes must be defined outside of all procedures using the following syntax
* Text is displayed in the machine NOTES area of the CGD
* Length limit
*
*
*
********************************
*****************************
*
*
Template Dependant Langu
age extensions for Code Wizard *
*
********************************
*****************************
*************************************************
*
Tab Name
:
General G-Codes
*************************************************

*************************************************
*
Tab Name
:
Hole Cycle G-Codes
*************************************************
*************************************************
*
Tab Name
:
Datum G-Codes
*************************************************
* Setvar^DATA1(25)^54^Datum G-Codes^REAL^Work Coord System 1
* Setvar^DATA1(26)^55^Datum G-Codes^REAL^Work Coord System 2
* Setvar^DATA1(27)^56^Datum G-Codes^REAL^Work Coord System 3
* Setvar^DATA1(28)^57^Datum G-Codes^REAL^Work Coord System 4
* Setvar^DATA1(29)^58^Datum G-Codes^REAL^Work Coord System 5
* Setvar^DATA1(30)^59^Datum G-Codes^REAL^Work Coord System 6
********************************************
*
Tab Name
:
M-Codes
********************************************
*
*
*************************************************
*
Tab Name
:
Coolant Control
*************************************************
*************************************************
*
Tab Name
:
New Datum Setting
*************************************************
*************************************************
*
Tab Name
:
NC File General
*
*************************************************
****************************************************************
* Tab Name
:
Setup Sheet
****************************************************************
*************************************************
*
Tab Name
:
Block Numbers
*************************************************
*************************************************
*
Tab Name
:
Rapid Traverse
*************************************************
* Setvar^#RAPIDFEEDRATE^5000^Rapid Traverse^REAL^Highfeed (units/min.)
*************************************************
*
Tab Name
:
Circular Interpolation
*************************************************
*************************************************
*
Tab Name
:
Cutter Compensation
*************************************************
*************************************************
*
Tab Name
:
Hole Cycles
*************************************************
* Setvar^#ORTHCYCLES^0^Hole Cycles^YESNO^Allow Canned Cycle On Orthogonal Planes
*************************************************
*
Tab Name
:
Thread Mill Cycle
*************************************************
* Setvar^#ORTHMILLCYCLES^0^Thread Mill Cycle^YESNO^Allow Canned Cycle On Orthogo
nal Planes
*************************************************
*
Tab Name
:
Subroutines
*************************************************
*************************************************
*
Tab Name
:
Tool Change
*************************************************
***********************************************************
*
Tab Name
:
Multi-plane / Rotary Milling
***********************************************************

* Setvar^#AXISTYPE1^2^First Rotary Axis^LIST^Axis Mounted In^1^Head^Table


***********************************************************
* Workplane definition
***********************************************************
***********************************************************
*
Tab Name
:
4-5 Axis Machining
***********************************************************
********************************************************************************
**********
*
Modal Variables
****************************************************************
* Tab Name
:
Debug
****************************************************************
****************************************************************
* G Code 5 Axis
*
*
*****************************************
*
*
Tab Name
:
Program Start
*
*
*****************************************
*
*
Note ! Cannot be a procedure because %SUBROUTINE must be defined in the
START or END macros
*
*
Rotary Axes set to zero for start of program
*$DEBUG=Y
********************************************************************************
*********************************
*
Note ! Cannot be a procedure because %SUBROUTINE must be defined in the
START or END macros
* *************************************************
*
Code constructors
* *************************************************
* *************************************************
*
*
Tab Name
:
Set-Up / Tooling Sheet
*
*
*************************************************
*
*
*
* Setup sheet header if requested (not in loop)
*
*
Remove duplicate tools from Tool Sheet
*
* Setup sheet trailer if requested (not in loop)
*
*
*
*************************************************
*
*
Tab Name
:
Set Tooling Data
*
*
*************************************************
*
*
*
*****************************************
*
*
Tab Name
:
Rapid Move
*
*
*****************************************
*
* Output speed block ?
*
*
*********************************************
*
*
Tab Name
:
Linear Interpolation
*
*
*********************************************

*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

Output speed block ?


*************************************************
*
Tab Name
:
Circular Interpolation
*************************************************

2D only, blank unwanted values


Output speed block ?
Enables control of multi-helix block for TNC
Call to get number of turns
Output speed block ?
Suppress number of turns if 0
*****************************************
*
Tab Name
:
Dwell
*****************************************
*****************************************
*
Tab Name
:
Cutter Compensation
*****************************************

*************************************************
*
Tab Name
:
Cancel Cutter Compensation
*************************************************
*************************************************
*
Tab Name
:
Drill Cycle
*************************************************
Output speed block ?
*************************************************
*
Tab Name
:
Counterbore Cycle
*************************************************
Output speed block ?
*************************************************
*
Tab Name
:
Peck Drill Cycle
*************************************************
Output speed block ?
*************************************************
*
Tab Name
:
Tapping Cycle
*************************************************

*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

Rigid or floating
Output speed block ?
Output speed block ?
*************************************************
*
Tab Name
:
Ream / Bore Cycle
*************************************************
Output speed block ?
*************************************************
*
Tab Name
:
Bore Cycle
*************************************************
Output speed block ?
*************************************************
*
Tab Name
:
Chipbreak Cycle
*************************************************
Output speed block ?
*************************************************
*
Tab Name
:
Thread Mill Cycles
*************************************************

Call to get number of turns


Output speed block ?
*************************************************
*
Tab Name
:
Hole Cycle Points
*************************************************
Output speed block ?
*************************************************
*
Tab Name
:
Cancel Canned Cycle
*************************************************

*****************************************
*
Tab Name
:
First Toolchange
*****************************************

Output speed block ?


*****************************************
*
Tab Name
:
General Toolchange
*****************************************

*
* Output speed block ?
*
*
*****************************************
*
*
Tab Name
:
Last Toolchange
*
*
*****************************************
*
* Output speed block ?
*
*
*****************************************
*
*
Tab Name
:
Core Toolchange *
*
*****************************************
*
*
*
*****************************************
*
*
Tab Name
:
Spindle
*
*****************************************
*
*
*
*****************************************
*
*
Tab Name
:
Program Stop
*
*
*****************************************
*
*
*
*****************************************
*
*
Tab Name
:
Coolant
*
*****************************************
*
*
*
*****************************************
*
*
Tab Name
:
Exact Stop
*
*****************************************
*
*
*
*****************************************
*
*
Tab Name
:
Feed / min / rev
*
*
*****************************************
*
*
*
*****************************************
*
*
Tab Name
:
Comment
*
*****************************************
*
*
*
*****************************************
*
*
Tab Name
:
Insert NC Code
*
*
*****************************************
*
*
*
*****************************************************
*
*
Tab Name
:
Re-Select Tool Length Offset
*
*****************************************************
*
*
*
*****************************************************
*
*
Tab Name
:
High Speed M/c - ON
*
*
*****************************************************
*
*

*
*****************************************************
*
*
Tab Name
:
High Speed M/c - OFF
*
*
*****************************************************
*
*
*
*************************************************
*
*
Tab Name
:
Warnings
*
*
*************************************************
*
*
*
*****************************************
*
*
Tab Name
:
Rapid To Toolchange
*
*
*****************************************
*
* Output speed block ?
*
*
*********************************************
*
*
Tab Name
:
Rapid After Toolchange *
*
*********************************************
*
* Output speed block ?
*
*
*****************************************
*
*
Tab Name
:
Rapid To Home
*
*
*****************************************
*
* Output speed block ?
*
*
*
*************************************************
*
*
Tab Name
:
Set Work Datums
*
*
*************************************************
*
*
*
*
*************************************************
*
*
Tab Name
:
Select Work Datums
*
*
*************************************************
*
*
*
Datum Shift- no rotary motion
* Called from Datum Shift and Index Pallet commands for Absolute Datum setting
*
Index Pallet with Rotary output via Index Pallet Code Constructor.
*
*
*
Datum Shift- no rotary motion
* Called from Datum Shift and Index Pallet commands for Incremental Datum sett
ing
*
Index Pallet with Rotary output via Index Pallet Code Constructor.
*
*
*
*************************************************
*
*
Tab Name
:
Subroutine Start
*
*
*************************************************
*

*
*
*************************************************
*
*
Tab Name
:
Subroutine Call
*
*
*************************************************
*
*
*
*************************************************
*
*
Tab Name
:
Subroutine End
*
*
*************************************************
*
*
*************************************************
*
*
Tab Name
:
Translate
*
*
*************************************************
*
*
*
*
*************************************************
*
*
Tab Name
:
Spline Parameter
*
*
*************************************************
*
* Following code constructors for MPL support only
*
*
*************************************************
*
*
Tab Name
:
5 axis mode
*
*
*************************************************
*
*
*
*************************************************
*
*
Tab Name
:
Index Table
*
*
*************************************************
*
*
*
*************************************************
*
*
Tab Name
:
Index Head
*
*
*************************************************
*
* Sequence Definition^Index Head^-1^Multi-Axis (Rotary)
* Use Tokens^DELETE^BLKNUM^PRESETGCODE^WORKGCODE^XABSORIGIN^YABSORIGIN^ZABSORIGI
N^CPLNAME
* Use Tokens^REAR_ANGLE^FRONT_ANGLE^WORKREGISTER^ROTATE CLW/CCLW^T-CLAMP-ON^T-CL
AMP-OFF
* Use Tokens^USER-STRING^USER-STRING-1^USER-STRING-2^USER-STRING-3^USER-STRING-4
^USER-STRING-5
* Use Tokens^USER-1^USER-2^USER-3^USER-4^USER-5^USER-6^USER-7^USER-8^USER-9^USER
-10
* Use Tokens^USER-11^USER-12^USER-13^USER-14^USER-15^USER-16^USER-17^USER-18^USE
R-19^USER-20
* Default Sequence^[DELETE]^[BLKNUM]^[T-CLAMP-OFF]
* ENDIF
* IF TEMPLATE=4AXMILL
* Default Sequence^[DELETE]^[BLKNUM]^[WORKGCODE]^[<C>REAR_ANGLE]^(^[CPLNAME]^)
* ENDIF
* IF TEMPLATE=MPLMILL^5AXMILL
* Default Sequence^[DELETE]^[BLKNUM]^[WORKGCODE]^[<C>REAR_ANGLE]^[<C>FRONT_ANGLE
]^(^[CPLNAME]^)
* ENDIF

* IF TEMPLATE=MPLMILL^4AXMILL^5AXMILL
* Default Sequence^[DELETE]^[BLKNUM]^[T-CLAMP-ON]
*
*
*************************************************
*
*
Tab Name
:
Select Rotary / Planar Mode
*
*
*************************************************
*
*
*************************************************
*
*
Tab Name
:
Reset Rotary Datum
*
*
*************************************************
*
*
*************************************************
*
*
Tab Name
:
Wrap Height
*
*
*************************************************
*
* Dummy procedures
*** Format table
* Note token numbers 0-14 should not be changed
* 10 is null output for initialisation of variables.
* FT_SECONDARYROT2, A,3,2,640,4,2,640, 50
Head - Secondary Setting
**************************************************************************
* Machine independant Code Generator include file
*
* Filename: Whiteboard.cgi
*
Author:
RHA
* Date:
09 December 2005
*
* New file for all adaptive template
**************************************************************************
* Change History
* Version 10.5
*
FIRST ISSUE
* 14/02/05 RHA DEV00016309 Fix long lines for codecon.txt
* Version 12.5
* 19/02/08 RHA DEV00022469 Add note prohibiting duplicate macros and procedures
**************************************************************************
*
*****************************************
*
*
Tab Name
:
Hackers Corner *
*
*****************************************
*
**************************************************************************
* Machine independant Code Generator include file
*
* Filename: mill-iso-macros.cgi
*
Author:
RHA
* Date:
11 November 2005
*
* New file for adaptive milling templates derived from earlier multiplane templa
te
*
**************************************************************************
* Change History
* Version 10.5
*
FIRST ISSUE
* 06/02/06 RHA DEV00007742 Single helix option for Thread Mill
* 28/02/06 RHA DEV00016465 Remove macro 101 - old spindle control
* 03/03/06 RHA DEV00016525 Correct longhand drill output
* 07/03/06 RHA DEV00015555 High Speed mode tolerance
* 08/03/06 RHA DEV00016567 Use system var for work datum name override

* Version 11.0
* 18/07/06 RHA DEV00017692 Tidy Code Generator options in hole macros
* 01/08/06 RHA DEV00017489 #Macro not set for hole cycles
* 07/08/06 RHA DEV00012241 Add High speed and coolant controls to Tool Change*
* 08/08/06 RHA DEV00017341 Correct Tool Length Offset setting
* Version 11.5
* 18/07/06 RHA DEV00012692 Correct drill sub output for 1 location
* 26/10/06 RHA DEV00018471 HPCC improvements
* 13/12/06 RHA DEV00018738 Correction for profile start
* Version 11.75
* 03/04/07 RHA DEV00017611 Implement 21 flag in rotary rotate
* 18/05/07 RHA DEV00017611 Change withdrawn, pending other fixes
* Version 12.00
* 03/04/07 RHA DEV00020278 Allow Macro15 access to USERVAR2
* Version 12.25
* 03/12/07 RHA DEV00021534 Enable longhand tapping
* Version 12.50
* 04/02/08 RHA DEV00006310 Allow canned cycles in Rotary Rotate
**************************************************************************
* Force #TOOLCHANGE=#FALSE to prevent SPEEDS lookahead
* Suppress CRC calls until Subfunct is set
* #ROTVALS controls use of ROT1/ROT2 values for rotary positioning
* #ROTVALS=#FALSE
*
Only applies to Subprogram style NOT inline bloc
k number reference.
*Set HOLD values
* SF201 Reverse spindle in longhand tapping
*************************************************************
*
Miscellaneous "User Defined" Macros : Reserved
*
*
==============================================
*
*
*
*************************************************************
*
101
Spindle
Stop/ CLW/ CCLW/ CLW+Coo
lant/ CCLW+Coolant
*
102
Reserved (Used by software?)
*
103
Stop Type
Program/ Optional
*
104
Coolant
Flood/ Mist/ Off
*
105
Block Skip
Off/ On
*
106
Exact Stop/Smooth
Off/On
*
107
Reserved (Used by software?)
*
108
Comment
Text string input
*
109
Insert NC Code
NC code literal input
*
110
High Speed M/C
Off/On
*
111
Reserved
*
112
Reserved
*
113
Reserved
*
114
Reserved
*
115
Reserved
*
116
Length Offset
Tool Length Offset
*
117
Reserved
*
118
Reserved
*
119
Reserved
*
120
Reserved
*
121
Reserved
*
122
Reserved
*
123
Reserved
*
124
Reserved
*****************************
*
Rotary Milling Macros *

*****************************
* #ROTVALS=#TRUE
*
Processes Radial Arcs
*
Processes Radial Arcs
**************************************************************************
* Machine independant Code Generator include file
*
* Filename: mill-procedures-basic.cgi
*
Author:
RHA
* Date:
11 November 2005
*
* New file for adaptive milling templates derived from earlier multiplane templa
te
**************************************************************************
* Change History
* Version 10.5
*
FIRST ISSUE
* 16/12/05 RHA DEV00014907 TLO setting
* 16/12/05 RHA DEV00015647 Add R in XY Only Option
* 02/02/06 RHA DEV00012705 Set radius for thread milling
* 06/02/06 RHA DEV00007742 Single helix option for Thread Mill
* 06/02/06 RHA DEV00015578 Thread mill - G40 if G01 followed by G00
* 10/02/06 RHA DEV00016236 Spindle control fixes
* 10/02/06 RHA DEV00016273 Fix G2/3 swap for G18/19
* 10/02/06 RHA DEV00016282 Thread mill move correction
* 15/02/06 RHA DEV00016297 Incremental datum shift
* 20/02/06 RHA DEV00016344 Implement IJK vector for 5 axis cycle
* 27/02/06 RHA DEV00016236 Spindle control fixes
* 27/02/06 RHA DEV00016320 Rapid after toolchange with thread mill canned cycle
* 27/02/06 RHA DEV00016464 Force spindle code out if stop
* 28/02/06 RHA DEV00016465 Correct 2D arc output in thread mill
* 28/02/06 RHA DEV00016369 Fix Convert rapid to feed
* 01/03/06 RHA DEV00016464 Add warning for feed moves at Spindle Stop
* 03/03/06 RHA DEV00016525 Correct longhand drill output
* 08/03/06 RHA DEV00016567 Use system var for work datum name override
* 14/03/06 RHA DEV00016367 Correct spindle control
* 14/03/06 RHA DEV00016464 Correction
* 16/03/06 RHA DEV00016662 Suppress unwanted CRC warning
* 21/03/06 RHA DEV00007321 Correct Datum setting - limits
* 21/03/06 RHA DEV00012705 Correct radius in helix output for thread mill
* 22/03/06 RHA DEV00016714 Remove diagnostic output line for #DATUMMAX
* 24/03/06 RHA DEV00016742 Correct index codecon calls for 4 axis, #AXISTYPE2=#A
XISTYPE1
* 28/03/06 RHA DEV00016749 Correct subroutines processing for hole cycles
* Version 10.75
* 16/05/06 RHA DEV00017213 Correct index handling for no rotation cases
* 18/05/06 RHA DEV00017213 Fine tune
* 23/05/06 RHA DEV00017233 Correction for always use radius
* 24/05/06 RHA DEV00017039 Fix spindle directions in tapping
* 06/06/06 RHA DEV00017232 5 Axis check in Nomotion as well at PT_Rotary_Axes
* 13/06/06 RHA DEV00017523 Prevent output of longhand tapping cycles
* Version 11.0
* 12/07/06 RHA DEV00017700 Set #SPEED=NEXTSPEED if SPEED unset
* 25/07/06 RHA DEV00016799 Initialise tool position at toolchange and index
* 26/07/06 RHA
Correct NEXTZMOVE setting for reversed axes
* 28/07/06 RHA DEV00017797 New MM and MT line switches
* 01/08/06 RHA DEV00017818 Hole cycle clearance and level options
* 01/08/06 RHA DEV00016703 Only process speed and gears if there is a change
* 01/08/06 RHA DEV00017490 Make spindle start warning optional
* 04/08/06 RHA DEV00017771 Number of turns token for ISO, trap and fix exact 360

deg helix count


* 07/08/06 RHA DEV00012241 Add High speed and coolant controls to Tool Change
* 09/08/06 RHA DEV00017902 Correct thread mill helix for TNC
* 11/08/06 RHA DEV00012241 Remove diagnostic line, Correct thread mill for rever
sed axes
* 13/09/06 RHA DEV00018171 Correct initialisation of tool position after datum s
hift
* Version 11.5
* 25/09/06 RHA DEV00017909 Expand trace options
* 12/10/06 RHA DEV00012692 Correct drill sub output for 1 location
* 13/10/06 RHA DEV00018390 PT_CONVERT_COORDS
* 17/10/06 RHA DEV00018409 Fix Duplicate angle reversal by Rapid to ToolChange
* 03/11/06 RHA DEV00018471 ToolChange HPCC call should only be via a token
* 24/11/06 RHA DEV00017338 Move CPLNAME to a template variable
* 05/12/06 RHA DEV00018738 Fix CRC calls to cancel on arc
* 08/12/06 RHA DEV00018738 Correct calls in circle and intialise variables
* 19/12/06 RHA DEV00018593 Set #PLANEGCODE in Thread Milling
* 21/12/06 RHA DEV00018869 Remove diagnostic code
* 02/01/07 RHA DEV00017909 Remove old thread mill array dump
* 25/01/07 RHA DEV00019078 Correct datum over ride setting
* 15/02/07 RHA DEV00017338 Correction to CPL name in Rapid after TC
* Version 11.75
* 19/03/07 RHA DEV00019554 Correct precision of XCP YCPL ZCPL in use
* 13/04/07 RHA DEV00019730 Correct wrapped drill cycle approach move
* 30/04/07 RHA
Post processing speed up
* 21/05/07 RHA DEV00020096 Implement Maintain Index Option at ToolChange
* 24/05/07 RHA DEV00019981 Orthogonal plane cycle controls
* 29/05/07 RHA DEV00019987 Reverse coordinate after array axis swap
* 30/05/07 RHA DEV00019987 Limit fix to 5 axis rotary
* 01/06/07 RHA DEV00019987 Leave array axis swap but remove sign reversal.
* 01/06/07 RHA DEV00020208 Fix Index after TC (Head Head)
* Version 12.00
* 23/07/07 RHA DEV00020524 Avoid spurious CRC warnings
* 24/07/07 RHA DEV00020524 Comp Fix, Plan B. Set $COMPOUT only when state change
d
* 03/08/07 RHA DEV00020524 Fix comp problem in CIRCLE procedure
* 10/08/07 RHA DEV00020285 Add new ISO Datum Shift Tokens
* 28/08/07 RHA DEV00020760 DEV00020742 DEV00019720 Fix approach coordinates
* 29/08/07 RHA DEV00020760 DEV00020742 DEV00019720 Fix axis reversals in toolcha
nge
* 27/09/07 RHA DEV00021172 Correct datum output when index not maintained
* Version 12.25
* 18/10/07 RHA DEV00021382 Correct use of #TMP, Use #COMPTEMP
* 07/11/07 RHA DEV00019365 Additional debug output for holes and thread mill
* 03/12/07 RHA DEV00021534 Enable longhand tapping
* 17/12/07 RHA DEV00021869 Correct Rapid after TC for longhand hole cycles
* Version 12.5
* 21/12/07 RHA DEV00021292 ASIN fails on taper thread
* 24/12/07 RHA DEV00021372 Trap hole cycle level change
* 17/01/08 RHA DEV00022021 Incremental option for Z Clear
* 18/01/08 RHA DEV00021841, DEV00021908 New optional warnings
* 18/02/08 RHA DEV00022063 Fix single helix and tidy call structure
* 19/03/08 RHA DEV00022891 Allow concecutive coincident indexes to CPL
* 17/06/08 RHA DEV00022820 Correct angle at toolchange logic PMACRO-15
* 17/06/08 RHA DEV00022820 Set hold values to #FUNNY in PMACRO-15
* 17/06/08 RHA DEV00023246 Adjust rotary initialisation according to machine typ
e
**************************************************************************
*
*******************
*
Initialisation procedures

*
********************
*
Initialisation system and user defined variables
* Axis Reversal Multipliers
* Automatic Datum Setting
*
*
Retrieve from MM & MT lines
* Coolant code output
* 1 rotary axis, set second type as first
*
Multi-plane
(3axis + Index)
*
Rotary milling (4axis)
* 5 axis IJK machining
*
Rotary Axes offset e.g. zero programmed as 90 degrees
* Subroutine numbering
* Block numbers
*PRECISION=#INCR-(#INCR/100)
* Head operation mode variables
********************************************************************************
************
* Select abs/inc at post run time
* Note #incrxyz is current abs/inc setting
*
#incrxyzhold is main program setting
*
#incrsubs is subroutine setting
********************************************************************************
************
* Called by all START macros to set initial position etc.
* Current CPL output values
* %CALL=PT_SET_PRECISION might need functionality here
* Machine Datum output values
* %CALL=PT_SET_PRECISION might need functionality here
* Reset HOLD with reversals if not incremental
* Set CPL offset for moves to Home and TC
********************************************************************************
************
* Canned cycle capability checks, Longhand if canned cycle not available
*Drill
* Check tool orientation conditions
* DB12120 Rotary Rotate outputs cycle and expanded equivalent. Suppress cycle t
o prevent duplicate moves
* Entry feed set - longhand output only
********************************************************************************
************
*
*******************
*
Macro support procedures
*
********************
*
* <DRILL-CYCLE Peck [DEPTH=0] Dwell [DWELL=0]>
* %IF #EXPANDG82=1 %THEN %NOCYCLE
* Counter bore cycle
* Peck Cycle
* Drill Cycle
**************************************************************************
**************************************************************************
**************************************************************************
**************************************************************************
*
* Check and reset direction
* Right hand threads
* Left hand threads
*
**************************************************************************

* Force #TOOLCHANGE=0 to prevent SPEEDS lookahead


* Set CRC output control for profile lead in/out
**************************************************************************
* %IF #G55<>0 %THEN $WARNING="Warning - Workshift in Toolchange not valid with
Datum Shift - Option ignored":%CALL=CODECON_WARNING:%GOTO @NOTOOL_WORKSHIFT
*
* AutoCoolant
* ToolChange Coolant control
* 1 - No Change
* Spindle controls
* Through tool coolant
* Position not move, therefore never incremental
* Set to Initial CPL - head rotation only
* Check correct position
* No Rapid_to_ToolChange call
* Check Z position only, allow for axis reversal
* Reset Orientation - Maintain Index
* Head rotations assumed 0 for toolchnage
* Table rotations unchanged
* Allow for ToolChange at 0 angles, head axes only
* Head-head machine
* Tool at angles 0 for toolchange
* Output initial position after TC and Index only
**************************************************************************
*
Cutter compensation will
*
1.
Only be active during feedrate moves - not rapid
*
2.
Will not be active during a Z move. (NOTE! G17=> Z/G18 => Y/G19
=> X - but edgeCAM doesn't allow tool normal to these planes)
*
Only Feed Code Constructor has Cutter comp Tokens available.
*
*
NOTE! All output is processed is produced from a cut move : feed, clw, c
clw
*
*
Subfunct 1=off, 2=left, 3=right
* #WarnCRC = 1 CRC Warn if Used
* #WARNCRC90 = 1 CRC warn if not 90
* #CRCONZ2 =1 Warn if applied with Z move
* #CRCONZ1 =1 Warn if removed with Z move
*
*
Register number - If Uservar67 set then use else determine depen
dant on #AUTOREG
*
*
*
If mirror is active then need to reverse cutter comp
*
*
Hold original settings
**************************************************************************
* <*Move [XMOVE=0] [YMOVE=1] [Zmove=2] >
* <*Inc [XINC=0] [YINC=1] [ZINC=2] >
* <*Sub [XSUB=0] [YSUB=1] [ZSUB=2] >
* <*Hold [#XHOLD=0] [#YHOLD=1] [#ZHOLD=2] >
* First pass only - Initialise start point
* First pass through translate is second call of subroutine.
*
*
Rapid to position of next move
* Incremental Subroutines
* Absolute approach
* prevent output of null effect G92 block
*
Apply translation - G92 will reset registers
*
Call Subroutine

**************************************************************************
**************************************************************************
**************************************************************************
************ Diagnostic printout
************
* Full canned cycle USERVAR8=1. #THREADCANNED=2
* Canned cycle preparation
* Canned cycle output
* True canned cycle only
**************************************************************************
* Check tool orientation conditions
*If no comp requested ensure output flag is true
* Check for helical interpolation
* %IF PATHTRACE=1 %THEN %NOCYCLE
*Check for array data.
* #TMP=XPOINT(#LOOP):#TMP1=YPOINT(#LOOP):#TMP2=RADIUS(#LOOP)
* <Loop [#LOOP=0] . [#TMP=0] [#TMP1=1] [#TMP2=2] >
*look for lift out on NEXT move
* <* Loop [#LOOP=0] Next [#NEXTLOOP=0]>
* <Lift Next From [#TMP1=2] To [#TMP2=2]>
* Look for last leg and cancel compensation
**************************************************************************
* Through Tool Coolant
* Adjust tool/home position to current CPL if required
**************************************************************************
* Through Tool Coolant
* Adjust tool/home position to current CPL if required
**************************************************************************
* <*Move [XMOVE=0] [YMOVE=1] [Zmove=2] >
* <*Inc [XINC=0] [YINC=1] [ZINC=2] >
* <*Sub [XSUB=0] [YSUB=1] [ZSUB=2] >
* <*Hold [#XHOLD=0] [#YHOLD=1] [#ZHOLD=2] >
*
Translate Reset
* Reset is only needed if absolute subroutines have been used with G92 datum set
ting
* Update stored end point (XINC etc in Reset are TOTAL increments for this level
)
*<*HOLD2 [#XHOLD=0] [#YHOLD=1] [#ZHOLD=2] >
* Final G92 position.
* Update Keep values
**************************************************************************
* Find Gear
* Spindle control
* Reset old values if stopped
**************************************************************************
*
*******************
*
Debug Trace Procedures
*
*******************
* Called from token TOOLTYPE
*
*******************
*
Program Defaults
*
*******************
*
*
Handle User Input when Token PROGDESCR used
*
Handle User Input when Token PROGDESCR used
*
Handle User Input when Token PROGID used
*
Handle User Input when Token PROGDESCR used
*
*****************************************
*
*
Test Profile Lead conditions
*
*
*****************************************

*
*
*
*
*
*
*
*
*
*
*
*
*

Check for arc move


Thread Milling
#WarnCRC = 0 No warnings
1 CRC Warn if Used only
2 CRC warn if not 90 only
3 Both above warnings
Warn for CRC application on Z move
Warn for CRC cancellation on Z move
Global output Rapids as high feedrates if #FEEDRAPIDS set to Yes
- use #FEED to force re-instate of cut feed

*
* #FIRSTRAPIDZ=#FIRSTRAPIDZ+#ZTOOLSUB
* if the first move after is in xy only then z should be next z
* Don't use NEXTZ if FEED move follows
*
* Set Rotary directions
* %IF #ROTVALS=0 @SKIP_ROT_SET
*Set CPL Parameters
*
*
* procedure to set and check spindle speed whenever the token is used.
* Look ahead at ToolChange or Rapid
*Look ahead
* Only process if speed changed
* Spindle Stop
* Warning Output
* Warn for feed moves only
*
*
* Fix for thread mill lead out
* Comp On
* Comp Off
* Fix for thread mill lead out, Thread mill always sets SUBFUNCT to 1
* Set Rotary directions
* %IF #ROTVALS=0 @SKIP_ROT_SET
* Checks for CRC
*
Output Feed move
*
Cancel cutter compensation via CodeCon_cancel-cutter-comp
*
Code Constructor must be empty if output is with move otherwise blank bl
ock will be produced
*
* Handles cutter compensation in all situations
* #COMPON signals the state requested by EdgeCAM cycle
* Subfunct signals state for this move
* $COMPOUTPUT signals whether it has been output
*****************************
*
Profile Cycle
*
*****************************
* IF SUBFUNCT=0 @END
*********************************************
*
Handles apply compensation in all cases *
*********************************************
*
Retrieve original compensation Gcode
*
Retrieve current compensation Dcode (register)
*************************************************
*
Handles cancel compensation in all cases
*

*************************************************
*
Set Cancel GCode
*
Output is from motion procedure since is either with or after mo
ve
* Call codecon for machines needing separate G40 block
*
*
Reverse G41/G42 if processing mirror image longhand
*
*
After Mirror, Compensation may be cancelled due to final Rapid. Need to
retrieve last
*
active Comp GCode.
*
reverse G41/G42 is processing mirror image
*
* This procedure is to trap variables which when formatted are output as -0
* Suppress COMPDCODE if no COMPGCODE
* Suppress too small moves in single quad case only
*
Radial Rotary Arcs output via Procedure=Radial_circle
*
Process planar arc
*
*
* Reset CRC Register
* Suppress COMPDCODE if no COMPGCODE
* Suppress too small moves in single quad case only
*
Radial Rotary Arcs output via Procedure=Radial_circle
*
Process planar arc
*
*
* Reset CRC Register
* Setvar^#USERADS^Use Radius: 0 Never, 1 When Possible, 2 When Possible (XY), 3
Always
* Use rads if XY plane only
* Check CRC lead conditions
* Lead Out
* Lead in
* Adjust Feedrate if required
* Set plane G code
* Set angles in rotary
* Set IJK
* ZEND set for G17 helical arcs. G18/9 not set because of DEV00011313
* <XYPLANE= [XYPLANE=0]>
* Set Radius and precision
* Set radius precision and check arc centre
* Set arc type - Radius or IJK
* <Inc [#INCANGLE=0]>
* Always use radius
* Check for full circle (0 or 360)
* <AA PITCH [PITCH=2]>
* Set Radius Sign
* XYPLANE is set as 0, 1 and 2 for XY, ZX and ZY respectively
* Check accuracy of centre point
* <* 1/2CHORD = [#CHORD=0] Rad [#RADIUS=0]>
* Force IJK if calculated centre out of position
* <****** RADIUS AXIS CENTRE ERROR [#XCENTREERROR=0] - TRUE CENTRE [#TEMPXCEN
TRE=0] ROUNDED CENTRE [#XROUNDCENTRE=0]>
*<****** RADIUS AXIS CENTRE ERROR [#YCENTREERROR=1] - TRUE CENTRE [#TEMPYCENT
RE=1] ROUNDED CENTRE [#YROUNDCENTRE=1]>
***************************************************************************
*Set up parameters and call standard procedure to
*calculate angle bearings for TNC helical arc moves
* DEV00012570 undo previous change to correct thread mill regression

* Set arc parameter system variables


* Multiple turns
* Note that complete circle can have included angle of 0 or 360
* Thread Mill
* Note that multiple turn arc has only 0-360 included angle, derive from pitch a
nd Z move
* ZSTART ZEND are not available in thread milling
* Check for last helix full 360 degrees
* Round result of division
* Still needed for thread milling
*
************* NEED TO USE XINC.YINC IN ASIN_BEARING
*Double check for 360 case
* Full circle
*
*************************************************
*
Compensate feedrates for arcs if option selected
*
*************************************************
*
* #TMP=ABS(RADIUS):%IF #TMP=TOOLRAD @END
*
External Corners
* Following check safer in two lines because of precision checking
*
Internal Corners
*
Output all Hole cycles Drill, Chipbreak, Ream and Bore as Canned Cycles
- coords are held in the XYZPOINT array
* Called from each cycle macro and cyclsub for subroutines
*
Code Wizard will present the cycle definition line which will be in the
loop expand and thus output-if-changed
*
will, typically, produce the XY points list previously separated into PR
OCEDURE=LOOPEXPAND
* If called from CYCLSUB, points are expanded from 2nd point (Loop=2)- cycle l
ine is outside subroutine.
*
This inhibits the ability to support the format whereby the cycle parame
ters are variables e.g. Seimens
*
************ Diagnostic printout
************
* Status Flags in use
* Option flags in use
* #XREVERSE,#YREVERSE,#ZREVERSE Axis reversals
* $OUTPUTSUBS
* #ROTARYTYPE=2 1 for
* MILLMODE 0 for rotary, 1 for planar
* #TOOLCHANGE =1 if previous instruction was toolchange
* #PREPOSITION: 0 never
* Set wrap radius
* Keep move parameters
*
Rapid to first XY position then to Zclear with Tool Length Offset. Call
procedure for single Code Constructor
*
Could put this on a switch e.g. Call Rapid After toolchange ?
**
Necessary for rotary machining.
* Lift to clearance
* Approach to first point - Rapid in XY
********************************************************************
* Branch on $OUTPUTSUBS. =null if PATHTRACE expansion
* Set HOLD values for incremental calculations in subroutines
*Include first position in expansion
* Processing loop for cycle points
*<*
#LOOP =[#LOOP=23] LAST =[LAST=23]>
*<*
Xpoint =[#XMOVE=24]
#Ypoint =[#YMOVE=24]>:%CANCEL=#XMOVE,#YMOVE
*Check for Zdepth/level change and respecify cycle

*
*
*

Each cycle will use a different output line but needs to be here
to centralise loop expansion. Could
*
be in each macro but G81, G82 and G83 all use macro 9 and subrou
tines use same array.
*
Must present different Code Constructors for each cycle otherwis
e user will be confused - will have
*
to understand that some parameters are not used e.g. DWELL,DEPTH
+ ALL GCODETYPES i.e G81, G82 etc in one line etc.
*
*First point only
* <@LOOPEXPAND Last=[LAST=0] DSUB=[DRILLSUB=0] $OUTPUTSUBS=[$OUTPUTSUBS]>
*
Emulate return to Initial level : G98/G99 not supported
*
Cancel Canned Cycle
*
Rapid to clearance height
************************************************************
*
G80 Cancel Canned Cycle
*Cycle finishes at ZCLEAR
************************************************************
* #HOLECYCLE2 is now used to suppress sub call approach moves
* Set 0 if not using drill subroutines
* Blank null values - not required
* <Hold [STYPE=13]>
* Set absolute baseline positions for XSHIFT etc
*
Remove duplicate tools from NC Code tool list
* Initialise array for datum IDs
* <LOOP[#LOOP=1]>
* Loop to get SYSID from list and store in uarray in order
* <Loop [#LOOP=0]>
* <ID [SYSID=1] Stype= [STYPE=1]>
* <Pointer [#POINTER=1]>
* Unused array element
* <Pointer [#POINTER=1]>
* Option to output first Datum (G54) as XYZHOME location
* Initialise rotary setting at zero
* Reset to first datum position
* Set CPL offset for moves to Home and TC
* Absolute datum selected
* Next line removed to allow modality to interpret initialisation. DEV18171
* %CANCEL=#XMOVE,#YMOVE,#ZMOVE
* Incremental datum offset
* Save CPL ID
* <Loop [#LOOP=0] [#POINTER=1]>
* Datum not found
* $WARNING="ERROR - SYSID for CPL not found in Datum List":%CALL=CODECON_WARNING
* <WDM [WORKDATUMID=0]>
* Speed
*
* Rot1/Rot2 are not set from drill array
*
*
*
*
Calculate vector distance from current to next coordinate
* Use to determine if rapid move should be converted to feedrate move
*
*
XY distance
*
3D distance i.e. incorporate Z axis
*
If move is smaller than the specified amount then convert to a feedrate
at highfeed.

*
#TOOLSHEET
1=Output with Main NC program 2=Output as seperate fil
e
3=None
*******************************************************
* <EdgeCAM End Point [XMOVE=0][YMOVE=1][ZMOVE=2]>
* <#..KEEP End Point [#XKEEP=0][#YKEEP=1][#ZKEEP=2]>
*******************************************************
* Check 5 axis mode here and in PT_Rotary_Axes
* 5 Axis mode off
* 5 Axis mode on
* Set Precision
********************************************
* Check move content
* 5 axis only, assume all angles could be moving
* HOLD vars have unmodified EdgeCAM values
**********************************************
* Make incremental
* Set Move for XYZ
*******************************************************
*<#Move= [#MOVE=0]>
*******************************************************
* Procedure trace is ON. Additional trace options
* #TRTHREAD,#TRHOLE control array dumps in CY procedure
* #TRX,#TRY,#TRZ,#TRC1,#TRC2,#TRB temporary output vars
* Not Drill, ToolChange, Index or Thread Mill
* Output EdgeCAM End Points
* Output Current Mode Settings
* Do not adjust XY arcs, Z is unchanged from previous move
*
*
Determines the method of fixing arc centre
*
NOTE! Thread Milling uses %PROCEDURE=PT_THRD_ARC_CENTRE for simplicity
*
*
Setvar^#ARCTYPE
*
Signed Start to Centre 1
*
Signed Centre to start 2
*
Unsigned Start / Centre 3
*
Centre
4
*
* Setvar^#USERADS^Use Radius: 0 Never, 1 When Possible, 2 When Possible (XY), 3
Always
*
*
*********************
*
*
Thread Milling
*
*
*********************
*
*
* Full canned cycle
* <BC [#BEFORECYCLE=0]>
* Preposition after toolchange
* Next Z for first move
* Set canned cycle variables
*
* <Vertical Move>
* %IF #ZMOVE<#ZHOLD %THEN <PLUNGE> %ELSE <LIFT>
* #BEFORECYCLE=0
* <Not PL>
* %IF USERVAR8=1 @NOBLOCK
* <Rapid XY>
* <Feed Move XY>

*
*
* Are all helical blocks required
* Output leads & one main helical block only, Find last main helix block
* ZMOVE = Total Movement, KVALUE = Lead
* Suppress first main helix, uless it is also the last
* Canned Cycles only
* <Not First>
* <Next [#NEXTTYPE=1]>
* Only 1 helix
* #THRDLEAD=#KVALSAVE
* Helix inaccurate for Taper thread
*
* Extract canned cycle parameters
* Cutting upwards
* Cutting Down
* <INOUT #PLUNGERAD=[#PLUNGERAD=0] #STARTRAD=[#STARTRAD=0]>
*
* Canned cycle output
* Count arc blocks skipped
*Suppress intermediate helical blocks if instructed. Maintain #ZHOLD
*Set K word to full circle pitch for multi-pass block
* reset helical block count
*
Handle Arc centre for Thread milling - force I&J output
*
Setvar^#ARCTYPE
*
Signed Start to Centre 1
*
Signed Centre to start 2
*
Unsigned Start / Centre 3
*
Centre
4
* Setvar^#USERADS^Use Radius: 0 Never, 1 When Possible, 2 When Possible (XY), 3
Always
* IJK method of arc output
*
* This procedure is called when an unknown move type is detected and
* the record is skipped.
* #RECORD=XPOINT(#LOOP)
*
*
*******************
*
Block No. Increment
*
*******************
*
*
* Check top limit, reset if exceeded
*
*
*
************************
******
*
Safe Start Block No. Inc
rement
*
************************
******
*
*
Output Block Number same as Tool Number (POSITION)
*
*
************************
********
*
Set Tool
ing data
*
************************

********
*
*
*
*
*************************************
*
Subrouti
ne Start / Header
*
************************
*************
*
* Note #incrxyz is current abs/inc setting
*
#incrxyzhold is main program setting
*
#incrsubs is subroutine setting
*
If Increment Subroutines by ... is not set then start at Progid & increm
ent by one else use the increment.
* Force feedrate if required
*Reset HOLD values for incremental first move
*
If using incremental subroutines only, it is necessary to hardcode a G91
on extra Sequence definition line
* Force GCode on next move
* Default holecycle flag to zero
*
*
*
********************************
*
Subrouti
ne Call
*
************************
********
*
*
If Increment Subroutines by ... is not set then start at Progid & increm
ent by one else use the increment.
*Check for hole cyclesub, retrieve stored value
*Output approach move for first call, not translated calls
* Force output if coordinate has changed
* Found to be necessary for some templates, inculding S840
* Inserted move, only for incremental subroutines
*
*
*
********************************
*
Subrouti
ne End
*
************************
********
*
*
If Increment Subroutines by ... is not set then start at Progid & increm
ent by one else use the increment.
*
If using incremental subroutines only, it is necessary to hardcode a G90
on extra Sequence definition line
* Store HOLECYCLE2 flag for this subroutine
*
*
*
Procedure only applicable to Rotary Table configurations.
*
Must be in Procmill.cgi since called from within Set Work Datums
*
*************************************************************
*
Purpose :
To set number of moves in Lead out sequence
*
*
Called :
when processing a Feed or Arc move which is
*
*
the first move of the Lead out sequence
*
*
Subfunct=2

*
*
*
*************************************************************
**************************************
*
Lead Out permutations
**************************************
*
*
* Check FIELD12 lies in range 1-3
*************************************************
*
Necessary for Rotary Machining only
*
*************************************************
*
* This procedure is called when EdgeCAM outputs a rotary canned cycle with singl
e linear
* axis moves and rotary axis angles in an array. In the loop, XPOINT is used for
the linear move,
* whether it is X or Y, and YPOINT is always used for the rotary angle.
*
* The procedure sorts out the actual #XMOVE #YMOVE and #ROT values for output fo
r both RADIAL
* and AXIAL orientations.
*
* Note that one linear axis, X or Y, is always set to zero. In AXIAL orientation
the other linear
* move is then calculated as total offset from axis of rotation.
* Axial Orientation
*
Calculate Angle of Point location
*
Set active axis, cater for Caxis configuration.
*Set Y coord on axis
*
Axis reversal etc
* Hold See procedure=hold
* %IF $ACTIVEROTAXIS=$ROT1 %THEN #ROT1HOLD=#ROT %ELSE #ROT2HOLD=#ROT
*<radial>
*
Processes Radial Drilling cycles
*
*
Xpoint = X or Y co-ordinate depending on machine rotary axes.
*
Ypoint = angle around which the drilling occurrs.
*
*
If 4axis m/c then active rotary axis is #ROT1, if 5axis then is #ROT2
*Set Y coord on axis
*
Assign Linear and rotary axes
*
Axis reversal etc
* Hold See procedure=hold
* %IF $ACTIVEROTAXIS=$ROT1 %THEN #ROT1HOLD=YPOINT(#LOOP) %ELSE #ROT2HOLD=YPOINT
(#LOOP):#ROT1HOLD=ROT1
* <Type [$CYCLETYPE]>
*
Call CYCL DEF for each cycle type
*
*
Load next hole position to determine
*
If Multi level output M99, if constant output M98
*
If M99 rapid to Clearance, move to next hole, Zrplane M99
*
If next Zlevel is different then select M99 (non modal) else select M89
(modal)
* Check Multi-depth for TNC426
*
* Modified for adaptive templates to have a procedure for first leg
* and a second procedure called by a token for the second leg
*

*
Handles Rapid to Home strategies e.g. Xfirst, Zfirst
*
No automation depending on tool type i.e. User must program Xfirst
*
* Axis Fixed
* FIELD 1 = 1 = X FIXED (remain at current location
)
* FIELD 3 = 1 = Z FIXED (
"
"
"
)
*
* Axis Priority
* FIELD 4 = 0 = None
*
1 = XFIRST
*
2 = YFIRST
*
3 = ZFIRST
* Fixed coords
*
* Angular position is inherited - do not process again
* %CALL=PT_ROTARY_AXES
* Called via token to create second leg of move
*
* Calculates number of pecks/chipbreaks in cycle
* Called from Token
* Nothing specified, use defaults
* Check speed
* Get machine maximum speed from highest gear
* Check speed in range for spindle
* Get details for first gear
* Check speed in range for spindle
*Reset to current gear
* <NUMGEARS [NUMGEARS=0] GEARMINRPM [GEARMINRPM=0]>
*
Warn if Gear Range selected greater than defined in Spindle Tab
* Check speed in range for gear
* GEARMAXRPM,GEARMINRPM limits for this gear on this spindle
* Called by Attribute macro to reverse spindle when longhand tapping
* Called by token to calculate clearance value
**************************************************************************
* Machine independant Code Generator include file
*
* Filename: mill-procedures-rotary
*
Author:
RHA
* Date:
11 November 2005
*
* New file for adaptive milling templates derived from earlier multiplane templa
te
*
**************************************************************************
* Change History
* Version 10.5
*
FIRST ISSUE
* 23/01/06 RHA DEV00016067 Correct angle output modality in PT_ROTARY_AXES
* 08/02/06 RHA DEV00016222 Make 360 to 0 angle reset optional
* 14/02/06 RHA DEV00016310 Axis sign reversal not working***********************
***************************************************
* 20/02/06 RHA DEV00016344 Implement IJK vector for 5 axis cycle
* 24/02/06 RHA DEV00016422 4 Axis fails to compile
* 14/03/06 RHA DEV00014577 Correct blanking of angles (sign=direction)
* 22/03/06 RHA DEV00016723 Fix angle processing in line with EdgeCAM signed angl
es
*
New PT_WHICH_WAY procedure
* 24/03/06 RHA DEV00016743 Datum shift output for index in incremental mode.
* 27/03/06 RHA DEV00016723 Set 0-360 for sign=direction when indexing table
* 16/05/06 RHA DEV00017213 Correct index handling for no rotation cases

* 18/05/06 RHA DEV00017213 Fine tune


* Version 11.0
* 11/07/06 RHA DEV00017691 Correct use of angle reversal flags
* 25/07/06 RHA DEV00016799 Initialise tool position at toolchange and index
* 13/09/06 RHA DEV00018171 Correct initialisation of tool position after datum s
hift
* Version 11.5
* 25/09/06 RHA DEV00017909 Expand trace options
* 24/11/06 RHA DEV00017338 Move CPLNAME to a template variable
* Version 11.75
* 19/03/07 RHA DEV00019554 Correct precision of XCP YCPL ZCPL in use
* 11/05/07 RHA DEV00019987 Allow for axis assignment for negative rot1 angle
* 21/05/07 RHA DEV00020096 Implement Maintain Index Option at ToolChange
* 24/05/07 RHA DEV00019981 Orthogonal plane cycle controls
* 01/06/07 RHA DEV00020208 Fix Index after TC (Head Head)
* Version 12.00
* 26/07/07 RHA DEV00020560 Make +-180 setting more robust, allow for wind up.
* Version 12.50
* 04/02/08 RHA DEV00006310 Allow canned cycles in Rotary Rotate
* 19/03/08 RHA DEV00022891 Allow concecutive coincident indexes to CPL
* Version 2009.01
* 22/04/08 RHA DEV00022820 Protect PT_WHICH_WAY from #FUNNY hold values
*****************************
*
Rotary Procedures
*
*****************************
* #ROTVALS controls use of ROT1/ROT2 values for rotary positioning
* #ROTVALS=#FALSE
* %IF $PLANAR=NO %THEN #ROTVALS=#TRUE
* Check for incremental
*Set For incremental in rotary
* Reset incremental
*
*
Purpose :
Process Radial Arc moves
*
*
Called from Macros ANGCLW and ANGCCLW
*
*
If Clockwise process via Clockwise Code Constructor otherwise via the Co
unterClockwise Code Constructor.
*
Purpose :
To determine whether Orientation is Axial or Radial
*
*
Called from Index when Rotation has occurred
*
*
Purpose :
To determine whether X or Y is the Linear axis
*
*
Used when assigning XYPOINT() for Drilling : See %Procedure=Pt_Convert_C
oords *
* Save CPL ID
* Set absolute values
*Set rotation variables
* %IF #MACRO=38 %THEN #ROT2=ROT2+ANGLE
* Set CPL offset for moves to Home and TC
* Initialise tool position
*Check for datum reset only
* Only datum shift, angles unchanged
* No rotation
* Rotary moves
*****************************************************************
* Trap null moves with differing direction sign DB10885/11016
******************************************************************
*

* Incremental datum
*Set ROT Hold values
* Output initial position after TC and Index only
*************************************************
*
PT_ROTARY_AXES
*************************************************
*************************************************
* Five axis movement control
* 5 Axis mode off
* 5 Axis mode on
* Set IJK if needed
* IJK instead of angles
*************************************************
*PRIMARY AXIS
* If Sign=direction set 0-360 range for INDEX only
* Apply angular offsets
* Set Increment
* Note that #ROT-HOLD vars are set from ROT1 ROT2 not #ROT1 #ROT2
* Reverse direction of 0 -> 360 if required
* Reset Primary within 0-360 again
* Reset primary within range +/-180
* Accommodate -0 by setting zero angle to 0.0000001 and calculating sign
* This will truncate to 0 on output with correct +/- sign
* Note that #ROT-HOLD vars are set from ROT1 ROT2 not #ROT1 #ROT2
* Incremental - Check null move
* User reverse if wanted
*************************************************
*
PT_WHICH_WAY
*************************************************
* Protect against #FUNNY
* Set directions of rotation
* Angular Moves - based on angles received
* Indexing
* Shortest, based on end position
* Controlling direction - first rotary
*
Asssign Mcode for direction of rotation
* Sign = direction
* Controlling direction - second rotary
*
Asssign Mcode for direction of rotation
* Sign = direction
********************************************************************************
**********
*
PT_WRAP_RADIUS
********************************************************************************
**********
*
Purpose :
Output Wrap Radius for M/cs such as Bostomatic
*
Called from all machining macros when rotary first initialised
* NB Fadal is different, see CODECON_WRAP_HEIGHT
********************************************************************************
**********
*
PT_INDEX_CONTROL
********************************************************************************
**********
*Call Head First
* Now Call Table
*************************************************
*
Head angle settings**
*************************************************
* Procedure to set head angles. To be developed as required
* Procedure to set head angles. To be developed as required

********************************************************************************
**********
*
PT_CUBIC
********************************************************************************
**********
* Set TNC Tool Alignment, called from TOOL CALL code constructor

Anda mungkin juga menyukai