	# ESP zone geometry file builder: version 1.0a of November 1988

	# Script to build ESP zone geometry input files
	# from data supplied by the IFE building model.

"imp << EOI"
"-6"
"a"

% nz = no_zones	nokey
forall i upto ${nz:=0}
do
%   zsht = zone_type	$i
   if test X${zsht} = Xrec
   then
      "c"
      "rec"
%      zo = zone_origin	$i
      "${zo:='0	0	0'}"
%      zl = zone_length	$i
%      zw = zone_width	$i
%      zh = zone_height	$i
      "${zl}  ${zw}  ${zh}"
%      zor = zone_orientation	$i
      "${zor:='0'}"
      nsur=6
   elif test X${zsht} = Xreg
   then
      "c"
      "reg"
%      nsur = no_surfaces	$i
      nw=` expr $nsur - 2 `
      "${nw:=0}"
%      f_ch = zone_height	$i
      "${f_ch}"
%      angrot = zone_orientation	$i
      "${angrot:=0}"
      forall j upto ${nw}
      do
         jj=' expr $j + $j '
%         xyz = vertex	$i	$jj
         set `echo $xyz`
         "$1 $2"
      done
   elif test X${zsht} = Xgen
   then
      "c"
      "gen"
%      nver = no_vertices	$i
      "${nver:=0}"
%      nsur = no_surfaces	$i
      "${nsur:=0}"
%      angrot = zone_orientation	$i
      "${angrot:=0}"

      forall j upto ${nver}
      do
%         xyz = vertex	$i	$j
         "${xyz}"
      done

      forall j upto ${nsur}
      do
%         ver_order = surface	$i	$j
         set `echo $ver_order`
         "$# ${ver_listr}"
      done
   fi

   total_no_wins=0
   no_windows=
   forall j upto ${nsur}
   do
%     no_win = no_windows	$i	$j
      total_no_wins=` expr $total_no_wins + 0${no_win:=0} `
      no_windows="$no_windows ${no_win:=0}"
   done
   "$no_windows"
   if test 0${total_no_wins} -gt 0
   then
      forall j upto ${nsur}
      do
%        no_win = no_windows	$i	$j
         if test 0${no_win} -gt 0
         then
            forall k upto ${no_win}
            do
%              win_xzdxdz = window	$i	$j	$k
               "${win_xzdxdz}"
            done
         fi
      done
   fi
   total_no_doors=0
   no_doors=
   forall j upto ${nsur}
   do
%     no_dr = no_doors	$i	$j
      total_no_doors=` expr $total_no_doors + ${no_dr:=0} `
      no_doors="$no_doors ${no_dr:=0}"
   done
   "$no_doors"
   if test 0${total_no_doors} -gt 0
   then
      forall j upto ${nsur}
      do
%        no_dr = no_doors	$i	$j
         if test 0${no_dr} -gt 0
         then
            forall k upto ${no_dr}
            do
%               door_xzdxdz = door	$i	$j	$k
               "${door_xzdxdz}"
            done
         fi
      done
   fi
%   insolation_data = zone	$i	insolation_data
   if [ X${insolation_data} = X ]
   then
      "ife_z$i.shd"
   else
      "${insolation_data}"
   fi
   "ife_z$i.geo"
   "-"
done
"-"
"f"
"EOI"
