!   TITLE:  tv_norm_cut_pln_ct.mac (MANAGEMENT)
!
!
!   TOOLBAR  VERSION
!
!   This sub-macro creates a cutting plane for partitioning volumes.
!   The cutting plane must be created in a CARTESIAN coordinate system.
!   The orientation of the cutting plane is normal to the specified
!   coordinate direction. The size of the cutting plane is determined by
!   the maximum line length in the the model.
!
!
!       cdir = coordinate direction that the cutting plane is perpen-
!              dicular to. This designates the orientation of the plane
!              a such that it is a speified distance from the origin of
!              the specified coordinate system. The coordinate direction
!              designations are 'x', 'y' and 'z' for cartesian; and 'x',
!              'y' and 'z' for r, theta and z coordinates in cylindrical
!              coordinates.
!
!       cd = The distance along the coordinate direction from the origin
!            of the coordinate system to the cutting plane surface,
!            measured along the coordinate direction as specified in
!            'cdir'.
!
!
!
! NORM_CUT_PLN_CT, cdir, cd
!
!
!
*get,prkey_,active,0,prkey
/nopr

*ask,_cdir,Normal Coordinate Direction,'x'
*ask,_cd,Normal Distance,0
!
cm,_vset1,volu
!
init_entity_num
!
max_enty_dim,'l'
_lpln=10*max_leng       ! cutting plane length
!
*if,_lpln,ne,0,then
    *if,_cdir,eq,'x',then
        !
        k,,_cd,-_lpln,_lpln
        k,,_cd,-_lpln,-_lpln
        k,,_cd,_lpln,-_lpln
        k,,_cd,_lpln,_lpln
        !
        create_area
        !
    *elseif,_cdir,eq,'y',then
        !
        k,,_lpln,_cd,_lpln
        k,,_lpln,_cd,-_lpln
        k,,-_lpln,_cd,-_lpln
        k,,-_lpln,_cd,_lpln
        !
        create_area
        !
    *elseif,_cdir,eq,'z',then
        !
        k,,-_lpln,-_lpln,_cd
        k,,_lpln,-_lpln,_cd
        k,,_lpln,_lpln,_cd
        k,,-_lpln,_lpln,_cd
        !
        create_area
        !
    *endif
    !
    vsel,s,volu,,_vset1
    !
    vol_part_area,am
    !
    init_entity_num
    !
    cmdele,_vset1
*endif
!
*set,_lpln,
*set,_cd,
*set,_cdir,
!
abbres,new,tools,mac

*if,prkey_,eq,1,then
    /go
*endif