Try this function. It will be return a list of part text string if you want (I hope).
*** ADD Add command GPT
Code:;;Get Part Text (defun C:GPT ( / file ret count) (if (and (setq ret (get-part-text)) (setq file (open (strcat "F:\\ENGINEER\\GENERIC\\Label Schedule\\Extracted Labels\\Ferrule_" (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname"))4)) ".txt") "a")) ) (progn (mapcar '(lambda(x)(write-line x file)) ret) (close file) (princ "\nWritting ") (princ (length ret)) (princ " text string to file") ) ) (princ) ) (defun get-part-text ( / ss lst item lst1 lst2 ret) (vl-load-com) ;;;Usage (get-part-text) (defun str-str-lst (str pat / i) (cond ((= str "") nil) ((setq i (vl-string-search pat str)) (cons (substr str 1 i) (str-str-lst (substr str (+ (strlen pat) 1 i)) pat) ) ;_ cons ) (t (list str)) ) ;_ cond ) (if (setq ss (ssget "_X" (list(cons 0 "TEXT")(cons 410 (getvar "CTAB"))))) (progn (repeat (setq item (sslength ss)) ;_ end setq (setq lst (cons (cdr(assoc 1(entget(ssname ss (setq item (1- item)))))) lst)) ) (foreach txt lst (setq lst1 (str-str-lst txt " ")) (foreach part-txt lst1 (setq lst2 (str-str-lst part-txt "/")) (if (and (> (length lst2) 1) (wcmatch (nth 1 lst2) "*mm") ) (setq ret (cons (nth 0 lst2) ret)) ) ) ) ) ) ret )




Reply With Quote

i.e. 
Bookmarks