From 16ec7dddffb59a4d90c313b93f42f90ccc28f209 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Wed, 31 Oct 2007 17:15:17 +1100 Subject: [PATCH] Added the "is_drivable" query. This is useful for scan commands. Added some error checking. r2212 | ffr | 2007-10-31 17:15:17 +1100 (Wed, 31 Oct 2007) | 3 lines --- site_ansto/instrument/util/utility.tcl | 27 ++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/site_ansto/instrument/util/utility.tcl b/site_ansto/instrument/util/utility.tcl index a2dfaace..a9469f8c 100644 --- a/site_ansto/instrument/util/utility.tcl +++ b/site_ansto/instrument/util/utility.tcl @@ -1,9 +1,9 @@ # Some useful functions for SICS configuration. -# $Revision: 1.8 $ -# $Date: 2007-10-29 03:00:55 $ +# $Revision: 1.9 $ +# $Date: 2007-10-31 06:15:17 $ # Author: Ferdi Franceschini (ffr@ansto.gov.au) -# Last revision by $Author: dcl $ +# Last revision by $Author: ffr $ source util/extra_utility.tcl source util/motor_utility.tcl @@ -11,7 +11,26 @@ source util/command.tcl # Returns attribute name and value proc getatt {sicsobj att} { - lindex [split [tolower_sicslist $sicsobj $att] =] 1 + if [catch { + lindex [split [tolower_sicslist $sicsobj $att] =] 1 + } reply ] { + return -code error $reply + } else { + return $reply + } +} + +proc is_drivable {sicsobj} { + if [catch { + getatt $sicsobj drivable + } reply] { + return -code error $reply + } + if {$reply == "true"} { + return 1 + } else { + return 0 + } } # Utility fucntion for setting the home and upper and lower