From a9c0cf3df6e366b410f47f2d4d79be7d0755a600 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Tue, 30 Sep 2014 15:06:02 +1000 Subject: [PATCH] prun and pdrive macros now check arguments and allow driving non posit motors too. --- site_ansto/instrument/util/motor_utility.tcl | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/site_ansto/instrument/util/motor_utility.tcl b/site_ansto/instrument/util/motor_utility.tcl index d40f6363..815a2b0a 100644 --- a/site_ansto/instrument/util/motor_utility.tcl +++ b/site_ansto/instrument/util/motor_utility.tcl @@ -54,7 +54,15 @@ publish reldrive user proc prun {args} { if [ catch { foreach {mot pname} $args { - lappend drlist $mot [SplitReply [$mot posit2unit $pname]] + set posnames [SplitReply [$mot position_names]] + if {([llength $posnames] == 0) && [string is double $pname]} { + lappend drlist $mot $pname + } else { + if {[lsearch $posnames $pname] == -1} { + error "$pname must be one of $posnames for $mot" + } + lappend drlist $mot [SplitReply [$mot posit2unit $pname]] + } } clientput run {*}$drlist anstocapture run {*}$drlist @@ -75,7 +83,15 @@ publish prun user proc pdrive {args} { if [ catch { foreach {mot pname} $args { - lappend drlist $mot [SplitReply [$mot posit2unit $pname]] + set posnames [SplitReply [$mot position_names]] + if {([llength $posnames] == 0) && [string is double $pname]} { + lappend drlist $mot $pname + } else { + if {[lsearch $posnames $pname] == -1} { + error "$pname must be one of $posnames for $mot" + } + lappend drlist $mot [SplitReply [$mot posit2unit $pname]] + } } clientput drive {*}$drlist anstocapture drive {*}$drlist