Jaap Marchal Posted December 26, 2010 Posted December 26, 2010 Hello, Iàm ussing the Autocad command: _FIND many times. I like to add an option to the find command. I would be nice that there is an option DUPLICATE. It has to show the duplicated text, hyperlinks, etc etc. Only show but not to delete them. Jaap Quote
pBe Posted December 27, 2010 Posted December 27, 2010 would you want to highlight and/or zoom-in the result for the entry? e.g if 5 items found the zoom factor is the extents of the result? or show the entries one by one with a pointer? Quote
Jaap Marchal Posted December 27, 2010 Author Posted December 27, 2010 Like the FIND AND REPLACE DIALOG. List the results and the option to choose one and ZOOM TO HIGHLICHTED RESULT. Quote
pBe Posted December 28, 2010 Posted December 28, 2010 I see... that would be something huh? It will take some time though. i'm currently playing around with OpenDCL.. maybe i could squeeze this project on my sched we'll see. but i'm pretty sure somebody else would do it for you... Quote
Jaap Marchal Posted December 28, 2010 Author Posted December 28, 2010 A list with duplicates wil do (on the command prompt or in the Autocad text window(F2)). From there i gonna use the _FIND command to search/zoom to the item. Jaap Marchal Quote
pBe Posted December 29, 2010 Posted December 29, 2010 (edited) i see... i get the wrong idea Jaap, thought you wanted something really fancy ok, the list will show what? the entries that have duplicates? is that right? BTW does the search includes hyperlinks as well? all in one go? Edited December 29, 2010 by pBe Quote
Jaap Marchal Posted December 29, 2010 Author Posted December 29, 2010 OK..........i have drawings with 100 or more smokedetectors with hyperlinks with a adress something like: root.sdetec.1.001. I generate DWF files for the use with a Building management system. So i`am looking for something to finding dublicates. The system gives a error if there are dublicates. Thera are also named views in the drawing. If there are dublicates in the drawing, the system does not know witch view the choose. Quote
pBe Posted December 30, 2010 Posted December 30, 2010 okaaayy... now i'm confused Lets break it down: There are Text/Mtext with Hyperlink: same TextString same Hyperlink same Textstring different Hyperlink different TextString same Hyperlink different TextString different Hyperlink There are Text/Mtext: same TextString different TextString There are Objects with Hyperlink: same Object type same Hyperlink same Object type different Hyperlink different Object type same Hyperlink different Object type different Hyperlink Now this code will search for Text/MText for duplicate TextString and print a list of duplicates. One with Hyperlinks , but not filtered for Link duplicates the other just ordinary Text Lets start with this one (defun c:test (/ text_obj tobj tobj_v tx-str dp_hl_lst Hlnk_lst dp_tx_lst text_lst) (vl-load-com) (setq text_obj (ssget "_X" '((0 . "MTEXT,TEXT"))) cnt -1 ) (while (setq tobj (ssname text_obj (setq cnt (1+ cnt)))) (setq tobj_v (vlax-ename->vla-object tobj)) (if (= (vla-get-count (vla-get-hyperlinks tobj_v)) 1) (if (member (setq tx-str (vla-get-textstring tobj_v)) Hlnk_lst) (setq dp_hl_lst (cons tx-str dp_hl_lst)) (setq Hlnk_lst (cons tx-str Hlnk_lst)) ) (if (member (setq tx-str (vla-get-textstring tobj_v)) text_lst) (setq dp_tx_lst (cons tx-str dp_tx_lst)) (setq text_lst (cons tx-str text_lst)) ) ) ) (textscr) (prompt "\n<< List of Duplicate Text String with Hyperlink >>") (foreach s (LM:Unique_iter dp_hl_lst) (princ (strcat "\nFound Duplicate for " s)) ) (prompt "\n\n<< List of Duplicate Text\Mtext >>") (foreach s (LM:Unique_iter dp_tx_lst) (princ (strcat "\nFound Duplicate for " s)) ) (princ) ) ;; Credit to Lee Mac ;; (defun LM:Unique_iter (l / r) (while (setq x (car l)) (setq r (cons x r) l (vl-remove x (cdr l)))) (reverse r)) Hope this will get you started Quote
Jaap Marchal Posted December 30, 2010 Author Posted December 30, 2010 I`am not into lisp......but it returns with: Command: test ; error: bad argument type: lselsetp nil Quote
pBe Posted December 30, 2010 Posted December 30, 2010 Oops... I wonder why.. maybe because the code doesnt have eny error hanlder thats why This code is a starting point, it wont do exactly want you want as we are trying to figure out the end result Tell you what... attached your dwg file here, a partial dwg would be sufficient BTW: try to answer my queries on the previous post (the conditions) Quote
Lee Mac Posted December 30, 2010 Posted December 30, 2010 Here's one way to show duplicate hyperlinks: (defun c:ShowDuplicateHyperlinks ( / dp ss x e l i ) ;; © Lee Mac 2010 (if (setq dp (ssadd) ss (ssget "_X" '((-3 ("PE_URL"))))) (repeat (setq i (sslength ss)) (if (member (setq x (cadr (assoc -3 (entget (setq e (ssname ss (setq i (1- i)))) '("PE_URL")) ) ) ) l ) (ssadd e dp) (setq l (cons x l)) ) ) ) (sssetfirst nil dp) (princ) ) Quote
Jaap Marchal Posted December 30, 2010 Author Posted December 30, 2010 Wow Lee, it works fine. Thanks, Jaap Marchal Quote
pBe Posted December 31, 2010 Posted December 31, 2010 (edited) Here's one way to show duplicate hyperlinks: (defun c:ShowDuplicateHyperlinks ( / dp ss x e l i ) ;; © Lee Mac 2010 (if (setq dp (ssadd) ss (ssget "_X" '((-3 ("PE_URL"))))) (repeat (setq i (sslength ss)) (if (member (setq x (cadr (assoc -3 (entget (setq e (ssname ss (setq i (1- i)))) '("PE_URL")) ) ) ) l ) (ssadd e dp) (setq l (cons x l)) ) ) ) (sssetfirst nil dp) (princ) ) Simple like that Lee, what i'm trying to find out from the OP is finding the duplicate links under different condtions. like Text/Mtext/Object with hyperlinlk, or is it exclusively for Text/Mtext entities, or blocks with Hlink? different value of string but same hyperlink? or exact duplicate regardless of entity type.. oh well, as long as it works for Jaap, then all is good Edited December 31, 2010 by pBe Quote
Lee Mac Posted December 31, 2010 Posted December 31, 2010 Lee, what i'm trying to find out from the OP is finding the duplicate links under different condtions. like Text/Mtext/Object with hyperlinlk, or is it exclusively for Text/Mtext entities, or blocks with Hlink? different value of string but same hyperlink? or exact duplicate regardless of entity type.. oh well, as long as it works for Jaap, then all is good From the OP's description it sounded like an error was arising from any duplicate hyperlinks, hence I thought it best to show them all. Lee Quote
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.