generate_eps 2.16 KB
Newer Older
1
#!/bin/bash
2

3
echo "view2 produces a series of XY slices  a different z locations."
Whitney Armstrong's avatar
Whitney Armstrong committed
4
5
6
7

function print_the_help {
  echo "USAGE: $0 <PRIM_FILE>  "
  echo "  OPTIONS: "
8
  echo "            -t,--tag           filename tag (default: view1)"
Whitney Armstrong's avatar
Whitney Armstrong committed
9
10
11
  exit 
}

12
13
FILE_TAG="view3"
INPUT_FILE="../../g4_0000.prim"
Whitney Armstrong's avatar
Whitney Armstrong committed
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45


POSITIONAL=()
while [[ $# -gt 0 ]]
do
  key="$1"

  case $key in
    -h|--help)
      shift # past argument
      print_the_help
      ;;
    -t|--tag)
      FILE_TAG="$2"
      shift # past argument
      shift # past value
      ;;
    -i|--input)
      INPUT_FILE="$2"
      shift # past argument
      shift # past value
      ;;
    *)    # unknown option
      #POSITIONAL+=("$1") # save it in an array for later
      echo "unknown option $1"
      print_the_help
      shift # past argument
      ;;
  esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters

46

47
48
49
50
51
52
53
54
# units are mm
dawncut 0 0 -1 1500 ${INPUT_FILE} ${FILE_TAG}.prim 
dawn  ${FILE_TAG}.prim 
ps2pdf ${FILE_TAG}.eps ${FILE_TAG}_full.pdf
gs -o ${FILE_TAG}.pdf -sDEVICE=pdfwrite \
  -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
  -f ${FILE_TAG}_full.pdf
pdftoppm ${FILE_TAG}.pdf ${FILE_TAG} -png -singlefile -cropbox
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76

#https://geant4.kek.jp/~tanaka/DAWN/About_DAWNCUT.html
# % dawncut a b c d input-file [output-file]
#
#       input-file : Source DAWN-format file describing a 3D scene.
#
#       output-file: Output DAWN-format file describing a plane-clipped 
#                    3D scene.  The default output stream is stdout.
#
#       a, b, c, d : Parameters  a, b, c, and d  are double values to
#                    define a clipping plane described with the following 
#                    equation: 
#
#                       ax + by + cz + d = 0. 
#
#                    Vector (a,b,c) defines the normal vector of 
#                    the clipping plane.  
#                    3D scene data in the half space at the front side 
#                    of the clipping plane are clipped out and erased. 
#                    The normal vector (a,b,c) needs not be a unit vector. 
#                    If it is a unit vector, parameter "d" gives distance 
#                    between the clipping plane and origin (0,0,0).