Return Mazak Z Axis to Home 2 without using G30
Macro to Automatically Set Tool Lengths with a Tool Eye
Timing Tools on a Mazak Mill
Changing Tool and Fixture Offsets from English to Metric
Changing Tool and Fixture Offsets from Metric to English
Automatically updating Work Offsets


Return Mazak Z Axis to Home 2 without using G30 (11/24/97)
This code will return the head of a Mazak mill to the home 2 position without using G30.  This can be very useful during probing. Modify the line #592=#5223+[#591-.0315] to fit the particular machine.  In this example, the head is at home 2 (G30) when the Z machine position is -.0315.   This example works in the G54 coordinate system.  If you are using a different coordinate system change #5223 to the appropriate value.  For example, G55 would use #5243, G56 #5263, G57 #5283, G58 #5303 and G59 #5323.

(POSITION HEAD TO HOME 2)
#590=#5223
#591=#[60000+#549]
#592=#5223+[#591-.0315]
G65P9810Z-#592F100.

Return to Top of Page

 


Macro to Automatically Set Tool Lengths on a Mazak Mill (12/7/97)
This simple macro automates setting tools on a Mazak mill with a tool eye.  The operator enters the starting tool number to be set in #537 and the ending tool number in #538.   You could change #537 and #538 to a variable for a tool number if that would be more convenient.  See Not Enough Common Variables for details on how to use tool numbers for variables.  For example, change #537 to #2064 to use tool offset 64 instead of macro variable 537.

You will need to edit the line IF[#537GT29]GOTO100 to equal the number of tools in your machine's tool changer.  This machine had a 30 station tool changer but station 30 is dedicated to a Renishaw probe.

%
O9103
(SET TOOL LENGTHS)
(#537=STARTING TOOL NUMBER)
(#538=ENDING TOOL NUMBER)
G0G91G30Z0
G0G91G30Y0
IF[#537GT#538]GOTO101
IF[#537GT29]GOTO100
IF[#538GT29]GOTO100
WHILE[#537LE#538]DO1
T#0T#537M6
T#537T0M6
M196
T#537
M197
G0G91G30Z0
G0G91G30Y0
#537=#537+1
END1
GOTO102
N100#3000=1(#537 IS TOO LARGE)
N101#3000=1(#537 GREATER THAN 538)
N102 G0G91G30Z0
G0G91G30Y0
M30
%

Return to Top of Page

 


Timing Tools on a Mazak (12/23/97)
Have you ever wanted to compare the time your CAM system says a tool will take to the actual time it takes on the machine?  Don't stand around with a stop watch, this simple macro will do it automatically.   At the beginning of the tool you want to time add #3001=0 to reset the machine's timer to 0.  Then add M98P9100 to the end of the tool.  The macro will put the time for the tool in variable 510 plus the tool number.  For example, the time for tool 1 will be stored in #511.  This macro is useful if you embed it into your CAM system's post processor and output it as part of the CNC program.

%
O9100         
#2=#51999(ACTIVE TOOL)
#100=#3001(TIMER VALUE)
#100=#100/1000
#[510+#2]=#100(WRITE TIME)
M99
%

Return to Top of Page

 


Changing Tool and Fixture Offsets from English to Metric
Submitted by Kevin Bond (6/5/98)
kevinb@bond.net

Have you ever wanted to run a job in Metric mode but decided not to because of the effort needed to reset all the tool offsets and work offsets from English?   Well this is a perfect application for Custom Macro.  This example converts both the tool offsets and the work offsets from English to Metric:

%
O9121(INCH TO METRIC)
G91G28Z0
G28X0Y0
G21
#100=1
WHILE[#100LE99]DO1(PLACE NUMBER OF OFFSETS HERE)
#[2000+#100]=#[2000+#100]*2.54
#100=#100+1
END1
#100=1
WHILE[#100LE6]DO1
#[2500+#100]=#[2500+#100]*2.54
#[2600+#100]=#[2600+#100]*2.54
#[2700+#100]=#[2700+#100]*2.54
#100=#100+1
END1
M30
%

Return to Top of Page

 


Changing Tool and Fixture Offsets from Metric to English
Submitted by Kevin Bond (6/5/98)
kevinb@bond.net

Have you ever wanted to run a job in English mode but decided not to because of the effort needed to reset all the tool offsets and work offsets from Metric?   Well this is a perfect application for Custom Macro.  This example converts both the tool offsets and the work offsets from Metric to English:

%
O9120(METRIC TO INCH)
G91G28Z0
G28X0Y0
G20
#100=1
WHILE[#100LE99]DO1(PLACE NUMBER OF TOOL OFFSETS HERE)
#[2000+#100]=#[2000+#100]/2.54
#100=#100+1
END1
#100=1
WHILE[#100LE6]DO1
#[2500+#100]=#[2500+#100]/2.54
#[2600+#100]=#[2700+#100]/2.54
#[2700+#100]=#[2700+#100]/2.54
#100=#100+1
END1
M30
%

Return to Top of Page

 


Automatically updating Work Offsets
Submitted by Kevin Bond (6/5/98)
kevinb@bond.net

This program automatically updates the current coordinate system's work offsets.  The program takes into account the current mirror image state.  The program is written for the OM control because #3005 is used to determine the mirror image state.  It can be modified for other controls by changing #3005 to #3007 and updating the IF statements.

%
O9011(SET WORK OFFSET)
#3003=1
(***FIND ACTIVE OFFSET***)
#101=#4014-53
(***FIND MIRROR IMAGE STATUS***)
#100=#3005
N5IF[[#100-1024]LT0]GOTO10
#100=#100-1024
N10IF[[#100-512]LT0]GOTO20
#100=#100-512
N20IF[[#100-128]LT0]GOTO30
#100=#100-128
N30IF[[#100-64]LT0]GOTO40
#100=#100-64
N40IF[[#100-16]LT0]GOTO50
#100=#100-16
N50IF[[#100-8]LT0]GOTO60
#100=#100-8
N60IF[[#100-4]LT0]GOTO70
#100=#100-4
N70
(***SET COORDINATE FOR EACH MIRROR IMAGE***)
IF[#100EQ0]GOTO100
IF[#100EQ1]GOTO200
IF[#100EQ2]GOTO300
#[2500+#101]=-#5021
#[2600+#101]=-#5022
GOTO1000
N100
#[2500+#101]=#5021
#[2600+#101]=#5022
GOTO1000
N200
#[2500+#101]=-#5021
#[2600+#101]=#5022
GOTO1000
N300
#[2500+#101]=#5021
#[2600+#101]=-#5022
N1000#3003=0
M30
%

Return to Top of Page

Hit Counter