!   TITLE:  create_rectangle.mac (SM_TOOL)
!
!
!   OBJECTIVE:
!
!   This sub-macro creates a planar, filleted or unfilleted, rectangle.
!
!
!   COMMAND SYNTAX:
!
!                         (1)   (2)   (3)   (4)   (5)   (6)    (7)     (8)
!       CREATE_RECTANGLE, acs, x_V1, x_V2, y_H1, y_H2, z_loc, area_?, filtr
!
!
!   ARGUMENTS:
!
!       (1) acs = the active coordinate system (CS) to build rectangle in.
!                 May be any CS type (i.e., crtesian, cylindrical, etc.)
!
!       (2) x_V1 = the X-coordinate of one vertical edge of the rectangle.
!
!       (3) x_V2 = the X-coordinate of the 2nd horizontal edge of the
!                  rectangle.
!
!       (4) y_H1 = the Y-coordinate of one horizontal edge of the rectangle.
!
!       (5) y_H2 = the Y-coordinate of the 2nd horizontal edge of the
!                  rectangle.
!
!       (6) z_loc = the Z -coordinate location of the plane of the rectangle.
!                   (This plane is parallel to the XY-plane of the active CS)
!
!       (7) area_? = boolean to determine if the rectangle is to be lines or
!                    an area:
!
!               0 = form rectangle from lines only.
!
!               1 = form rectangle as an area.
!
!       (8) filtr = fillet radius of the rectangle corners:
!
!               0 (or blank) = form rectangle WITHOUT fillets.
!
!               R = form rectangle WITH corner fillets of radius, R.
!                   (for R < 1/2 of the minimum edge length)
!
!   DESCRIPTION:
!
!   The rectangle is a planar figure constructed in a plane parallel to, or
!   coincident with, the XY-plane of the specified CS in argument 1. if Z_LOC
!   (argument 7) is 0 (or blank), then the rectangle is formed in the XY-plane
!   of the specified CS. Otherwise, any other numerical value is the Z coordinate
!   of the plane normal to the Z-axis.
!
!   The CS in argument 1 may be any type (i.e., cartesian, cylindrical, etc.).
!   The rectangle will be formed relative to the X and Y axes of that CS, with
!   the coordinate values of arguments 2 thru 6 as cartesian coordinates.
!
!   The convention of 'horizontal' and 'vertical' for the edges of the rectangle
!   are defined as follows:
!
!       a.) Horizontal - normal to the Y axis, and parallel to the X-axis.
!
!       b.) Vertical - normal to the X axis, and parallel to the Y-axis.
!
!   The rectangle may have filleted corners or straight right angles, as
!   controlled by argument 8.
!
!   To view a rectangle created from this macro, run the following example
!   line of code (must execute 'mod_assemb_prep' prior to running):
!
!                       CREATE_RECTANGLE,1,1,6,2,4,1,1,.5
!
!
!
*get,prkey_,active,0,prkey
/nopr
!
configuration,0
!
acs_=arg1
xv1_=arg2
xv2_=arg3
yh1_=arg4
yh2_=arg5
zloc_=arg6
aorl_=arg7
filtr_=arg8
!
csys,acs_
create_cs,0,,0,0,0,0,0,0,0
!
k,,xv1_,yh1_,zloc_
k,,xv2_,yh1_,zloc_
k,,xv2_,yh2_,zloc_
k,,xv1_,yh2_,zloc_
!
create_lines
!
lsel,s,line,,lm-3,lm
min_enty_dim,'l'
!
*if,filtr_,gt,0,then
    *if,filtr_,lt,min_leng/2,then
        ln_fillet_group,km-3,filtr_,km-2,filtr_,km-1,filtr_,km,filtr_
    *endif
*endif
!
*if,aorl_,eq,0,then
    configuration,1
    init_entity_num
    lplot
*elseif,aorl_,eq,1,then
    isolate_lines
    configuration,-1
    al,all
    configuration,1
    init_entity_num
    aplot
*else
    configuration,1
    init_entity_num
    lplot
*endif
!
*set,acs_,
*set,xv1_,
*set,xv2_,
*set,yh1_,
*set,yh2_,
*set,zloc_,
*set,aorl_,
*set,filtr_,
*set,min_leng,
*set,min_lnum,
!
*if,prkey_,eq,1,then
    /go
*endif