Having trouble correctly writing a touch subprogram

More
28 Dec 2018 18:10 #123024 by 3D-Master
Hello,

i wrote a subprogram, which i call using a PYVCP button. This program is supposed to touch off in one direction and whatever the distance from the active coordinate system to the point is (minus touch probe diameter) has to be reduced by half, so i can touch off one side for example x0 and then go to the other side, touch off in the other direction and then calculate, so that the active coordinate system is exactly in the middle of the part. When i simulate what i want to do it is always 5mm (left side is 62.4 and the right side is 72.4 from zero) from the middle (the touch probe stylus has a diameter of 20mm but only to clearly show the effects, when i change something in the program).

the Program (you are allowed to use it if you want but i am not liable if something goes wrong):

o<haelfte_x-> sub
M66 E5 L0
#7 = 5399

G21 G43
M5 M9
M19 R180
M66 P11 L3 Q10
G28.1
#<x> = #5161
G91 G38.2 F#<_ini[FEED]TOUCHPROBE_RAPID> X-#7 M50 P0
G91 G0 X+2
G91 G38.2 F#<_ini[FEED]TOUCHPROBE_SEARCH> X-3
#4061 = [#5061/2]
#4410 = [#5410/2]
G10 L20 P#5220 X+[#4061+#4410]
G53 G90 G0 X#<x> M50
M5
o<haelfte_x-> endsub

i have changed so much in this program but this is the most "accurate" i have been able to archieve

Please Log in or Create an account to join the conversation.

More
28 Dec 2018 18:48 - 28 Dec 2018 18:49 #123030 by 3D-Master
when i change

o<haelfte_x-> sub
M66 E5 L0
#7 = 5399

G21 G43
M5 M9
M19 R180
M66 P11 L3 Q10
G28.1
#<x> = #5161
G91 G38.2 F#<_ini[FEED]TOUCHPROBE_RAPID> X-#7 M50 P0
G91 G0 X+2
G91 G38.2 F#<_ini[FEED]TOUCHPROBE_SEARCH> X-3
#4061 = [#5061/2]
#4410 = [#5410/2]
G10 L20 P#5220 X+[#4061+#4410]
G53 G90 G0 X#<x> M50
M5
o<haelfte_x-> endsub

to

o<haelfte_x-> sub
M66 E5 L0
#7 = 5399

G21 G43
M5 M9
M19 R180
M66 P11 L3 Q10
G28.1
#<x> = #5161
G91 G38.2 F#<_ini[FEED]TOUCHPROBE_RAPID> X-#7 M50 P0
G91 G0 X+2
G91 G38.2 F#<_ini[FEED]TOUCHPROBE_SEARCH> X-3
#4061 = [#5061/2]
#4410 = [#5410/4]
G10 L20 P#5220 X+[#4061+#4410]
G53 G90 G0 X#<x> M50
M5
o<haelfte_x-> endsub

then it works but that doesnt make sense to me, can somebody explain this to me?

thanks
Last edit: 28 Dec 2018 18:49 by 3D-Master.

Please Log in or Create an account to join the conversation.

More
28 Dec 2018 20:33 #123035 by Todd Zuercher
Because you are calculating (#5061+#5410/2)/2 which is the equivalent of #5061/2+#5410/4

Please Log in or Create an account to join the conversation.

More
29 Dec 2018 02:32 - 29 Dec 2018 15:12 #123044 by MaHa
If you want to find center, like webcent, bore center etc, it is not necessary to use tooldiameter in the calculation, It`s only extra work. It is needed for 1 point and general measurement, then you also need a calibration, containing the distance from touch to trigger. Make shure do spindleorientation towards meas direction, triping the probe always the same way, getting accurate results. Then it`s easy to find the offset: [Result1 + Result2] / 2
Last edit: 29 Dec 2018 15:12 by MaHa.

Please Log in or Create an account to join the conversation.

More
29 Dec 2018 19:08 #123111 by 3D-Master
for this program, i need the Tool diameter because the coordinate system is already on one side of the part. If i would not use it, the coordinate system would always be half the diameter eccentricial/out of the middle of the part. i am able to position the spindle at specific directions (Spindle orient). I am going to write some programs to work like/similar to Heidenhain touch cycles.

Please Log in or Create an account to join the conversation.

More
30 Dec 2018 02:32 - 30 Dec 2018 04:44 #123125 by MaHa
If i understand, you measure 1 point, distance to side with coordinate system. Depending on measure direction, to get
width, subtract or add toolradius first, then divide by 2, to get center.
Last edit: 30 Dec 2018 04:44 by MaHa. Reason: added width

Please Log in or Create an account to join the conversation.

Time to create page: 0.093 seconds
Powered by Kunena Forum