;;;Making selection set of LINES, LWPOLYLINES, ARCS, CIRCLES, SPLINES or ELLIPSES with specific length and angle
;;---------------=={ 3dwannab_Sel_Layer_Current.lsp }==-----------------;;
;; ;;
;; Selects LINES, LWPOLYLINES, ARCS, CIRCLES, SPLINES ;;
;; or ELLIPSES by exact length ;;
;;----------------------------------------------------------------------;;
;; Author: *Claypool, Jim ;;
;; Edit: 3dwannab
;; Edit: Igal Averbuh 2019 ;;
;;----------------------------------------------------------------------;;
;; Version 1.0 - 11-10-2002 - *Claypool, Jim ;;
;; Version 1.1 - 09-03-2017 - 3dwannab (First Edit) ;;
;; Version 1.11 - 09-03-2017 - 3dwannab (added SPLINE,ELLIPSE)
;; Version 1.12 - 13-06-2019 - Igal Aberbuh (added option for exact length) ;;
;;----------------------------------------------------------------------;;
;; Original: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-lines-shorter-than-specify-length/m-p/909791#M135449
;;----------------------------------------------------------------------;;

(defun c:QS( / ss1 ss2 cnt selcnt ename e len)

(vl-load-com)
(setq ss2 (ssadd))

(setq maxsize (getdist "\nEnter Exact length of LINES, LWPOLYLINES, ARCS, CIRCLES, SPLINES or ELLIPSES: "))
(setq ss1 (ssget "X" '((0 . "LINE,ARC,LWPOLYLINE,CIRCLE,SPLINE,ELLIPSE"))))

(setq cnt 0 selcnt 0)
(if ss1
(progn
(repeat (sslength ss1)
(setq

ename (ssname ss1 cnt)

e (vlax-ename->vla-object ename)
len
(vlax-curve-getdistAtParam e (vlax-curve-getEndParam e))

)
(if
(equal len
maxsize)
(progn

(ssadd ename ss2)

(setq selcnt (1+ selcnt))

)

)
(setq cnt (1+ cnt))
)
(princ (strcat "\nNew Selection " (itoa selcnt) " of " (itoa cnt) " selected LINES, LWPOLYLINES, ARCS, CIRCLES, SPLINES or ELLIPSES")) (princ)
(sssetfirst nil ss2)
)
)
)

;; End of FN ;;

(c:qs)