Auto Tool Measurement with different Positions

23 Apr 2017 08:00 #91873 by MatthiasF1210

I am using the auto tool measurement feature and it works great. It simplyfies the machining process quiet a lot.

But I still have 2 points which I could not figure out how to handle.

1. Tool with a huge differenc in diameter.
My tool sensor has a contact diameter of 40mm. My largest mill has a diameter of 100mm. If I use the same sensor position in the INI file, the big tool is not measuring correctly. Is there a way to automaticly take the tool diameter in to account? For Example add the tool radius as an offset to the probe position?

2. Tool offset in Z-Axis
When I use a champfer mill, the cooect working height is no nessecarry the tool tip. Usally I would work with an offset of 1-2mm for theese tools. Is there a way to apply such an offset?

I hope some of you have had the same thought in the past. Any Ideas how to handle this?


24 Apr 2017 07:19 #91937 by newbynobi
Hallo Matthias,

both is possible.
You will need to adapt change.ngc to fit your needs.

You get the tool diameter from halui.tool.diameter
and the Offset can be added also with a small calculation in that file.

24 Apr 2017 07:52 #91938 by newbynobi
Or from gmoccapy 2.3.1 use the gmoccapy hal pin I just introduced


25 Apr 2017 16:20 #92071 by andypugh
25 Apr 2017 19:22 #92099 by MatthiasF1210

thank you so far, I will try out something and will report my results...
Hopefully I will find some time this weekend!

26 Apr 2017 10:43 #92127 by tommy
Is there a way to prompt operator to enter parameter #5410? The idea is to let operator enter tool diameter during (manual) tool change when machine waits operator to change tool.
26 Apr 2017 11:23 #92131 by newbynobi
Not from gmoccapy side, but if you use remap, you can add that there, most probably a python remap is the best way to do so.

07 May 2017 09:13 #92766 by MatthiasF1210
Hello again,

I had a little time to play around with the change.ngc and finally got a very nice result. It moves the tool in direction south-east by the radius of the cutter.

The code with some documentation, maybe it helps someone else
o<change> sub
;(debug, in change tool_in_spindle=#<tool_in_spindle> current_pocket=#<current_pocket>)
;(debug, selected_tool=#<selected_tool> selected_pocket=#<selected_pocket>)

;otherwise after the M6 this information is gone!
#<tool> = #<selected_tool>
#<pocket> = #<selected_pocket>

; we must execute this only in the milltask interpreter
; or preview will break, so test for '#<_task>' which is 1 for 
; the milltask interpreter and 0 in the UI's
O100 if [#<_task> EQ 0]
        (debug, Task ist Null)
O100     return [999]
O100 endif

; Goto Tool Changeposition from INI File
;first go up
; then move to change position

; cancel tool offset

; Request Tool Change
; using the code being remapped here means 'use builtin behaviour'
(debug, Refernce Change Position x=#<_ini[CHANGE_POSITION]X> y=#<_ini[CHANGE_POSITION]Y>)

;check the auto tool measurment setting from the settingspage
O200 if [#<_hal[gmoccapy.toolmeasurement]> EQ 0]
O200 return [3] ; indicate no tool measurement 
O200 endif

; Goto Tool Measureposition incl. Diameteroffset
;Coorection of X/Y Position by half of the tool diameter
#10 = [#<_ini[TOOLSENSOR]X> + #5410/2*0.7]
#11 = [#<_ini[TOOLSENSOR]Y> - #5410/2*0.7]
(debug, New Tool Diameter x=#5410)
(debug, New Change Position x=#10 y=#11)

;go to new position
G53 G0 X[#10] Y[#11]
G53 G0 Z[#<_ini[TOOLSENSOR]Z>]

;check the velocity setting
O300 if [#<_hal[gmoccapy.searchvel]> LE 0]
O300 return [-1] ; indicate searchvel <= 0 
O300 endif
;check the velocity setting
O400 if [#<_hal[gmoccapy.probevel]> LE 0]
O400 return [-2] ; indicate probevel <= 0 
O400 endif

; start probing
F #<_hal[gmoccapy.searchvel]>
G0 Z2

; This is commented out only for sim.
F #<_hal[gmoccapy.probevel]>
G38.2 Z-4

; check "G38" probe result #5070 - 1 if success, 0 if probe failed to close
O500 if [#5070 EQ 0]
O500 return [-3] ; indicate probe contact failure to epilog
O500 endif

; probing finished
; back to change position

#<touch_result> = #5063
#<probeheight> = #<_hal[gmoccapy.probeheight]> 
#<blockheight> = #<_hal[gmoccapy.blockheight]>

;(DEBUG, #<touch_result>  #<probeheight>  #<blockheight>)

;calculation tool lenght compenation
G10 L1 P#<tool> Z[#<touch_result> - #<_hal[gmoccapy.probeheight]> + #<_hal[gmoccapy.blockheight]>]

;G10 L1 P#<tool> Z#<touch_result>
;G10 L2 P0 Z[#<workpieceheight> + #<probeheight> + #<touch_result>]

; signal success be returning a value > 0:
o<change> endsub [1]

One more question:
Are there negative side effects by to many comments in the files?

Thanks for the support

07 May 2017 17:17 #92783 by MatthiasF1210
Hello again,

this macro is working very well so far and i am looking forward to adress my second issue.

For the chamfer I want to add a certain offset to the measured value. Therefore i worked out an easy solution, like adding a specific offset to a specific tool number. But this is not flexible enough...

Can i promt an input dialog, so that I can specify the offset?


10 May 2017 15:22 #92964 by andypugh

MatthiasF1210 wrote: Are there negative side effects by to many comments in the files?

None that are not outweighed by the clarity they add.

It will use more disk space and it will take a few microseconds longer to parse the G-code.
Moderators: newbynobi
Time to create page: 0.097 seconds
Powered by Kunena Forum