rcb007 Posted May 5, 2021 Share Posted May 5, 2021 I found this routine which will select all similar mtexts and texts within a drawing at one time. I am trying to figure out how to change it from selecting all objects within the drawing, to where the user would select a text, then it would highlight select all in the drawing. Any help would be great. (defun c:simtxt (/ lst Hltext text i) (if (setq lst nil HlText (ssadd) text (ssget "_x" (list '(0 . "MTEXT,TEXT") '(-4 . "<NOT") '(1 . "") '(-4 . "NOT>") (cons 410 (Getvar 'ctab)) ) ) ) (progn (repeat (setq i (sslength text)) (if (setq f (Assoc (setq str (cdr (Assoc 1 (entget (setq e (ssname text (setq i (1- i))))) ) ) ) Lst ) ) (progn (ssadd e HlText) (if (not (ssmemb (cadr f) HlText)) (ssadd (cadr f) HlText) ) ) (setq lst (cons (list str (ssname text i)) lst)) ) ) (sssetfirst nil HlText) ) ) (princ)) thank you. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted May 5, 2021 Share Posted May 5, 2021 Hi, Be mindful is that the formatted Mtexts are not considered with this routine. (defun c:Test (/ int sel ent str) ;; Tharwat - Date: 5.May.2021 ;; ;; Select similar text contents based on selection. ;; (and (princ "\nSelect texts to select all similar text contents : ") (setq str "" int -1 sel (ssget '((0 . "*TEXT"))) ) (while (setq int (1+ int) ent (ssname sel int)) (setq str (strcat str (cdr (assoc 1 (entget ent))) ",")) ) (sssetfirst nil (ssget "_x" (list '(0 . "*TEXT") (cons 1 str) (cons 410 (getvar 'ctab))))) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
mhupp Posted May 5, 2021 Share Posted May 5, 2021 (edited) Removing the "_X" will do the trick more here (defun c:simtxt (/ lst Hltext text i) (if (setq lst nil HlText (ssadd) text (ssget (list '(0 . "*TEXT") ;this should do the same as '(0 . "MTEXT,TEXT") '(-4 . "<NOT") '(1 . "") '(-4 . "NOT>") (cons 410 (Getvar 'ctab)) ) ) ) (progn (repeat (setq i (sslength text)) (if (setq f (Assoc (setq str (cdr (Assoc 1 (entget (setq e (ssname text (setq i (1- i))))) ) ) ) Lst ) ) (progn (ssadd e HlText) (if (not (ssmemb (cadr f) HlText)) (ssadd (cadr f) HlText) ) ) (setq lst (cons (list str (ssname text i)) lst)) ) ) (sssetfirst nil HlText) ) ) (princ)) Edited May 5, 2021 by mhupp Quote Link to comment Share on other sites More sharing options...
rcb007 Posted May 5, 2021 Author Share Posted May 5, 2021 Thank you Tharwat! Thats what i was trying to get it to do! Quote Link to comment Share on other sites More sharing options...
Tharwat Posted May 5, 2021 Share Posted May 5, 2021 You're welcome. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.