- GCode and Part Programs
- O Codes (subroutines) and NGCGUI
- Tool setter TS27r - Measure Tool Length Offset and Effective Diameter
Tool setter TS27r - Measure Tool Length Offset and Effective Diameter
- plopes9000
-
Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 87
- Thank you received: 18
24 Jul 2017 20:59 - 25 Jul 2017 07:36 #96365
by plopes9000
Motivation
To easily fill out the tool table with TLOs and precise tool diameters that take into account any run-outs.
Concept
For the most part the concept is self explanatory. The only critical alignment is the physical alignment of the tool setter and the defined position of the tool setter - see ini file params. Once that is well defined, the actual measurements are all relative, i.e. in y+ and y- for diameter and in z all tools relative to the ref tool, in my case the 3D probe,
The idea for tools with multiple cutting edges, is that the tool must complete an entire revolution so that the cutting edge sticking out the most (vertically for height measurement and horizontally for diameter measurement) touches the probe first within the feed rate that provides the desired precision. The number of cutting flutes is therefore irrelevant.
There are three variables that play a role here : spindle rpm, feed rate, desired precision.
The spindle rpm and precision are defined in the ini file and the feed rate is calculated to achieve the desired precision with that spindle rpm.
Procedure
see link . The video was made using an earlier version of the routine but should still give a good idea of the procedure.
Before measuring any tool, the reference tool must be measured. The reference tool diameter needs to be precisely known since this will be used to measure the effective tool setter disc diameter. The reference tool will receive tool length of zero and all other tools will receive the offset to the reference tool.
Implementation
The code goes to some length to ensure that all moves are protected ,except the initial z0 and xy=tool setter position.
The price is less readable code. Also some code ( diam measurement) is duplicated since nesting subs is not allowed - somehow did not feel right to put that code into a separate file.
To easily fill out the tool table with TLOs and precise tool diameters that take into account any run-outs.
Concept
For the most part the concept is self explanatory. The only critical alignment is the physical alignment of the tool setter and the defined position of the tool setter - see ini file params. Once that is well defined, the actual measurements are all relative, i.e. in y+ and y- for diameter and in z all tools relative to the ref tool, in my case the 3D probe,
The idea for tools with multiple cutting edges, is that the tool must complete an entire revolution so that the cutting edge sticking out the most (vertically for height measurement and horizontally for diameter measurement) touches the probe first within the feed rate that provides the desired precision. The number of cutting flutes is therefore irrelevant.
There are three variables that play a role here : spindle rpm, feed rate, desired precision.
The spindle rpm and precision are defined in the ini file and the feed rate is calculated to achieve the desired precision with that spindle rpm.
Procedure
see link . The video was made using an earlier version of the routine but should still give a good idea of the procedure.
Before measuring any tool, the reference tool must be measured. The reference tool diameter needs to be precisely known since this will be used to measure the effective tool setter disc diameter. The reference tool will receive tool length of zero and all other tools will receive the offset to the reference tool.
Implementation
The code goes to some length to ensure that all moves are protected ,except the initial z0 and xy=tool setter position.
The price is less readable code. Also some code ( diam measurement) is duplicated since nesting subs is not allowed - somehow did not feel right to put that code into a separate file.
O<tool-setter> sub (measure tool with TS27R)
#<tool_number>=#1 (tool number)
#<tool_xy_diam>=#2 (~ XY plane tool diam, precise for ref tool, zero for no diam meas)
#<tool_z_diam>=#3 (=0 ~ Z plane tool diam, zero for same as XY plane -> single point and inserts)
#<tool_length>=#4 (~ tool length)
#<tool_rotate>=#5 (=1 rotate tool, ingored for ref tool)
#<update_tooltable>=#6 (=1 update tooltable)
#<ref_tool>=#7 (=0 reference tool)
(info: TS27r Toolsetter TLO)
;;;;;;;;;;;;;;;;;;;;;;
;; ini file params
;;
;; [TOOLSETTER]
;; X= tool setter G53 X
;; Y= tool setter G53 Y
;; Z= tool setter G53 Z
;; TOOLSETTER_DIAM=12.7
;; TOOLSETTER_HEIGHT=14
;; BACKOFF=1
;; Z_CLEARANCE=2
;; SAFE_HEIGHT=50
;; RAPID_FEED=1500
;; COARSE_FEED=500
;; COARSE_RPM=750
;; FINE_RPM=1500
;; PRECISION=0.005 # to calculate fine feed: feed (mm/min/rot) = precision * spindle rpm
;;;;;;;;;;;;;;;;;;;;;;
;; Global Vars - need to be manually added to linuxcnc.var once
;; 601 - reference tool position G53 Z
;; 602 - measured tool setter diameter
;;;;;;;;;;;;;;;;;;;;;;
o05 if [#<ref_tool> NE 1]
o07 if [#601 EQ 0]
(debug,reference tool z pos not set, please run cycle for ref tool)
m2 (stop program)
o07 endif
o06 if [#602 EQ 0]
(debug,tool setter diam not measured, please run cycle for ref tool)
m2 (stop program)
o06 endif
o05 else
o51 if [#<tool_xy_diam> EQ 0]
(debug,for measuring ref tool, please enter the ref tool precise diameter)
m2 (stop program)
o51 endif
o05 endif
;; preamble
g21 g17 g40 g80 g94 g90 g49 g92.1
;; load tool
T#<tool_number> M6
;;activate tool setter
M64 P0
;;fetch ini params
#<tool_setter_x>=#<_ini[TOOLSETTER]X>
#<tool_setter_y>=#<_ini[TOOLSETTER]Y>
#<tool_setter_z>=#<_ini[TOOLSETTER]Z>
#<rapid_feed>=#<_ini[TOOLSETTER]RAPID_FEED>
#<coarse_feed>=#<_ini[TOOLSETTER]COARSE_FEED>
#<fine_rpm>=#<_ini[TOOLSETTER]FINE_RPM>
#<fine_feed>=[#<_ini[TOOLSETTER]PRECISION>*#<fine_rpm>*0.9]
#<coarse_rpm>=#<_ini[TOOLSETTER]COARSE_RPM>
#<probe_backoff>=#<_ini[TOOLSETTER]BACKOFF>
#<z_clearance>=#<_ini[TOOLSETTER]Z_CLEARANCE>
#<toolsetter_diam>=#<_ini[TOOLSETTER]TOOLSETTER_DIAM>
#<toolsetter_height>=#<_ini[TOOLSETTER]TOOLSETTER_HEIGHT>
#<safe_height>=#<_ini[TOOLSETTER]SAFE_HEIGHT>
;; calculate fine feed for requested precision
o23 if [#<fine_feed> LE 1]
#<fine_feed>=5
(debug, calc. fine feed too small, suing #<fine_feed> mach units/min)
o23 else
(debug, calc. fine feed=#<fine_feed> mach units/min)
o23 end if
g54 ; to be able to use #5221,2,3
;; ref tool cycle
o09 if [#<ref_tool> EQ 1]
(measure reference tool - WITHOUT ROTATION)
(position above toolsetter)
g53 g0 z0
g53 g0 X#<tool_setter_x> Y#<tool_setter_y>
o<p-move> call [#<_x>] [#<_y>] [#<tool_setter_z>+#<safe_height>+#<tool_length>-#5223] [0] [#<rapid_feed>]
(ensure tool is aligned with tollsetter center line on X)
g91 g38.2 z[-#<safe_height>-5] f#<coarse_feed> (coarse measure)
g91 g1 z#<probe_backoff> f#<rapid_feed> (backoff)
g91 g38.2 z[-#<probe_backoff>-1] f#<fine_feed> (fine measure)
g28.1
#601=[#5163] (save reference tool pos)
(debug,measured ref length # 601 = #601)
o21 if [ #<update_tooltable> EQ 1 ]
G10 L1 P#<tool_number> Z0 ; tool reference is 0 length offset
(debug,tooltable Z updated)
o21 else
(debug,tooltable not updated)
o21 endif
g91 g1 z#<z_clearance> f#<rapid_feed> (backoff)
o<p-move> call [#<tool_setter_x>-#5221] [#<tool_setter_y>-#5222] [#<_z>] [0] [#<rapid_feed>]
( y+ measure )
o<p-move> call [0] [-#<tool_xy_diam>/2*1.5-#<toolsetter_diam>/2] [0] [1] [#<rapid_feed>]
o<p-move> call [0] [0] [-#<z_clearance>-#<toolsetter_height>/2] [1] [#<rapid_feed>]
g91 g38.2 y[#<tool_xy_diam>/2*1.7] f#<coarse_feed> (coarse measure)
g91 g1 y-#<probe_backoff> f#<rapid_feed> (backoff)
g91 g38.2 y[#<probe_backoff>*1.2] f#<fine_feed> (fine measure)
#1002=#5062 (save +y measure)
g91 g1 y-#<probe_backoff> f#<rapid_feed> (backoff)
o<p-move> call [0] [0] [#<z_clearance>+#<toolsetter_height>/2] [1] [#<rapid_feed>]
o<p-move> call [0] [#<probe_backoff>] [0] [1] [#<rapid_feed>]
o<p-move> call [#<tool_setter_x>-#5221] [#<tool_setter_y>-#5222] [#<_z>] [0] [#<rapid_feed>]
( y- measure )
o<p-move> call [0] [#<tool_xy_diam>/2*1.5+#<toolsetter_diam>/2] [0] [1] [#<rapid_feed>]
o<p-move> call [0] [0] [-#<z_clearance>-#<toolsetter_height>/2] [1] [#<rapid_feed>]
g91 g38.2 y[-#<tool_xy_diam>/2*1.7] f#<coarse_feed> (coarse measure)
g91 g1 y#<probe_backoff> f#<rapid_feed> (backoff)
g91 g38.2 y[-#<probe_backoff>*1.2] f#<fine_feed> (fine measure)
#1003=#5062 (save -y measure)
g91 g1 y#<probe_backoff> f#<rapid_feed> (backoff)
o<p-move> call [0] [0] [#<z_clearance>+#<toolsetter_height>/2] [1] [#<rapid_feed>]
o<p-move> call [0] [-#<probe_backoff>] [0] [1] [#<rapid_feed>]
o<p-move> call [#<tool_setter_x>-#5221] [#<tool_setter_y>-#5222] [#<_z>] [0] [#<rapid_feed>]
M5 (stop spindle)
(calculate tool setter measured diameter)
#602=[#1003-#1002-#<tool_xy_diam>]
(debug, tool setter measured diam # 602 = #602)
o09 else
(measure tool length)
o121 if [#<tool_z_diam> EQ 0]
#<tool_z_diam>=#<tool_xy_diam>
o121 end if
;; fetch global vars
#<ref_tool_z>=#601
#<toolsetter_diam>=#602
(position above toolsetter)
g53 g0 z0
g53 g0 X[#<tool_setter_x>+#<tool_z_diam>/2] Y#<tool_setter_y>
o<p-move> call [#<_x>] [#<_y>] [#<tool_setter_z>+#<safe_height>+#<tool_length>-#5223] [0] [#<rapid_feed>]
o115 if [#<tool_rotate> EQ 1]
S#<coarse_rpm> M4 (start spindle in reverse)
o115 endif
g91 g38.2 z[-#<safe_height>-5] f#<coarse_feed> (coarse measure)
g91 g1 z#<probe_backoff> f#<rapid_feed> (backoff)
o116 if [#<tool_rotate> EQ 1]
S#<fine_rpm> M4 (start spindle in reverse)
o116 endif
g91 g38.2 z[-#<probe_backoff>-1] f#<fine_feed> (fine measure)
g28.1
#1005=[#5163-#<ref_tool_z>]
(debug,tool length offset: #1005)
o11 if [ #<update_tooltable> EQ 1 ]
G10 L1 P#<tool_number> Z#1005
(debug,tooltable Z updated)
o11 else
(debug,tooltable not updated)
o11 endif
g91 g1 z#<z_clearance> f#<rapid_feed> (backoff)
o<p-move> call [#<tool_setter_x>-#5221] [#<tool_setter_y>-#5222] [#<_z>] [0] [#<rapid_feed>]
o117 if [#<tool_rotate> EQ 1]
S#<coarse_rpm> M4 (start spindle in reverse)
o117 endif
o118 if [#<tool_xy_diam> NE 0]
( y+ measure )
o<p-move> call [0] [-#<tool_xy_diam>/2*1.5-#<toolsetter_diam>/2] [0] [1] [#<rapid_feed>]
o<p-move> call [0] [0] [-#<z_clearance>-#<toolsetter_height>/2] [1] [#<rapid_feed>]
g91 g38.2 y[#<tool_xy_diam>/2*1.7] f#<coarse_feed> (coarse measure)
g91 g1 y-#<probe_backoff> f#<rapid_feed> (backoff)
o122 if [#<tool_rotate> EQ 1]
S#<fine_rpm> M4 (start spindle in reverse)
o122 endif
g91 g38.2 y[#<probe_backoff>*1.2] f#<fine_feed> (fine measure)
#1002=#5062 (save +y measure)
g91 g1 y-#<probe_backoff> f#<rapid_feed> (backoff)
o<p-move> call [0] [0] [#<z_clearance>+#<toolsetter_height>/2] [1] [#<rapid_feed>]
o<p-move> call [0] [#<probe_backoff>] [0] [1] [#<rapid_feed>]
o<p-move> call [#<tool_setter_x>-#5221] [#<tool_setter_y>-#5222] [#<_z>] [0] [#<rapid_feed>]
o119 if [#<tool_rotate> EQ 1]
S#<coarse_rpm> M4 (start spindle in reverse)
o119 endif
(y- measure)
o<p-move> call [0] [#<tool_xy_diam>/2*1.5+#<toolsetter_diam>/2] [0] [1] [#<rapid_feed>]
o<p-move> call [0] [0] [-#<z_clearance>-#<toolsetter_height>/2] [1] [#<rapid_feed>]
g91 g38.2 y[-#<tool_xy_diam>/2*1.7] f#<coarse_feed> (coarse measure)
g91 g1 y#<probe_backoff> f#<rapid_feed> (backoff)
o120 if [#<tool_rotate> EQ 1]
S#<fine_rpm> M4 (start spindle in reverse)
o120 endif
g91 g38.2 y[-#<probe_backoff>*1.2] f#<fine_feed> (fine measure)
#1003=#5062 (save -y measure)
g91 g1 y#<probe_backoff> f#<rapid_feed> (backoff)
o<p-move> call [0] [0] [#<z_clearance>+#<toolsetter_height>/2] [1] [#<rapid_feed>]
o<p-move> call [0] [-#<probe_backoff>] [0] [1] [#<rapid_feed>]
o<p-move> call [#<tool_setter_x>-#5221] [#<tool_setter_y>-#5222] [#<_z>] [0] [#<rapid_feed>]
M5 (stop spindle)
#1005=[#1003-#1002-#602]
(debug, measured tool diameter #1005)
o12 if [ #<update_tooltable> EQ 1 ]
G10 L1 P#<tool_number> R[#1005/2]
(debug,tooltable D updated)
o12 endif
o118 end if
o09 end if
g90 (absolute distance mode)
M65 P0 (activate 3d probe)
O<tool-setter> endsub
M2
O<p-move> sub
#<x>=#1
#<y>=#2
#<z>=#3
#<incremental>=#4
#<r_feed>=#5
O501 if [#<incremental> EQ 1]
g91 g38.3 x#<x> y#<y> z#<z> f#<r_feed>
O501 else
g90 g38.3 x#<x> y#<y> z#<z> f#<r_feed>
O501 end if
O502 if [#5070 EQ 1]
(debug, probe tripped unexpectedly)
M2
O502 end if
O<p-move> endsub
Last edit: 25 Jul 2017 07:36 by plopes9000. Reason: made fine feed 90% of calculated value
The following user(s) said Thank You: robh
Please Log in or Create an account to join the conversation.
20 Oct 2017 21:47 #100597
by robh
Replied by robh on topic Tool setter TS27r - Measure Tool Length Offset and Effective Diameter
hi
how do ou get the tool setting tab in axis?
rob
how do ou get the tool setting tab in axis?
rob
Please Log in or Create an account to join the conversation.
23 Oct 2017 22:32 - 23 Oct 2017 22:33 #100701
by andypugh
Replied by andypugh on topic Tool setter TS27r - Measure Tool Length Offset and Effective Diameter
You can embed tabs in most of the GUIs.
EMBED_TAB for GladeVCP and PYVCP= for PyVCP.
linuxcnc.org/docs/2.7/html/config/ini-co...tml#_display_section
EMBED_TAB for GladeVCP and PYVCP= for PyVCP.
linuxcnc.org/docs/2.7/html/config/ini-co...tml#_display_section
Last edit: 23 Oct 2017 22:33 by andypugh.
Please Log in or Create an account to join the conversation.
- plopes9000
-
Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 87
- Thank you received: 18
24 Oct 2017 06:41 #100723
by plopes9000
Replied by plopes9000 on topic Tool setter TS27r - Measure Tool Length Offset and Effective Diameter
Hi Rob,
I used the following, making sure that the path for the files listed in NGCGUI_SUBFILE entries is listed in the SUBROUTINE_PATH.
[DISPLAY]
NGCGUI_FONT = Helvetica -12 normal
NGCGUI_SUBFILE = p-hole.ngc
NGCGUI_SUBFILE = tool-setter.ngc
NGCGUI_SUBFILE = p-calibrate.ngc
NGCGUI_SUBFILE = facemill2.ngc
NGCGUI_OPTIONS = nonew noremove
[RS274NGC]
SUBROUTINE_PATH = path1:path2:path3
Best Regards,
Paulo
I used the following, making sure that the path for the files listed in NGCGUI_SUBFILE entries is listed in the SUBROUTINE_PATH.
[DISPLAY]
NGCGUI_FONT = Helvetica -12 normal
NGCGUI_SUBFILE = p-hole.ngc
NGCGUI_SUBFILE = tool-setter.ngc
NGCGUI_SUBFILE = p-calibrate.ngc
NGCGUI_SUBFILE = facemill2.ngc
NGCGUI_OPTIONS = nonew noremove
[RS274NGC]
SUBROUTINE_PATH = path1:path2:path3
Best Regards,
Paulo
Please Log in or Create an account to join the conversation.
24 Oct 2017 08:03 #100732
by andypugh
Replied by andypugh on topic Tool setter TS27r - Measure Tool Length Offset and Effective Diameter
I had forgotten NGCGUI, though I did think that the tab didn't look quite like Glade or PyVCP in fonts and layout.
Please Log in or Create an account to join the conversation.
- GCode and Part Programs
- O Codes (subroutines) and NGCGUI
- Tool setter TS27r - Measure Tool Length Offset and Effective Diameter
Time to create page: 0.081 seconds