Welcome the CADTutor Badeas
This is eerily similar to what i just posted at another forum
(defun c:ShowMe (/ strnum _outside-p text ss Pline Txtinside i e entdata spc)(defun strnum (var val str / p) (setq p str) (repeat (- val (strlen var)) (setq p (strcat str p))) (strcat var p)) (defun _outside-p (pt ent / YoRay len);;; pBeFeb20014 ;;;;;; http://en.wikipedia.org/wiki/Point_in_polygon ;;;;;; even-odd rule ;;; (setq YoRay (entmakex (list '(0 . "RAY") '(100 . "AcDbEntity") '(100 . "AcDbRay") (cons 10 pt) '(11 1.0 0.0 0.0) ) ) ) (setq len (/ (length (vlax-invoke (vlax-ename->vla-object YoRay) 'intersectwith ent acextendnone ) ) 3) ) (entdel YoRay) (zerop (rem len 2)) ) (if (setq text nil Pline nil Txtinside nil ss (ssget "_X" (list '(-4 . "") (cons 410 (getvar 'ctab)) ) ) ) (progn (repeat (setq i (sslength ss))(setq e (vlax-ename->vla-object (ssname ss (setq i (1- i)))))(if (eq "AcDbText" (vla-get-ObjectName e)) (setq text (cons (list e (vlax-get e 'InsertionPoint)) text)) (setq Pline (cons e Pline))) ) (foreach itm text(if (setq hit (vl-some '(lambda (pl) (if (not (_outside-p (Cadr itm) pl)) (list (car itm) pl) ) ) pline ) ) (setq Txtinside (cons hit Txtinside) )) ) (princ (strcat "\n" (strnum "Label" 20 "-")(strnum "Area" 20 "-") "Length")) (princ (strnum "\n" 48 "*")) (foreach tx Txtinside (princ (strcat "\n" (strnum (vla-get-textstring (Car tx)) 20 "-") (strnum (rtos (vla-get-area (cadr tx)) 2 2) 20 "-") (rtos (vla-get-length (cadr tx)))) ) ) ) )(princ))
This is [sTILL] just a demo. it shows the textstring DATA at the end of the routine