Jump to content

Need a lisp that only finds and highlight duplicate words (numbers or text string)??


goldy2000

Recommended Posts

I have a drawing and have to find duplicate text string, file is bigger and need an algorithm to make this automatic find, If anybody knows would be great;))), thx!!!

Link to comment
Share on other sites

  • Replies 24
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    8

  • goldy2000

    5

  • ronjonp

    3

  • Saqib_theleo

    3

Quick & dirty:

 

(defun c:TextDupes ( / a b d e i l s )
   (if (setq s
           (ssget "_X"
               (list
                   (cons 0 "TEXT")
                   (cons 410 (if (= 1 (getvar 'CVPORT)) (getvar 'CTAB) "Model"))
               )
           )
       )
       (progn
           (setq d (ssadd))
           (repeat (setq i (sslength s))
               (setq e (ssname s (setq i (1- i)))
                     a (cdr (assoc 1 (entget e)))
               )
               (cond
                   (   (setq  b (cdr (assoc a l)))
                       (ssadd b d)
                       (ssadd e d)
                   )
                   (   (setq l (cons (cons a e) l))   )
               )
           )
           (sssetfirst nil d)
       )
   )
   (princ)
)

Link to comment
Share on other sites

@Lee : ^^ It's so funny. English & U :)

@Goldy2000 : It worked. You should check "()" when copy ^^

And u may be use this to highlight Text same contents with the Text you choice (Lee highlight all auto)

(defun c:TextDup ( / e )
   (if 
       (and    (setq e (car (entsel "\nSelect find Text :")))
               (wcmatch (cdadr (entget e)) "*TEXT")
       )    
       (sssetfirst nil
           (ssget "_X"
               (list
                   (cons 0 "TEXT")
                   (cons 410 (if (= 1 (getvar 'CVPORT)) (getvar 'CTAB) "Model"))
                   (cons 1 (cdr (assoc 1 (entget e))))
               )
           )
       )        
   )
)

Link to comment
Share on other sites

@Lee : ^^ It's so funny. English & U :)

@Goldy2000 : It worked. You should check "()" when copy ^^

And u may be use this to highlight Text same contents with the Text you choice (Lee highlight all auto)

(defun c:TextDup ( / e ) <... snip ... >

 

Thanks ketxu :thumbsup:

 

Quick tip:

 

(cons 1 (cdr (assoc 1 (entget e))))  ==  (assoc 1 (entget e))

Link to comment
Share on other sites

Did you copy ALL the code from the code box?

 

THX man, very nice working;)), is it possible to insert dialog for area select, and to limit lisp action only to visible layers??

Link to comment
Share on other sites

  • 7 years later...
On 9/5/2011 at 5:48 PM, ketxu said:

@Lee : ^^ It's so funny. English & U :)

@Goldy2000 : It worked. You should check "()" when copy ^^

And u may be use this to highlight Text same contents with the Text you choice (Lee highlight all auto)

 


(defun c:TextDup ( / e )
   (if 
       (and    (setq e (car (entsel "\nSelect find Text :")))
               (wcmatch (cdadr (entget e)) "*TEXT")
       )    
       (sssetfirst nil
           (ssget "_X"
               (list
                   (cons 0 "TEXT")
                   (cons 410 (if (= 1 (getvar 'CVPORT)) (getvar 'CTAB) "Model"))
                   (cons 1 (cdr (assoc 1 (entget e))))
               )
           )
       )        
   )
)
 

 

hello all there,

i found this nice lisp by "ketxu" for selecting duplicate text, after we select one text it highlight all other same text.

can someone tell me how to make this lisp to select multiple text at same time.

thanks.

Link to comment
Share on other sites

Try this:

(defun c:textdup (/ f r s)
  (cond	((setq s (ssget '((0 . "*TEXT"))))
	 (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
	   (or (vl-position (setq r (cdr (assoc 1 (entget x)))) f) (setq f (cons (strcat r ",") f)))
	 )
	 (sssetfirst
	   nil
	   (ssget "_X"
		  (list	(cons 0 "TEXT")
			(cons 410
			      (if (= 1 (getvar 'cvport))
				(getvar 'ctab)
				"Model"
			      )
			)
			(cons 1 (apply 'strcat f))
		  )
	   )
	 )
	)
  )
  (princ)
)

 

Link to comment
Share on other sites

52 minutes ago, ronjonp said:

Try this:


(defun c:textdup (/ f r s)
  (cond	((setq s (ssget '((0 . "*TEXT"))))
	 (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
	   (or (vl-position (setq r (cdr (assoc 1 (entget x)))) f) (setq f (cons (strcat r ",") f)))
	 )
	 (sssetfirst
	   nil
	   (ssget "_X"
		  (list	(cons 0 "TEXT")
			(cons 410
			      (if (= 1 (getvar 'cvport))
				(getvar 'ctab)
				"Model"
			      )
			)
			(cons 1 (apply 'strcat f))
		  )
	   )
	 )
	)
  )
  (princ)
)

 

Hello ronjonp,

thanks for reply, yes this is what i needed.thanks for your help.

thank you..GBY.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...