Thanks for the Response BIGAL and GLAVCVS
the Below Code seemed to work i am ok with this.
(defun c:DrawBoundary (/ ss ent pts pline)
;; Prompt user to select lines or polylines
(setq ss (ssget '((0 . "LINE,LWPOLYLINE"))))
(if ss
(progn
;; Collect all vertices from selected entities
(setq pts '())
(foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
(setq pts (append pts...