Skip to content
Snippets Groups Projects
generate_eps 1.91 KiB
Newer Older
Whitney Armstrong's avatar
Whitney Armstrong committed
#!/bin/bash

#export DAWN_PS_PREVIEWER="derp"

function print_the_help {
  echo "USAGE: $0 <PRIM_FILE>  "
  echo "  OPTIONS: "
  echo "            -t,--tag           filename tag (default: view1)"
  exit 
}

FILE_TAG="view01"
INPUT_FILE="../../g4_0000.prim"
Whitney Armstrong's avatar
Whitney Armstrong committed


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


# Side view (lines)
dawncut -1 0 0 1 ${INPUT_FILE} ${FILE_TAG}.prim
# dawncut 1 0 0 1 ${INPUT_FILE} ${FILE_TAG}_temp0.prim 
# dawncut -1 0 0 1 ${FILE_TAG}_temp0.prim  ${FILE_TAG}.prim
Chao Peng's avatar
Chao Peng committed
../../bin/dawn_tweak --mag 10 --draw 3 --theta 165 --phi 75 --light-theta 180 --light-phi 90
dawn -d ${FILE_TAG}.prim
Whitney Armstrong's avatar
Whitney Armstrong committed
ps2pdf ${FILE_TAG}.eps ${FILE_TAG}_full.pdf
gs -o ${FILE_TAG}.pdf -sDEVICE=pdfwrite \
  -c "[/CropBox [51 250 550 590] /PAGES pdfmark" \
  -f ${FILE_TAG}_full.pdf

Chao Peng's avatar
Chao Peng committed
pdftoppm ${FILE_TAG}.pdf ${FILE_TAG} -png -singlefile -cropbox -thinlinemode solid -aaVector yes -r 600
Whitney Armstrong's avatar
Whitney Armstrong committed

dawncut 0 -1 0 1 ${INPUT_FILE} ${FILE_TAG}.prim 
# dawncut 0 1 0 1 ${INPUT_FILE} ${FILE_TAG}_temp0.prim 
# dawncut 0 -1 0 1 ${FILE_TAG}_temp0.prim  ${FILE_TAG}.prim
Chao Peng's avatar
Chao Peng committed
../../bin/dawn_tweak --mag 10 --draw 4 --theta 270 --phi 90
dawn -d ${FILE_TAG}.prim 
ps2pdf ${FILE_TAG}.eps ${FILE_TAG}_top_full.pdf
gs -o ${FILE_TAG}_top.pdf -sDEVICE=pdfwrite \
  -c "[/CropBox [51 250 550 590] /PAGES pdfmark" \
  -f ${FILE_TAG}_top_full.pdf

pdftoppm ${FILE_TAG}_top.pdf ${FILE_TAG}_top -png -singlefile -cropbox -thinlinemode solid -aaVector yes