!   TITLE:  msh_contact_surf.mac (MESH)
!
!
!   OBJECTIVE:
!
!   This sub-macro creates the contact surface mesh on a selected set of
!   (surface) nodes.
!
!
!   COMMAND SYNTAX:
!
!                           (1)     (2)
!       MSH_CONTACT_SURF, 'n_set', etype
!
!
!   ARGUMENTS:
!
!       (1) n_set = the component group name of the surface of nodes to
!                   overlay the contact/target elements on.
!                   [ If left blank, the selected set of nodes are used ]
!
!       (2) etype = contact/element type number to mesh on nodal surface.
!
!           (This is the type number, N, used in the ANSYS command: TYPE,N)
!
!
!   DESCRIPTION:
!
!   The contact surface mesh is overlayed on the element face coincident
!   with the selected nodes. Applicable surface contact element types:
!
!               173 = CONTA173 (3D 4-node quad, surface-to-surface)
!               174 = CONTA174 (3D 8-node quad, surface-to-surface)
!               170 = TARGE170 (3D 8-node quad, target-surface)
!
!
!
*get,prkey_,active,0,prkey
/nopr
!
ndset__=arg1
eltyp__=arg2
!
! Parameter type: 0=scalar, 1=array, 2=table, 3=character scalar,
!                 4=character array, -1=undefined
!
*get,argtyp_,parm,ndset__,type
!
*if,argtyp_,eq,0,then
    *if,ndset__,eq,0,then
        ndset__='cndset__'
        cm,%ndset__%,node
    *endif
*elseif,argtyp_,eq,3,then
    cmsel,s,%ndset__%
*endif
!
cmsel,s,%ndset__%
esln,s,0
!
type,eltyp__
esurf
!
esel,s,type,,eltyp__
nsle,s
cmsel,r,%ndset__%
esln,u,1
edele,all
!
init_entity_num
!
eplot
!
cmdele,cndset__
*set,ndset__,
*set,eltyp__,
!
*if,prkey_,eq,1,then
    /go
*endif