Hi Dan
To help to understand, I've attached some comments...;
; -- Function MeExtEntSel
; Extended (entsel) function.
; Arguments [Typ]:
; Pmt = Prompt [STR]
; eg. "\nSelect Arc or Circle: "
; Lst = Entity filter list (uppercase) [LIST]
; eg. '("ARC" "CIRCLE")
; Return [Typ]:
; > List of (ENAME '(PickPoint)) [LIST]
; > nil if user press enter/space key
; Notes:
; None
;
(defun MeExtEntSel (Pmt Lst / CurEnt ExLoop TmpStr)
;while not exit loop...
(while (not ExLoop)
;allow enter/space key
(initget " ")
;select entity
(setq CurEnt (entsel Pmt))
(cond
;case enter/space key... exit loop & set return to nil
((= CurEnt "") (setq ExLoop T CurEnt nil))
;case entity...
(CurEnt
(if (member (cdr (assoc 0 (entget (car CurEnt)))) Lst)
;if entity name in filter list exit loop
(setq ExLoop T)
;else build and show error message
(progn
(setq TmpStr (apply 'strcat
(cons
(car Lst)
(mapcar
'(lambda (l)
(strcat " or " l)
) (cdr Lst)
)
)
)
)
(princ (strcat "selected entity is not a " TmpStr ". "))
)
)
)
;case nothing selected... show message
((princ "1 selected, 0 found"))
)
)
;return entsel list (or nil)
CurEnt
)