!   TITLE:  create_sphere.mac (SM_TOOL)
!
!
!       Updated macro to use CREATE_CIRC_AREA macro for line creation.
!
!   OBJECTIVE:
!
!   This sub-macro creates a solid spherical segment (or complete sphere).
!
!
!   COMMAND SYNTAX:
!
!                         (1)     (2)     (3)    (4)      (5)     (6)
!        CREATE_SPHERE, radius, ang_inc, n_arc, st_ang, revang, numseg
!
!
!   ARGUMENTS:
!
!
!       (1) radius = the radius of the circle
!
!       (2) ang_inc = angle subtended by arc(s). When specifying this
!                     parameter, the algorithm will create the circle
!                     with a series of arcs subtending an angle of
!                     'ANG_INC'. Therefore, the value of this parameter
!                     must be an integral divisor of 360; i.e., 3,4,5,6,
!                     8,9,10,12,....etc. When this parameter is desired,
!                     'N_ARC' must be left blank.
!
!       (3) n_arc = The number of equal arc increments that the circle
!                   is constructed from.  If this argument is specified,
!                   then 'ANG_INC' is over-ridden and the circle is
!                   created by this number of equal arcs.
!
!       (4) st_ang = The start angle of the first arc used in the
!                    construction of the circle.
!
!       (5) revang = total angle of revolution of half-circle (segment of
!                    a sphere).
!
!       (6) numseg = number of volume (spherical)segments in the revolve
!                    angle (revang).
!
!
!   DESCRIPTION:
!
!   This sub-macro creates a semi-circle area from a set of circular profile
!   lines using the CREATE_CIRC_AREA command argument structure. The circular
!   segment is created in the XY-plane along the +x-axis. The circle may be
!   created with various arc angle increments or number of arcs within given
!   start and finish angles.
!
!   The semi-circle may be revolved into a spherical segment or a complete
!   sphere. the revolve is started from the XY plane +X-axis, and revolves
!   counterclockwise, as looking down the +Y-axis (the Y axis is the axis of
!   revolve).
!
!   When arguments 2, 3, 4, 5 and 6 are left blank, the algorithm defaults to
!   a complete sphere of 4-90 degree volume segments.
!
!
!
*get,prkey_,active,0,prkey
/nopr
!
rad__=arg1
anginc__=arg2
narc__=arg3
stang__=arg4
revang__=arg5
numseg__=arg6
!
*get,ccs_,active,,csys
!
*get,ccstyp_,cdsy,ccs_,attr,kcs
!
*if,ccstyp_,ne,1,then
    clocal,csn+100,1,0,0,0,0,0,0
*endif
!
*if,revang__,eq,0,then
    revang__=360
*endif
!
*if,numseg__,eq,0,then
    numseg__=4
*endif
!
!
!                           (1)    (2)     (3)     (4)    (5)
!       CREATE_CIRC_AREA, radius, z_loc, ang_inc, n_arc, st_ang
!
create_circ_area,rad__,,anginc__,narc__,stang__
!
csys,csn+100
k,,1.1*rad__,90,0
k,,1.1*rad__,270,0
!
create_lines
!
asbl,am,lm,,delete,delete
init_entity_num
!
isolate_areas
asel,r,loc,x,0,rad__
asel,r,loc,y,90,270
asel,r,loc,z,0,0
adele,all,,,1
!
isolate_areas
asel,r,loc,x,0,rad__
asel,r,loc,y,-90,90
asel,r,loc,z,0,0
!
clocal,csn+101,0,0,0,0,0,0,0
clocal,csn+102,1,0,0,0,0,-90,0
!
revolve_aset,csn+52,revang__,numseg__
!
*if,ccstyp_,ne,1,then
    csdele,csn+100
    csdele,csn+101
    csdele,csn+102
*endif
!
csys,ccs_
!
!
*set,ii_
*set,rad__
*set,stang__
*set,finang_
*set,anginc__
*set,narc__
*set,ccs_
*set,ccstyp_
*set,ang_
*set,revang__
*set,numseg__
!
*if,prkey_,eq,1,then
    /go
*endif