!   TITLE:  revolve_lset.mac (SM_TOOL)
!
!
!   OBJECTIVE:
!
!   This sub-macro revolves a selected set of lines around an axis defined by
!   2 keypoints, or an axis defined by the Z axis of a specified coordinate
!   system.
!
!
!   COMMAND SYNTAX:
!
!       -- OPTION 1:
!
!                             (1)   (2)    (3)     (4)
!               REVOLVE_LSET, axp1, axp2, revang, numseg
!
!
!       -- OPTION 2:
!
!                              (1)    (2)     (3)
!               REVOLVE_LSET, csnum, revang, numseg
!
!
!   ARGUMENTS:
!
!       -- OPTION 1:
!
!           (1) axp1 = 1st axis point of revolution
!
!           (2) axp2 = 2nd axis point of revolution
!
!           (3) revang = total angle of revolution of selected lines
!
!           (4) numseg = number of area segments in the revolve angle (revang)
!
!
!       -- OPTION 2:
!
!           (1) cs = coordinate system whose Z axis is the axis of revolution.
!                    This C.S. may be a cartesian or cylindrical C.S.
!
!           (2) revang = total angle of revolution of selected lines
!
!           (3) numseg = number of area segments in the revolve angle (revang)
!
!
!   DESCRIPTION:
!
!   -- OPTION 1:
!
!   The selected set of areas are revolved about an axis defined by 2 keypoints,
!   AXP1 and AXP2. The total angle of revolve is defined by REVANG; and the
!   number of volume segments in the revolve are specified by NUMSEG.
!
!
!   -- OPTION 2:
!
!   The selected set of areas are revolved about the Z axis of a specified co-
!   ordinate system. The total angle of revolve is defined by REVANG; and the
!   number of volume segments in the revolve are specified by NUMSEG. The rot-
!   ation direction is consistent with the vector definition of the right-hand
!   rule, with positive rotations counter-clockwise about the positive Z axis.
!
!   -- GENERAL:
!
!   Either option is exercised by the algorithm automatically. When the 4th
!   argument is used, i.e., the total number of revolve volumes is greater
!   than or equal to 1, then option 1 is used. When the 4th argument is left
!   blank, option 2 is used.
!
!
!
!
*get,prkey_,active,0,prkey
/nopr
!
numseg_=arg4
!
*get,llow_,line,,num,min
*get,lhigh_,line,,num,max
!
*if,numseg_,ge,1,then
    axp1_=arg1
    axp2_=arg2
    revang_=arg3
    !
    *do,iiii_,llow_,lhigh_,1
        *if,lsel(iiii_),ne,0,then
            arotat,iiii_,,,,,,axp1_,axp2_,revang_,numseg_
        *endif
    *enddo
*else
    csnum_=arg1
    revang_=arg2
    numseg_=arg3
    !
    *get,actcs_,active,,csys
    !
    csys,csnum_
    !
    *get,cstyp_,cdsy,csnum_,attr,kcs
    !
    *if,cstyp_,ne,0,then
        create_cs,0,,0,0,0,0,0,0,0
        csnum_=csn+1
    *endif
    !
    k,,0,0,0
    k,,0,0,1
    !
    get_max_entity
    !
    axp1_=km-1
    axp2_=km
    !
    *do,iiii_,llow_,lhigh_,1
        *if,lsel(iiii_),ne,0,then
            arotat,iiii_,,,,,,axp1_,axp2_,revang_,numseg_
        *endif
    *enddo
    !
    kdele,axp1_,axp2_,1
    !
    csys,actcs_
    !
    *set,csnum_,
    *set,actcs_,
    *set,cstyp_,
*endif
!
init_entity_num
!
lplot
!
*set,iiii_,
*set,axp1_,
*set,axp2_,
*set,revang_,
*set,numseg_,
*set,llow_,
*set,lhigh_,
!
*if,prkey_,eq,1,then
    /go
*endif