Zoals gezegd gaat de Z as niet terug naar de (machine) 0 positie na het inmeten. De macro voor het inmeten eindigt met
Code: Selecteer alles
G90 G53 Z0.0 F#5003;
Ik heb geprobeerd de macro aan te passen/aan te vullen met
Code: Selecteer alles
G91 G28 Z0.0;
G90;
Dit is de originele macro: (het sukje staat op zo'n driekwart van de code, ik weet niet hoe ik de block nummers mee kan exporteren, sorry!)
Heeft iemand een idee?
Code: Selecteer alles
%@MACRO
//==================Variable description��============================
// H -> #11---4048 base mark
// #35 ---> Current execution of tool calibration
// #8 Allowable error between first and second detection
// #9 ---->#5003 First measured speed
// #6 ---->#5004 Second measurement speed
// #39 The distance between the starting point and the lowest point
// #40 Record the coordinate value measured for the second time
// #41 Record the coordinate value measured for the third time
// #42 First retreat distance
// #43 The distance between the second and third retreat
// #5001 Floating tool setter thickness
// #5004 Measured second segment speed and third segment speed��������
// #5002 Maximum error unit BLU allowed for tool setting
// #5010 0 means floating tool setting, 1 means fixed tool setting
//===================standardization=============================
//=================Enter numerical value to judge=========================
//===================initial conditions==========================
#27:=#1000;
#28:=#1004;
#29:=#1504;
#6:=#5004; //The second and third speeds are defaulted to 50
#8:=#5002; //The allowable error is 10BLU by default
#42:=2.; //first retreat distance
#43:=1.5; //The second and third retreat distance
#9:=#5003;
#39:=STD(#5005,#1600)-STD(#5008,#1600); //The distance between the starting point and the lowest point
#38 := PARAM(3241);
//===================��ʼ����============================
G40;
G49;
#1504:=2;
WAIT();
//M404;
G53;
G91 G28 Z0; //The Z axis returns to the mechanical origin with G28
IF(#5010=1)THEN
G90 G53 X#5006 Y#5007; //XY axis reaches the second reference point at G00 speed
END_IF;
G04P100;
WAIT();
G91 G31 Z#5005 F7000; //The Z axis reaches the Z axis starting point at a speed of 7000
WAIT();
IF (#1608 =1 AND #1506 =0 ) THEN
ALARM(333);
END_IF;
G91 G31 Z-#39 F#5003; //First segment speed detection
WAIT();
IF (#1608 =1 OR #1506 = 1) THEN
#44:=#1323;
ELSE
ALARM(330);
END_IF;
G91 G01 Z#42 F#5003; //Z-axis retreat #42 distance
M401;
G91 G31 Z-(#42+1.) F#5004; //Second stage speed detection
WAIT();
IF (#1608 = 1 OR #1506 = 1) THEN
#40:= @10743; //Record the coordinate value measured for the second time
ELSE
ALARM(331); //Not detected, send ALARM
END_IF;
G91 G01 Z#43 F#9; //Z-axis retreat #43 distance
M400;
G91 G31 Z-(#43+1.) F#6; //Third stage speed detection
WAIT();
IF (#1608 = 1 OR #1506=1) THEN
#41:= @10743; //Record the coordinate value measured for the third time
ELSE
ALARM(331); //Not detected, send ALARM
END_IF;
IF (ABS(#40-#41) > #8 AND #1506 = 0) THEN //If the error between the second and third measurements is greater than the input condition
ALARM(332);
ELSE
@11032:=(#40+#41)/2;
G90 G53 Z0 F#5003; //Return to the starting point in the Z direction
END_IF;
// When parameter 3241 is set to 1, under different precisions and metric/imperial systems
// Adjust its value so that the correct value can be filled in when G10 is filled in
IF( #38 = 1 AND #1010 = 71 ) THEN
CASE #37 OF
1:
#52 := @11032 / 100.;
2:
#52 := @11032 / 1000.;
3:
#52 := @11032 / 10000.;
END_CASE;
ELSEIF( #38 = 1 AND #1010 = 70 ) THEN
CASE #37 OF
1:
#52 := @11032 / 1000.;
2:
#52 := @11032 / 10000.;
3:
#52 := @11032 / 100000.;
END_CASE;
ELSE
#52 = @11032;
END_IF;
IF (#16 <> #0) THEN
#16:=ROUND(#16);
G90 G10 L2 P#16 Z#52;
ELSE
#20:=ROUND(@502);
G90 G10 L10 P#20 R#52; //Store signal points in the compensation table for tool length geometric compensation
END_IF;
WAIT();
#1504:=#29;
G#27 G#28;
M99;