Jump to content

Recommended Posts

Posted

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

Posted

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?

Posted

Like the FIND AND REPLACE DIALOG. List the results and the option to choose one and ZOOM TO HIGHLICHTED RESULT.

 

find and replace.JPG

Posted

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... :)

Posted

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

Posted (edited)

i see... i get the wrong idea Jaap, thought you wanted something really fancy :D

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 by pBe
Posted

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.

Posted

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

Posted

I`am not into lisp......but it returns with:

Command: test

; error: bad argument type: lselsetp nil

Posted

Oops... I wonder why.. :)

maybe because the code doesnt have eny error hanlder thats why :unsure:

 

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)

Posted

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

Posted

Wow Lee, it works fine.

 

Thanks,

Jaap Marchal

Posted (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 by pBe
Posted
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

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...