Es waren ja noch genug IO’s frei und um einem das Einrichten der Werkzeuge zu erleichtern habe ich mir einen einfachen Werkzeuglängensensor beschafft und in Igor verbaut. Das ist die erste Maßnahme, die über den Retrofit hinaus geht. Daher mussten hier erst mal neue Leitungen gezogen werden und ich habe die 7i77 in der Steuerkonsole dafür ausgesucht um die Wege kurz zu halten:

Konsole
Kabel Portal
Sensor Montiert

Jetzt musste noch die Software vorbereitet werden und der Ort hinterlegte werden. Das macht man im Offsets Tab, hier hinterlegt man auch ie Wege und Geschwindigkeiten für das Antasten

Die Steuerung erfolgt über den Tool Tab, auch hier habe ich mir wieder ein paar Sachen angepasst. Und jetzt kommt auch der Zeitpunkt wo ich auf mein Werkzeugwechsel-Script eingehen werde. Nicht alle meine Werkzeughalter sind für den Wechsler geeignet, daher unterscheide ich in allen Skripten zwischen Werkzeugen im Wechsler und welchen die Manuell gewechselt werden müssen. Doch später dazu mehr.

Zunächst gehen wir hier das Toolchange Panel durch:

Unload Spindle - MDI Button - M61 Q0 G49 #5210 = 0
M6 G43 - subcall Button - m6_tool_call_tool_page.ngc

(author: Chris P)
(version: 0.1)
(date: 02/8/20)
(m6 tool call with g43 offset applied)
o<M6_tool_call_tool_page> sub
#<tool_number_entry_tool_page> = #1
T#<tool_number_entry_tool_page> M6
G43 H#<tool_number_entry_tool_page>
o<tool_number_entry_tool_page> endsub
M2 (end program)
M6 - MDI Command remapped to - toolchang2.ngc

o<toolchange2> sub
(M108 P#<_current_tool>  Q#<_selected_tool> )
;assign the tool numbers held in parameters to the pocket numbers
#1 = #5190
#2 = #5191
#3 = #5192
#4 = #5193
#5 = #5194
#6 = #5195
#7 = #5196
#8 = #5197
#9 = #5198
#10 = #5199
#11 = #5200
#12 = #5201
;assign the variables passed by M6 to some parameters
#100 = #<_selected_tool>
#110 = #<_current_tool>
(#120 = #<selected_pocket>)

O10 if [#100 EQ #110] ; checks if tool in the spindle is same as requested
 o<toolchange> endsub [1]
M2
O10 endif

#<next_pocket> = 0 ; assigns 0 to the next pocket for a later check if the tool is found in the basket
#<loaded_pocket> = 0 ; assigns 0 to the next pocket for a later check if the tool is found in the basket and loaded

#15 = 12 ;assign test parameter the number of pockets in the carousel

O100 do
 	O110 if [#[5189 + #15] EQ #100] ; checks all pockets to see if it contains tool number requested as the new tool
		#<next_pocket> = #15 ; if tool is found in pocket, assigns the next pocket
	O110 endif
   
	O115 if [#[5189 + #15] EQ #110] ; checks if the pocket is loaded in spindle
		#<loaded_pocket> = #15

	O115 endif
   #15= [#15 - 1]
O100 while [#15 GT 0]

;now we know which pocket the next tool is sitting in 
;and we know inwhich pocket the current tool is
;we need to know if we need to put a tool away
;or if there is no tool in the spindle


O180 IF [#110 GT 0] ; checks if there is a valid tool in the spindle
    	O190 if [#<loaded_pocket> EQ 0] ;If there is a tool in the spindle, checks if it is an pocket
                ; Go for manual Tool removal
        	G53 G0 Z0     ;raise spindle
                G53 G0 X0 Y0  ;move to door
                M125          ; remove tool
	O190 endif
    	O195 if [#<loaded_pocket> GT 0] ;If there is a tool in the spindle, checks if it is an pocket
                ; Go for atc Tool removal
                G0 G53 Z0	; raise spindle
                M110            ; draw bar loose
                M112            ; lower basket
                M116            ; raise pockets	
	O195 endif
O180 ENDIF

O200 IF [#100 GT 0]  ; selected tool is not tool0
    	O210 if [#<next_pocket> EQ 0] ;if new tool is not in a pocket
                ; Go for manual Tool load
        	M113		; Raise basket
                G53 G0 Z0       ; Raise spindle
                G53 G0 X0 Y0	; move to door
                M110            ; draw bar loose
                M126            ; manual tool load
        O210 endif
   
    	O215 if [#<next_pocket> GT 0] ;If new tool is in a pocket
                ; Go for atc Tool Load
        	G0 G53 Z0       ; raise sindle
                M110            ; draw bar loose
                M112            ; Lower basket		
                M131 P#<next_pocket>         ; load pocket
                M114            ; air blast
                S150 M3		; rotate spindle
                M113		; raise basket
                M115            ; stop air blast
                M111		; clamp tool
                M5		; stop spindle
       	O215 endif
    
O200 Else
        ;new tool is 0 raise basket and clamp drawbar  
        M113 ;raise basket
	M111 ;clamp drawbar
O200 ENDIF


M61 Q#100

o<toolchang2> endsub [1]

M2
#!/bin/bash
#Manueller Werkzeugwechel M126
set -- $(halcmd -s show pin iocontrol.0.tool-prep-number)
newnr=$4
toolline=$(grep  "T$newnr " tool.tbl )
tool=$(cut -d ";" -f2 <<< $toolline)
temp=$(cut -d "Z" -f2 <<< $toolline)
Offset=${temp:1:3}  
zenity  --info --title="Werkzeugwechsel" --text "Werkzeug: T$newnr \n\n $tool \n\n Z-Offset: $Offset mm \n\n einsetzen"

		echo "Werkzeug spannen"		
		~/linuxcnc/configs/IgorProbe/nc_files/M111
zenity --info  --title="Werkzeugwechsel" --text "Werkzeug T$newnr gespannt?"
exit 0

Jetzt zu den Funktionen auf dem Toolsetter Panel

Clean Probe - MDI Button - M134 P2

#!/bin/bash
#M134 Druckluft fuer Werkzeugmesser
P=$1
Q=$2
case=$P
if [ -z "$1" ]
  then
    case=3
fi
#
if [ $case = 0 ]; then
 halcmd sets o-probe-clean false
#
elif [ $case = 1 ]; then
 halcmd sets o-probe-clean true
else
 set -- $(halcmd -s show sig o-probe-clean)
    open=$2
    if [ "$open" == "FALSE" ] ; then
        halcmd sets o-probe-clean true
    else 
        halcmd sets o-probe-clean false
    fi

fi

exit 0
Touch off current tool - subcall Button - tool_touch_off.ngc

o<tool_touch_off> sub

#<worktable> = #<_hal[i-table-is-2]>

#<fast_probe_fr> = #1    (set from probe screen fast probe feed rate)
#<slow_probe_fr> = #2    (set from probe screen slow probe feedrate)
#<z_max_travel> = #3    (max z distance the tool travels before erroring out if not contact is made)
#<xy_max_travel> = #4    (max xy distance the tool travels before erroring out if not contact is made)
#<retract_distance> = #6    (distance the tool retracts after making contact during fast feed mode)
#<spindle_zero_height> = #5    (G53 distance from home to spindle nose triggering point on touch plate)
#<tool_diameter_probe_mode> = #8    (activates the tool diameter probe subroutine section)
#<tool_diameter_offset_mode> = #9    (activates the tool diameter offset position for probe subroutine section)
#<tool_diameter> = #10    (current tool's diameter used for offseting probe position in x axis)

o<100> if [#<worktable> EQ 0]
                (need to change table for probing)
                G53 G0 Z0     ;raise spindle
                G53 G0 X0 Y0  ;move to door
                M123
o<100> endif

G92.1    (Cancel G92 offset)

(#<workspace_z> = #[5203 + [20 * #5220]])
#<workspace_z> = #5220

#<tool_touch_x_coords> = #5181
#<tool_touch_y_coords> = #5182
#<tool_touch_z_coords> = #5183

#<tool_radius_offset> = [#<tool_diameter> / 2]
#<offset_probing_position> = [#<tool_touch_y_coords> + #<tool_radius_offset>]

G59.3

o<110> if [#<tool_diameter_offset_mode> EQ 1]
  #<tool_touch_y_coords> = #<offset_probing_position>
o<110> endif

o<115> if [2 EQ 2]
  G49  (cancel tlo)
o<115> endif

G90    (set absolute coordinates)
M134 P1 (blow of probe)
G53 G0 Z0    (move to z0 home position)
G53 G0 X#<tool_touch_x_coords> Y#<tool_touch_y_coords>
G53 G0 Z#<tool_touch_z_coords>

G91
F #<fast_probe_fr>
G38.2 Z-[#<z_max_travel>]    (fast tool probe)
#<z_fast_probe> = #5063    (save probe result of fast probe to parameters)
G0 Z[#<retract_distance>]    (retract tool retract distance amount)

(Slow Probe Rule, if Slow Probe FR is set to 0, Slow Probe is Bypassed)
o<120> if [#<slow_probe_fr> GT 0]
  (Initiate Slow Z- Probe)
  G91
  F[#<slow_probe_fr>]    (set probe slow feedrate)
  G38.2 Z-[#<retract_distance> * 1.5]    (slow tool probe)
  #<z_slow_probe> = #5063
  (debug, Probed Pos: #5063 Z Pos: #<_z>)
  G90
  G0 Z[#<z_slow_probe> + #<retract_distance>]
o<120> endif

o<130> if [#5070 EQ 1]    (verify probe event was succesful)
  #<z_slow_probe> = #5063    (save slow probe result to parameters)
o<130> else
  (MSG,Tool Length Offset Probe Failed)
o<130> endif

(Tool Diameter Probe Mode Section, User must define this section as needed)
o<140> if [#<tool_diameter_probe_mode> EQ 1]
  (MSG, Tool Diameter Probing is Not Defined in Subroutine)
o<140> endif

G49
o<150> if [3 EQ 3]
  G49
o<150> endif

G90    (set absolute coordinates)
M134 P0 (stop blow of probe)

G53 G0 Z0 (Send Spindle to home zero position)

(define new tool length offset parameters)
#<new_tool_length_offset> = [ABS[#<spindle_zero_height> + #5063]]

G10 L1 P #5400 Z [#<new_tool_length_offset>]  (5400 = tool number)

o<160> if [#<workspace_z> EQ 1]
  G54
o<160> else if [#<workspace_z> EQ 2]
  G55
o<160> else if [#<workspace_z> EQ 3]
  G56
o<160> else if [#<workspace_z> EQ 4]
  G57
o<160> else if [#<workspace_z> EQ 5]
  G58
o<160> else if [#<workspace_z> EQ 6]
  G59
o<160> else if [#<workspace_z> EQ 7]
  G59.1
o<160> else if [#<workspace_z> EQ 8]
  G59.2
o<160> endif

T #5400 G43  H #5400    (enable tool length offset)

o<170> if [#<worktable> EQ 0]
                (need to chante table after probing)
                G53 G0 Z0     ;raise spindle
                G53 G0 X0 Y0  ;move to door
                M122
o<170> endif

o<tool_touch_off> endsub

M2 (end program)
Touch off ATC - subcall Button - atctouchoff.ngc

o<atctouchoff> sub
(print, o<atctouchoff>)
(DEBUG, EVAL[vcp.getWidget{"dynatc"}.atc_message{"Touch off ATC"}])
T0 M6; empty spindle
#1 = 0
o130 while [#1 LT 12]
    #1 = [#1+1]
    #2 = #[5189+#1]
    o140  if [#2  GT 0]
    (DEBUG, EVAL[vcp.getWidget{"dynatc"}.atc_message{"Touch off Tool #2 "}])
    M6 T#2
    o<tool_touch_off> call
    o140 endif
o130 endwhile

(DEBUG, EVAL[vcp.getWidget{"dynatc"}.atc_message{"Igor"}])
o<atctouchoff> endsub [1]

M2