!   TITLE:  ln_series.mac (SM_TOOL)
!
!
!   OBJECTIVE:
!
!   This sub-macro creates a series of disconnected lines between pairs of
!   newly created keypoints.
!
!
!   COMMAND SYNTAX:
!
!       LN_SERIES, c_acs
!
!
!   ARGUMENTS:
!
!       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.
!
!
!   DESCRIPTION:
!
!   This macro connects each pair of newly created keypoints by a single line.
!   Therefore, this command runs successfully only if the number of new key-
!   points is an even number. This generates a series of new lines, all dis-
!   connected, between each pair of keypoints in sequence.
!
!   The lines may be created as straight lines or lines in the active C.S.
!   The retrieval of the maximum entities before and after the lines are
!   created is built in. Therefore, when choosing argument 1 as 1, 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 C.S.;
!   if spherical lines are desired, then the active c.s. must be a spherical
!   C.S.; etc. If straight lines in a closed loop is the desired objective,
!   no arguments need to be specified. Only the macro title needs specified.
!
!
!
*get,prkey_,active,0,prkey
/nopr
!
cacs_=arg1
!
init_entity_num
!
lcntr_=0
!
*if,cacs_,eq,0,then
    *do,iii_,km_prev+1,km,2
        lstr,iii_,iii_+1
        lcntr_=lcntr_+1
    *enddo
*elseif,cacs_,eq,1,then
    *do,iii_,km_prev+1,km,2
        l,iii_,iii_+1
        lcntr_=lcntr_+1
    *enddo
*endif
!
init_entity_num
lsel,s,line,,lm-(lcntr_-1),lm
cm,new_lns,line
init_entity_num
!
lplot
!
*set,iii_,
*set,cacs_,
*set,lcntr_,
!
*if,prkey_,eq,1,then
    /go
*endif