/out
/gopr
*msg,info
 stitch6 macro 11/25/95
/out,_stit6,out
! STITCH6.MAC
!STITCHES THE ROTOR AND STATOR TOGETHER
!   original from JTJacobs   7/94
!   allow the rotor to be moved in the -angular direction  11/95 
!
!    Assumes rotor is in "ROTOR" and stator is in "STATOR"
!       air elements in gap on rotor side  :    REAL=5, MAT=1
!       air elements in gap on stator side :    REAL=6, MAT=1
!
immed
csys,1
cmsel,,stator
esel,r,mat,,1                  !    10/31/94
esel,r,real,,6                 !    10/31/94
nsle
*get,_stthmx,node,,mxloc,y
*get,_stthmn,node,,mnloc,y
*get,_strdmn,node,,mnloc,x
*get,_strdmx,node,,mxloc,x
_strtol=(_strdmx-_strdmn)/100
cmsel,,rotor
esel,r,real,,5                 !    10/31/94
nsle                           !    10/31/94
*get,_rtthmx,node,,mxloc,y
*get,_rtthmn,node,,mnloc,y
*get,_rdrmx,node,,mxloc,x
*get,_rdrmn,node,,mnloc,x
_rdtol=(_rdrmx-_rdrmn)/1000      !    10/31/94

_ohnang=_stthmx-_rtthmx
_perang=_stthmx-_stthmn

_t_bsgn=1
*if,_ohnang,gt,0,then
 _t_bsgn=-1
*endif


cmsel,,rotor
nsel,r,ext   !  7/19/97
nsel,r,loc,x,_rdrmx-_rdtol,_rdrmx+_rdtol
cm,_cerotor,node
!   nsel,r,loc,y,_stthmx-.00001,_rtthmx+.01         !  11/03/94
*if,_t_bsgn,eq,1,then
 nsel,r,loc,y,_stthmx+.0000001,_rtthmx+.01         !  11/10/94
*else
 nsel,r,loc,y,_stthmn+.0000001,_rtthmn-.01         !  11/10/94
*endif
csys,1
cm,_ohn,node
shpp,off
ngen,2,,all,,,0,-_perang*_t_bsgn
cmsel,,stator
nsel,r,ext   !  7/19/97
nsel,r,loc,x,_strdmn-.01,_strdmn+_strtol
esln
nsle
cm,_cestfr,node
*get,_elmx,elem,,num,max
*get,_curreal,elem,_elmx,attr,real
cmsel,,stator
esel,r,real,,_curreal
cmsel,,_cerotor
cmsel,a,_cestfr
cedel,all,,,any
numc,ce
cmsel,,_cerotor
esel,r,real,,_curreal
ceintf,.1
cmsel,,_ohn
csys,1
ngen,2,,all,,,0,_perang*_t_bsgn
/pbc,ce,1
alls
/gopr
/out,_mvrotor,out,,append