/out,pl_wnd,out
/com,pl_wnd.mac  3/12/99  b
!  Plots the winding to the file w_plot.f33 based on the
!  winding currently generated.
!  A plot is generated for each coil in the current winding file
!
/anno,dele
cmsel,,s_coil
nsle
csys
/reset
/pbf,js,1
*get,_xmax,node,,mxloc,x
/focus,1,-.01
_dist=abs(1.22*_xmax)
/dist,1,_dist
! /tspec,0,1,1,0,0
*set,_tlab
*dim,_tlab,,_n_slot,4
*afun,deg
*vfill,_tlab(1,3),ramp,1,1
_stang=180/_n_slot
_delt=360/_n_slot
_grfac=.9
*vfill,_tlab(1,4),ramp,_stang,_delt
*vfunc,_tlab(1,1),cos,_tlab(1,4)
*vfunc,_tlab(1,2),sin,_tlab(1,4)
*voper,_tlab(1,1),_tlab(1,1),mult,_grfac
*voper,_tlab(1,2),_tlab(1,2),mult,_grfac
/nopr
/out,_tlabc,mac
*vwrit,_tlab(1,1),_tlab(1,2),_tlab(1,3)
('/tlab,',f6.3,',',f6.3,',',f4.0)
/out,pl_wnd,out,,append
/gopr
_tlabc

/sho,w_plot,f33  ! 
cmsel,,s_coil
nsle
*do,_iw1,1,_n_slot  !  _iw1 = ith line in the winding file
  !*do,_iw1,1,2  
  /gopr
  *msg,info,_iw1
  cycle in _IW1: %i
  _out=cwnd_(_iw1,1)
  _in=cwnd_(_iw1,2)
  cmsel,,%_out%
  bfe,all,js,3,1
  cmsel,,%_in%
  bfe,all,js,3,-1
  cmsel,a,%_out%
  /pbf,js,1
  /eras
  _1=wnd_(_iw1,1)
  _2=wnd_(_iw1,2)
  _3=wnd_(_iw1,3)
  _4=wnd_(_iw1,4)
  /title,Phase: %_4% Coil %_iw1%  Out-slot: %_1%  In-slot: %_2%
  eplo
  /noer
  nplo
*enddo
/eras
/pbf,js
/sho,xxx
/sho,term
/out