;; free lisp from cadviet.com
(defun c:Loctext(/ ss i ent content so ans snho slon skhoang socuctieu socucdai)
;copyright by TUE_NV
(setq ss (ssget '((0 . "TEXT"))) snho (ssadd) slon (ssadd) skhoang (ssadd))
(setq i 0)
(initget "L N K")
(setq ans (getkword
"\n chon so Nho hon N , Chon so Lon hon L , Chon so trong khoang K < N/L/K > : "))
(if (= ans "N")
(progn
(setq so (getreal "\n Nhap so nho hon : "))
(while (< i (sslength ss))
(setq ent (ssname ss i))
(if (and (setq content (distof(cdr(assoc 1 (entget ent))))) (< content so))
(setq snho (ssadd ent snho))
)
(setq i (1+ i))
);while
(sssetfirst snho snho)
);progn
);if
(setq i 0)
(if (= ans "L")
(progn
(setq so (getreal "\n Nhap so lon hon : "))
(while (< i (sslength ss))
(setq ent (ssname ss i))
(if (and (setq content (distof(cdr(assoc 1 (entget ent))))) (> content so))
(setq slon (ssadd ent slon))
)
(setq i (1+ i))
);while
(sssetfirst slon slon)
);progn
);if
(setq i 0)
(if (= ans "K")
(progn
(setq socuctieu (getreal "\n Nhap so cuc tieu MIN : "))
(setq socucdai (getreal "\n Nhap so cuc dai MAX: "))
(while (< i (sslength ss))
(setq ent (ssname ss i))
(if (and (setq content (distof(cdr(assoc 1 (entget ent)))))
(> content socuctieu)
(< content socucdai))
(setq skhoang (ssadd ent skhoang))
)
(setq i (1+ i))
);while
(sssetfirst skhoang skhoang)
))
(princ)
)