Skip to content

Commit 1ae0fb1

Browse files
committed
tooledit.tcl: allow multiple tools in pocket if
toolchanger is nonrandom (or "unknown") Note: 1) In LinuxCNC, tooldata lines are read sequentially. When a random toolchanger is specified ([EMCIO]RANDOM_TOOLCHANGER==1), lines that specify a previously used pocket supersede prior entries. A warning message is emitted (Ref: cd90b27). 2) When using tooledit on a file that is not used by a running axis gui, the toolchanger type is "unknown"
1 parent bdb1d17 commit 1ae0fb1

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

tcl/tooledit.tcl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ proc ::tooledit::init { {columns ""} } {
113113
set ::te(type,poc) integer
114114
set ::te(type,orien) integer
115115
set ::te(type,comment) ascii
116+
set ::te(tool_changer) unknown
116117
117118
# include values for each (header) item:
118119
set ::te(tool,width) 5; set ::te(tool,tag) T
@@ -269,6 +270,18 @@ proc ::tooledit::readfile {filename} {
269270
catch {
270271
sendaxis ping
271272
set axis_is_running [sendaxis tool_table_filename]
273+
274+
if $axis_is_running {
275+
set tchanger nonrandom ;# default if not specified
276+
if [catch {set tchanger [send axis inifindall EMCIO RANDOM_TOOLCHANGER]} msg ] {
277+
puts "UNEXPECTED: $msg"
278+
}
279+
switch "$tchanger" {
280+
1 {set ::te(tool_changer) random}
281+
default {set ::te(tool_changer) nonrandom}
282+
}
283+
}
284+
272285
set tooledit_pid_ct [llength $tooledit_pids]
273286
if {$axis_is_running && $tooledit_pid_ct > 0} {
274287
set msg [_ "Current file:"]
@@ -873,8 +886,7 @@ proc ::tooledit::toolvalidate {args} {
873886
set pocs ""
874887
foreach i $::te(items) {
875888
set p $::te(parm,$i,poc)
876-
877-
if {[lsearch $pocs $p] >= 0} {
889+
if { "$::te(tool_changer)" == "random" && [lsearch $pocs $p] >= 0 } {
878890
set nextmsg [format [_ "Pocket <%s> specified multiple times"] $p]
879891
if {[lsearch $msg $nextmsg] >= 0} continue
880892
lappend msg $nextmsg

0 commit comments

Comments
 (0)