!   TITLE:  create_rect_pos.mac (SM_TOOL)
!
!
!   OBJECTIVE:
!
!   This sub-macro creates a planar, filleted or unfilleted, rectangle by
!   its position and dimensions.
!
!
!   COMMAND SYNTAX:
!
!                        (1)    (2)     (3)     (4)     (5)   (6)  (7)
!       CREATE_RECT_POS, acs, 'x_edg', x_val, 'y_edg', y_val, wid, hght,
!
!                        z_loc, filtr
!                         (8)    (9)
!
!
!   ARGUMENTS:
!
!       (1) acs = the active coordinate system (CS) to build rectangle in.
!                 May be any CS type (i.e., crtesian, cylindrical, etc.)
!
!       (2) x_edge = the vertical edge type for positioning rectangle:
!                    [ must be in single quotes ]
!
!                   'lx' = lower X value (left) vertical edge.
!
!                   'hx' = higher X value (right) vertical edge.
!
!                   'cx' = X position of rectangle centroid.
!
!       (3) x_val = X-coordinate of the specified vertical edge/centroid.
!                   (corresponding to the edge/center position specified
!                    in argument 2)
!
!       (4) y_edge = the Y-coordinate of one horizontal edge of the rectangle.
!                    [ must be in single quotes ]
!
!                   'ly' = lower Y value (bottom) horizontal edge.
!
!                   'hy' = higher Y value (top) horizontal edge.
!
!                   'cy' = Y position of rectangle centroid.
!
!       (5) y_val = Y-coordinate of one specified horizontal edge/centroid.
!                   (corresponding to the edge/center position specified
!                    in argument 4)
!
!       (6) wid = the width (X extent) of the rectangle.
!
!       (7) hght = the height (Y extent) of the rectangle.
!
!       (8) z_loc = the Z -coordinate location of the plane of the rectangle.
!                   (This plane parallel to the XY-plane of the specified CS)
!
!       (9) 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.
!
!   The conventions of arguments 2 and 4 specify the method of how to position
!   the rectangle in the X and Y positions, respectively. The value of the X
!   and Y coordinates specified in arguments 3 and 5 correspond to the methods
!   of arguments 2 and 4, respectively Therefore, if arguments 2 and 3 are:
!
!           'hx',3.00 = the higher (right-most) X vertical edge is
!                       located at 3.00.
!
!   To view a rectangle created from this macro, run the following example
!   lines of code (must execute 'mod_assemb_prep' prior to running):
!
!                   CREATE_RECT_POS,0,'lx',0,'ly',0,2,6,0,0
!
!                   CREATE_RECT_POS,1,'hx',0,'hy',0,2,6,1,0.25
!
!                   CREATE_RECT_POS,0,'cx',0,'cy',0,2,6,2,0.5
!
!                   CREATE_RECT_POS,1,'lx',0,'hy',0,2,6,-1,0
!
!                   CREATE_RECT_POS,2,'hx',0,'ly',0,2,6,0,0
!
!
!
*get,prkey_,active,0,prkey
/nopr
!
acs__=arg1
xedge_=arg2
xval_=arg3
yedge_=arg4
yval_=arg5
width_=arg6
height_=arg7
zloc__=arg8
filtr__=arg9
!
*if,xedge_,eq,'lx',then
    xv1__=xval_
    xv2__=xval_+width_
*elseif,xedge_,eq,'hx',then
    xv1__=xval_-width_
    xv2__=xval_
*elseif,xedge_,eq,'cx',then
    xv1__=xval_-(width_/2)
    xv2__=xval_+(width_/2)
*endif
!
*if,yedge_,eq,'ly',then
    yh1__=yval_
    yh2__=yval_+height_
*elseif,yedge_,eq,'hy',then
    yh1__=yval_-height_
    yh2__=yval_
*elseif,yedge_,eq,'cy',then
    yh1__=yval_-(height_/2)
    yh2__=yval_+(height_/2)
*endif
!
!
!                         (1)   (2)   (3)   (4)   (5)   (6)    (7)     (8)
!       CREATE_RECTANGLE, acs, x_V1, x_V2, y_H1, y_H2, z_loc, area_?, filtr
!
!
create_rectangle,acs__,xv1__,xv2__,yh1__,yh2__,zloc__,1,filtr__
!
*set,acs__,
*set,xedge_,
*set,xval_,
*set,yedge_,
*set,yval_,
*set,width_,
*set,height_,
*set,zloc__,
*set,filtr__,
*set,xv1__,
*set,xv2__,
*set,yh1__,
*set,yh2__,
!
*if,prkey_,eq,1,then
    /go
*endif