#!/bin/csh -f #+ #OSIRIS library of scripts # #NAME # ifilt - sets the imager filter # #SYNOPSIS # ifilt filter [pupil] # #DESCRIPTION # Set the filter (and optionally the pupil) for the imager # #OPTIONS # -t NUM # ID number to attach to all script generated errors, warnings, and # questions that are passed to the OGS. The ID number is separated # from the rest of the message with a ";". # # -m # simulate calls to RPC servers. during simulated calls, the # command is echoed (instead of being executed). # #EXAMPLES # #ENVIRONMENT VARIABLES # none # #FILES # none # #SERVERS & KEYWORDS # service = osiris # keywords: sfilter/ifilter, sscale # #SCRIPTS CALLED # help, syncheck, osimgFilterInfo # #EXIT STATUS # 0 - normal exit, no error # 1 - script aborted by an interrupt # 2 - PV lens requested with filter from wheel 2 # 3 - error parsing command line input # 10 - error setting filter # 11 - error setting spec scale # #SEE ALSO # ??? #- # # Modifcation History: # 20180205 - jlyke: Original, adoptied from osirisSetupMech # 20220207 - jlyke: Make exit status non-zero for bad input # 20220301 - jlyke: Update to call osimgFilterInfo for pattern match # Boiler plate for "-h" support for command autohelp. if ("$1" == "-h") then help $0 | more exit $status endif # End of help/syncheck boiler plate. # If no arguments, report the filter if ( $#argv == 0 ) then set posname5 = `show -s om5s -terse posname` set posname6 = `show -s om6s -terse posname` echo "$posname5 + $posname6" exit endif # Set up to trap control-C onintr break # Set default variable values set fcmd = $0 set cmd = ${fcmd:t} set cmdpre = "" set cmdsuf = "" set idnum = 0 set M = "i" set mode = "imag" set filter = "" set pupil = "" set pos5 = "" set pos6 = "" # LAnn = 1 # sAnn = 4 # sHex = 7 # LHex = 10 # HAM = 11 # Open = 14 set defaultpupilpos = 14 set myfilt = `osimgFilterInfo -k $argv` # Make sure nothing is moving before trying to move mechanisms $cmdpre wfmech $mode # Set filter if ($?myfilt) then # $cmdpre ${M}filter $filter ### Direct subserver command # "PV Lens" has a space in it--must pass double quotes $cmdpre modify -s osiris ${M}filter="${myfilt}" set error = $status if ($error != 0) then osirisScriptMsg -T "${cmd}: Error setting {$M}filter keyword (modify error #${error})." exit 10 endif endif goto done break: # Block of code to handle interrupts. ###modify this stuff for OSIRIS exit 1 done: # is there anything that needs to go here? exit