Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:02

0001 #!/bin/bash -l
0002 usage(){ cat << EOU
0003 openline.sh
0004 ============
0005  
0006 ::
0007 
0008    ./openline.sh 0   # typically the slowest elv 
0009    ./openline.sh 1   
0010    ./openline.sh 63   
0011         # its common to limit the jpg to the 64 slowest for image_grid.sh in that case 63 is the last 
0012 
0013    ./openline.sh 137  
0014 
0015 Open path specified by a line of a file, for example
0016 create the list of path using grabsnap.sh. 
0017 See also image_grid.sh 
0018 
0019 If the path is a standard geocache path then the meshname 
0020 is looked up by this script. 
0021 
0022 EOU
0023 }
0024 
0025 msg="=== $BASH_SOURCE :" 
0026 idx0=${1:-0}
0027 idx1=$(( $idx0 + 1 ))
0028 
0029 #pathlist=/tmp/ana_snap.txt
0030 pathlist=/tmp/elv_jpg.txt
0031 PATHLIST=${PATHLIST:-$pathlist}
0032 line=$(sed "${idx1}q;d" $PATHLIST) 
0033 
0034 if [ -f "$line" ]; then 
0035    echo $msg line idx0 $idx0 idx1 $idx1  of file $PATHLIST is $line 
0036    open $line
0037 
0038    aftgeom=${line#*GEOM\/}  # tail of path string after "GEOM/"
0039    geom=${aftgeom/\/*}      # extract first path element before "/" giving GEOM value eg V1J009
0040    meshname=$HOME/.opticks/GEOM/$geom/CSGFoundry/meshname.txt
0041 
0042    if [ -f "$meshname" ]; then
0043 
0044        tline=${line/_moi*}  # trim tail starting from _moi
0045        midx0=${tline##*_}   # extra the string after last underscore eg t133
0046        [ "${midx0:0:1}" == "t" ] && midx0=${midx0:1} 
0047        midx1=$(( $midx0 + 1 ))
0048 
0049        echo meshname $meshname
0050        mn=$(sed "${midx1}q;d" $meshname)
0051        echo $msg midx0 $midx0 midx1 $midx1 mn $mn 
0052    else
0053        echo dint match base
0054    fi  
0055 else
0056    echo $msg error line idx0 $idx0 idx1 $idx1  of PATHLIST $PATHLIST is line $line : BUT that is not an existing path 
0057 fi 
0058 
0059