!   TITLE:  tv_creat_lines.mac (SM_TOOL)
!
!
!   TOOLBAR VERSION
!
!   This sub-macro creates lines between newly created keypoints.  The
!   lines may be created in a loop, or in sequence from lowest to high-
!   est keypoint values. This command is preceeded and followed by
!   the command INIT_ENTITY_NUM. Therefore, it may be used directly
!   after the keypoint commands (k,,XX,YY,ZZ); and directly before all
!   other commands. The retrieval of the maximum entities before and
!   after the lines are created is built in.
!
!   When creating lines, be sure that the proper coordinate system is
!   active; i.e., if arced lines are desired, then the active coordinate
!   system must be a cylindrical coordinate system; if spherical lines
!   are desired, then the active c.s. must be a spherical c.s.; etc.
!
!   The input data necessary to run this macro:
!
!       c_acs = boolean operator to create lines in active coordinate
!           system:
!
!           0 (or blank) = creates straight lines between KP's,
!                      regardless of active c.s.
!
!           1 = creates lines in active c.s.
!
!       seqnce = boolean operator to create lines in a closed loop,
!            or lines in sequence from lowest to highest keypoint
!            order.
!
!           0 (or blank) = creates lines between KP's, forming a
!                      closed loop.
!
!           1 = creates lines between keypoints in sequence, but
!               not forming a closed loop.
!
!   Therefore, if straight lines in a closed loop is the desired objective,
!   no arguments need to be specified.  Only the macro title needs specified.
!
!
!
! TV_CREATE_LINES, c_acs, seqnce
!
!
*get,prkey_,active,0,prkey
/nopr

init_entity_num
!
*ask,cacs_,straight(0) or active cs(1),0
*ask,seqnce_,close loop(0) or sequence(1),0
!
newkps_=km-km_prev      ! number of new keypoints
!
*if,seqnce_,eq,0,then
    *if,cacs_,eq,0,then
        *do,iii_,1,newkps_,1
            *if,iii_,ne,newkps_,then
                lstr,km-(newkps_-iii_),km-(newkps_-iii_-1)
            *else
                lstr,km,km-(newkps_-1)
            *endif
        *enddo
    *endif
    !
    *if,cacs_,eq,1,then
        *do,iii_,1,newkps_,1
            *if,iii_,ne,newkps_,then
                l,km-(newkps_-iii_),km-(newkps_-iii_-1)
            *else
                l,km,km-(newkps_-1)
            *endif
        *enddo
    *endif
*endif
!
!
*if,seqnce_,eq,1,then
    *if,cacs_,eq,0,then
        *do,iii_,1,newkps_-1,1
            lstr,km-(newkps_-iii_),km-(newkps_-iii_-1)
        *enddo
    *endif
    !
    *if,cacs_,eq,1,then
        *do,iii_,1,newkps_-1,1
            l,km-(newkps_-iii_),km-(newkps_-iii_-1)
        *enddo
    *endif
*endif
!
init_entity_num
!
*set,iii_,
*set,newkps_,
*set,seqnce_,
*set,cacs_,
!
abbres,new,tools,mac

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