Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

finds duplicate Text & highlight with any color (numbers or text string) ?

17 REPLIES 17
Reply
Message 1 of 18
Anonymous
2197 Views, 17 Replies

finds duplicate Text & highlight with any color (numbers or text string) ?

find duplicate Text & highlight with any color (numbers or text string) ?

I have a drawing and have to find duplicate text string, file is bigger and need make this automatic find, & highlight the duplicate text, If anybody knows would be great thx!!! Smiley Happy
Please Help me..
Jamshi
jamshi2000@gmail.com

17 REPLIES 17
Message 2 of 18
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

find duplicate Text & highlight with any color (numbers or text string) ?
....


It's quite old, and it's designed to remove rather than highlight duplicates, but maybe this will at least give you a start.

 

And here is a thread about calling attention to duplicate text in a different way.

Kent Cooper, AIA
Message 3 of 18
pbejse
in reply to: Anonymous


@Anonymous wrote:

find duplicate Text & highlight with any color (numbers or text string) ?

I have a drawing and have to find duplicate text string, file is bigger and need make this automatic find, & highlight the duplicate text, If anybody knows would be great thx!!! Smiley Happy
Please Help me..
Jamshi
jamshi2000@gmail.com


Curious, why the highlight? Whats next after highlighting? Will that be zoom to the duplicate pair then the next one and so on?  

Message 4 of 18
Anonymous
in reply to: pbejse

I have the drawing around 1500 rooms in a floor, i want hatch some of the room. i have 300 rooms list in excel,
i insert that rooms to autocad, it came duplicated. so whatever highlighted. it can be hatch quickly.
Message 5 of 18
Anonymous
in reply to: Kent1Cooper

I have the drawing around 1500 rooms in a floor, i want hatch some of the rooms. 300 rooms list in excel,
i insert that rooms to autocad, it came duplicated. so whatever highlighted. it can be hatch quickly.
Message 6 of 18
sharpl
in reply to: Anonymous

I need a clean routine for finding duplicate mtext and highlighting it, please help. I googled, couldn't find anythihg that would run without a problem. This selects all mtext in format xxxx-xx-xx, just like selct similiar command.

 

(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))))
                )
            )
        )       
    )
)

Message 7 of 18
Kent1Cooper
in reply to: sharpl


@sharpl wrote:

I need a clean routine for finding duplicate mtext and highlighting it, please help. I googled, couldn't find anythihg that would run without a problem. This selects all mtext in format xxxx-xx-xx, just like selct similiar command.

....
                    (cons 0 "TEXT")
....


I'm not sure I understand.  That code looks like it should find Text [but not Mtext] in the current space with exactly the same content as the selected Text-or-Mtext object, regardless of the format of that content [whether xxxx-xx-xx or otherwise].  Are you looking for something that finds only duplicates in that format?  If so, is that a date format, so that it could be made to look for only numerical characters for the x's?

 

You say you want to find duplicate Mtext.  Does it work right if you change the quoted code snippet to:

....

                    (cons 0 "MTEXT")

....

?  And should you also change it in the object selection so that it "sees" only Mtext, or do you want to be able to select Text as the source for the content you're looking to match?  If the latter, is there a possibility that any Mtext will have internal formatting, hard returns, etc., or would its content always be "plain" so that it might match that of a plain-Text object?

Kent Cooper, AIA
Message 8 of 18
sharpl
in reply to: Kent1Cooper

Dear Kent1Cooper, thank you for your reply!

I am working on wires and have over 100 pages. I need to find the other end and any potential problems. I tried to convert the mtext into attributes so I could extract them into excel table and that didnt work, couldnt find any routines that run without errors. If you have a better idea that would help me to track the other end (including multiple usage of the wire) I would greatly appreciate it. I thought if I can highlight the same wire it would save me some time, either one at a time or run a routine that would find duplicates and highlight them all, then I would know that the ones are NOT highlighted are the problem single ones. The mtext is CCIC-CF-#### (wire number). Let me know if it makes any sense. I appreciate your time and assistance.  

Tags (1)
Message 9 of 18
Kent1Cooper
in reply to: sharpl


@sharpl wrote:

....

I am working on wires and have over 100 pages. ....  


Are those 100 pages all just different areas within a big model space?  Separate Layouts with viewports into model space?  Separate Layouts with content drawn in paper space?  Separate drawings?

Kent Cooper, AIA
Message 10 of 18
sharpl
in reply to: Kent1Cooper

yap, big model, no layouts, when you use "find" it zooms into the wire and can't even see the off sheet ref unless I zoom out. So time consuming, going one by one now. It is too late to change formatting and the way it is been done, we have only couple of weeks to make it right

Message 11 of 18
Kent1Cooper
in reply to: sharpl


@sharpl wrote:

yap, big model, no layouts, when you use "find" it zooms into the wire and can't even see the off sheet ref unless I zoom out. ....


Is your idea that you pick on an item and have it find another the same and highlight it?  If the doppelganger might be anywhere in the drawing, so that you'd need to Zoom all the way out, highlighting may not be visible in the kind of drawing you describe.  Have you tried things from the thread in my second link in Post 2?  That should find and link all duplicates in one shot, without your needing to look for them separately.  [Follow the thread through -- there's a correction in a later Post.]

Kent Cooper, AIA
Message 12 of 18
sharpl
in reply to: Kent1Cooper

If you are talking about drawing a line I cant get that work either. Appload works, I can type a command, syntax is found but the line is not visible. Anything I am doing wrong?

Message 13 of 18
sharpl
in reply to: sharpl

Drawing a line between the duplicate text or mtext strings

Message 14 of 18
Kent1Cooper
in reply to: sharpl


@sharpl wrote:

If you are talking about drawing a line I cant get that work either. Appload works, I can type a command, syntax is found but the line is not visible. Anything I am doing wrong?


Possibly, and something I did wrong back then, assuming you're using the code in Post 4 there.

 

Make sure you correct the System Variable name [Post 9 on that thread] and put a numerical value in place of "somenumber" in this line:

 

  (setvar 'plinewid somenumber)

 

And [my error] change this:

 

(setvar 'cecolor 1)

 

to this:

 

(setvar 'cecolor "1")

 

[or whatever color number/name you prefer], because that needs to be a string, since there is the possibility of its being "Bylayer" or "Byblock" or "green" or something.

 

If those don't fix it, is there any error message?  Is your current Layer off?

Kent Cooper, AIA
Message 15 of 18
sharpl
in reply to: sharpl

 Just making sure we are talking about the same thing here, this one I was trying to run (my layers are not turned off)

 

(defun c:fdt (/ plw col ss n m string1 string2 p1 p2) ;;Find Duplicate Text

  ;; should probably add error handler, but I'll leave that to you....

  (prompt "Select text items to examine: ")
  (setq

    plw (getvar 'plinewid)

    col (getvar 'cecolor)

    ss (ssget '((0 . "TEXT,MTEXT"))); <-- shorter way -- (ssget) honors (wcmatch) syntax

    n 0

  ); setq

  (setvar 'plinewidth somenumber)

  (setvar 'cecolor 1)

  (while
    (< n (sslength ss))
    (setq string1 (cdr (assoc 1 (entget (ssname ss n)))))
    (setq string1 (vl-string-right-trim " " (vl-string-left-trim " " string1)))
    (setq m (1+ n))

    (while
      (< m (sslength ss))
      (progn
        (setq string2 (cdr (assoc 1 (entget (ssname ss m)))))
        (setq string2 (vl-string-right-trim " " (vl-string-left-trim " " string2)))
        (if (= string1 string2)
          (progn
            (setq p1 (cdr (assoc 10 (entget (ssname ss n)))))
            (setq p2 (cdr (assoc 10 (entget (ssname ss m)))))
            (command "_.pline" p1 p2 "")
          );progn
        );if
      );progn
      (setq m (1+ m))
    );while m
    (setq n (1+ n))
  );while n
  (setvar 'plinewid plw)

  (setvar 'cecolor col)

  (princ); moved here so 'cecolor value doesn't appear on Command: line

);defun

(princ "Type FDT to run the Find_Dup_Text routine.")

(princ)

Message 16 of 18
sharpl
in reply to: Kent1Cooper

AFTER YOUR CORRECTION, the error I get:

 

fdt.lsp successfully loaded.
Command: Type FDT to run the Find_Dup_Text routine.
Command:
Command: FDT
Select text items to examine:
; error: AutoCAD variable setting rejected: PLINEWIDTH 5

 

 

GETTING CLOSER THOUGH, THX!!!!!

Message 17 of 18
Kent1Cooper
in reply to: sharpl

You didn't make the correction to the System Variable name.

Kent Cooper, AIA
Message 18 of 18
Anonymous
in reply to: Kent1Cooper

Thanks for every one. its a useful tip.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost