!   TITLE:  oval_area.mac (SM_TOOL)
!
!
!   OBJECTIVE:
!
!   This sub-macro creates an oval shaped area.
!
!
!   COMMAND SYNTAX:
!
!                   (1) (2)    (3)     (4)
!        OVAL_AREA, cs, wid, ov_leng, z_loc
!
!
!   ARGUMENTS:
!
!       (1) cs = coordinate system to build area relative to.
!
!       (2) wid = the width of the oval.
!
!       (3) ov_leng = the over-all length of the oval.
!
!       (4) z_loc = location of the plane of the area along the Z axis
!                   of the coordinate system specified in argument 1.
!
!
!   DESCRIPTION:
!
!   The oval is created relative to a coordinate system specified in argument
!   1. This coordinate system aligns itself with the mid-point of the straight
!   edge with the positive Y-axis pointing toward the centroid of the area. The
!   plane of the area is located along the Z axis of the specified C.S. by arg-
!   ument 4. This default value is 0 (i.e., the plane of the area is the XY
!   plane of the specified C.S.).
!
!   The width of the oval is the diameter of the semi-circular ends of the
!   area; and the over-all length is the length of the rectangular mid-sec-
!   tion of the area plus the diameter of the semi-circular ends.
!
!
!
!
*get,prkey_,active,0,prkey
/nopr

cs_=arg1
wid_=arg2
ovl_=arg3
zloc_=arg4
!
*get,acs_,active,,csys
!
csys,cs_
!
*get,cstyp_,cdsy,cs_,attr,kcs
!
*if,cstyp_,ne,0,then
    create_cs,0,,0,0,0,0,0,0,0
    cs_=csn+1
    csys,cs_
*endif
!
k,,(ovl_/2)-(wid_/2),0,zloc2_
k,,(ovl_/2)-(wid_/2),wid_,zloc2_
k,,-((ovl_/2)-(wid_/2)),wid_,zloc2_
k,,-((ovl_/2)-(wid_/2)),0,zloc2_
!
create_area
!
clocal,csn+10,0,(ovl_/2)-(wid_/2),wid_/2,0,0,0,0
clocal,csn+11,1,0,0,0,0,0,0
!
*do,abc_,0,270,90
    k,,wid_/2,abc_,zloc_
*enddo
!
create_area,1
!
csys,csn+10
clocal,csn+12,0,-(ovl_-wid_),0,0,0,0,0
clocal,csn+13,1,0,0,0,0,0,0
!
*do,abc_,0,270,90
    k,,wid_/2,abc_,zloc_
*enddo
!
create_area,1
!
aadd,am-2,am-1,am
!
init_entity_num
!
csdele,csn+10,csn+13,1
csys,acs_
!
lplot
!
*set,acs_,
*set,cs_,
*set,wid_,
*set,ovl_,
*set,zloc2_,

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