Explained in three points:
1. Program the exploration points************
2. Edit the processing program *********
Third, add macro variables********** in EXCEL
The first section compiles the exploration program
1. Set the origin and find the coordinate values of each probe point.
First set the origin of the workpiece coordinate system in the UG software, and then use the UG software to find the points (X Y Z) where the probe points are needed and record them for programming the probe points.
2. Program the exploration points
(The name of the exploration program is determined by yourself: O6666)
To control the movement of the probe in the probe point program, two important probe calculation programs O9810 need to be called.
and O9811. Exploration point program format example: (The following is an example of compiling Exploration Z point)
%
O6666(PROBE)
G91G28Z0
G90 G0 G17 G40G49 G69 G80
M6T11 (the probe is installed on the T11 tool holder, replace the T11 probe with the spindle)
G90G00 G54 X-18. Y50. (Quickly position above the first point to be probed in the G54 coordinate system)
M19(S_) (Spindle positioning, S is to rotate the spindle at an angle. If it is to probe a point in the Z-axis direction, S is not needed. If it is to probe the side, S is required, that is, the angle of rotation, so that the probe can detect each side. They are all measured using one surface of the ruby ball probe to reduce errors.
M05
M17 (open probe) (Open the probe, this command is determined by the corresponding port received during wiring)
G43Z50.H11 (Establish the tool length, that is, read the length of the probe)
G90G00Z50. (The probe quickly moves down to the Z50. position)
N1(Z+POINT1) (measure the Z value of the first point)
G65P9810X-18. Y50. F3000. (Safely and quickly position to the XY position of the first point, the speed is F3000.)
G65P9810 Z19. (Safely and quickly position to the safe Z position above the first point, the speed is the same as above, the height here is generally 3MM from the point to be measured below)
G65P9811Z16.08 (reach the Z position of the first probe point safely and slowly. In addition, after completing the probe point in this step, it will automatically return to the Z19.0 position in the previous step)
#601=#142 (#142 is the difference between the theoretical Z16.08 of the first probe point and the actually measured "Z". It is automatically calculated in O9811 and then passed to #142. #142 then The obtained value is passed to #601, which is the value to be compensated in the Z direction of the first point)
G65P9810 Z20. (safely and quickly move to the safe height Z20.)
N2(Z+POINT1) (measure the Z value of the second point)
G65P9810X-16.5 Y48.3 F3000. (Safely and quickly position to the XY position of the second point, the speed is F3000.)
G65P9810 Z17. (Safely and quickly position to the safe Z position above the second point, the speed is the same as above, the height here is generally 3MM from the point to be measured below)
G65P9811Z14.23 (reach the Z position of the second probe point safely and slowly. In addition, after completing the probe point in this step, it will automatically return to the Z19.0 position in the previous step)
#602=#142 #142 is the difference between the theoretical Z16.08 of the second probe point and the actual "Z". It is automatically calculated in O9811 and then passed to #142, which then calculates the result The value is passed to #601, #601 is the value to be compensated in the Z direction of the second point)
G65P9810 Z35. Safely and quickly move to the safe height Z20.)
N3(Z+POINT1) (measure the Z value of the third point)
G65P9810X12.5 Y51.1 F3000.
G65P9810 Z19.
G65P9811Z16.08
#603=#142
G65P9810 Z20.
N4(Z+POINT1) (Measure the Z value of the fourth point)
G65P9810X12.2 Y49.2 F3000.
G65P9810 Z16.
G65P9811Z13.73
#604=#142
G65P9810 Z35.
.....
.....
.....
N16(Z+POINT1) (Measure the Z value of the sixteenth point)
G65P9810X-16.5 Y-18.2 F3000.
G65P9810 Z16.
G65P9811Z14.23
#616=#142
G65P9810 Z35.
(The following is to set the tolerance range for the difference Z of each detected point. If the tolerance is exceeded, it will jump to N20 for execution)
#620=0.1 (Set the tolerance to 0.1 and assign it to #620)
IF[ABS[#601]GT#620]GOTO20 (If the absolute value of #601 is greater than the value of #620, it will jump to N20 for execution)
IF[ABS[#602]GT#620]GOTO20 (If the absolute value of #602 is greater than the value of #620, it will jump to N20 for execution)
IF[ABS[#603]GT#620]GOTO20 (If the absolute value of #603 is greater than the value of #620, it will jump to N20 for execution)
.....
.....
.....
M18
G91G28Z0
M99
N20 #3000=99point cuo wu Z OUT OF TOL (alarm prompt, Z is out of tolerance, here "#3000=" you can set additional prompt information of 0-200 for yourself)
G91G28Z0
M99
****************
Section 2 Editing Processing Program
Add the compensation value variable (#601#602 #603...) corresponding to each probe point to the coordinates of the corresponding point in the processing program. (Here we use the Z value to explain. The principle of compensating the X and Y directions is the same as compensating the Z direction.): (That is, two points are directly connected, each with a Z value)
From point A to point B, the compensation differences of probe points A and B are #601 and #602 respectively. If you want the tool to make a general transition from A to B, you only need to add the Z compensation value variables of points A and B to the corresponding machining program.
The following is the processing procedure: (taking the compensation Z value as an example)
picture
O2222
G91G28Z0
G0G17G40G49G80G90
(TOOL:1 DIA.OFF: 1 LEN:1 DIA:10.)
T1M6
G0G90G54X7.2503Y10.S10000M3
G43H1Z30.M8
Z1.
picture
Section 3: Quickly edit processing programs in EXCEL
Sometimes it is necessary to add variables to N multi-line programs. If you add them one by one manually, it will be very difficult.
Troublesome, heavy workload, and error-prone. Here is a way to use EXCEL to quickly edit programs.
picture
How to change:
1. First copy the program to which variables are to be added into Notepad, as shown below:
picture
2. Replace X with "/X/", replace Y with "/Y/", and replace Z with "/Z/", as shown in the figure:
picture
3. Open EXCEL and open the file in step 2. Note that in the open dialog box, select the file type as
"All files", then open the file in the previous step, and a dialog box will appear as shown below:
picture
4. Click Next and the next dialog box will appear, as shown below:
picture
5. Check "Other (0)" and enter a slash "/", as shown in the figure:
picture
6. Then, select "Next" and "Finish" to open the file. You can see that each part is separated.
What you want is this effect, as shown in the picture:
picture
7. Add Z and the number 16.31 to each line of the program, as shown in the figure
picture
8. Manually add variables to the starting point and end point. Since the point in the first line is the starting point, the variables should be detected accordingly.
Compensation value #601, the 14th line in the above picture is the end point, the variable should be the corresponding detected compensation value #602
The variables in the above two points can be added manually, as shown in the figure:
picture
9. To add variables at the middle point, you need to add the variables shown in Figure A above. The method is to first move the square brackets and plus signs to each line in the middle, and then enter the variables to be added at the middle point as shown in the third line of the picture above. Variables such as #690*1
(Here, the difference between the compensation values of the end point and the starting point is evenly distributed to N intermediate points. This is divided into 12 segments. The relationship is #690=[#602-#601] / 12. This relationship requires add it to the program)
Then first hit "#690*1" and pull it down to achieve it, as shown below:
picture
Then save EXCEL as a text txt file, and then open it with Notepad, as shown below:
picture
Delete the empty distance in the middle and add its corresponding macro variable relationship #690=[#602-3602]/12 in front of the starting point as shown below:
picture





