#!/bin/tcsh

# [PT: Nov 14, 2018] Updated first DriveSuma command to not crash on Macs

set sl = (`ls *SmWm*gii`)
set vl = (A B C D E F )
if ($#sl > 6) then
   echo "This demo is to be run with no more than 6 surfaces."
   goto END
endif

suma -spec All_lh_ld141.spec -niml &

sleep 3

set cnt = 1
while ($cnt <= $#sl)
   #New controller, no convexity highlights and switch to new surface
   if ($cnt == 1) then
      DriveSuma -com surf_cont -view_surf_cont y            \
		-com viewer_cont -key 'b'                   \
                -com surf_cont   -switch_surf $sl[$cnt]  
#                                 -load_dset                    
   else
      DriveSuma -com viewer_cont -key 'ctrl+n'              \
                -com surf_cont   -viewer $vl[$cnt]          \
                                 -switch_surf $sl[$cnt]     \
                -com viewer_cont -viewer $vl[$cnt]          \
                                 -key 'b'                   \
                                 -load_view  sixlay${cnt}.niml.vvs
   endif 
   @ cnt ++
end

#Load the color pattern
DriveSuma -com surf_cont -load_col lh_ld141_smoothcol2.1D.col

END:
