Jump to content

Windows search layout tabs


ofishil

Recommended Posts

Is there a way to search the layout tabs while doing a windows search?

 

For example. I am given a drawing to find. Dwg. 1234. So I know that alot of dwgs have mulitiple layout tabs and most likely it is inside on of those tabs.

 

How would I search all the Layout tabs multiple dwgs?

Link to comment
Share on other sites

Well I think i figured it out. Through DesignCenter i think i can search for layouts. Is there another way?

Link to comment
Share on other sites

Here's a quick example:

 

(defun c:LFIND () (c:LayoutFind))

(defun c:LayoutFind  (/ *error* path sheets layoutName dbx n matchList)
 (vl-load-com)
 (princ "\rLAYOUT FIND ")
 (terpri)

 (defun *error*  (msg)
   (cond
     ((not msg))                                                       ; Normal exit
     ((member msg '("Function cancelled" "quit / exit abort")))        ; <esc> or (quit)
     ((princ (strcat "\n** Error: " msg " ** "))))                     ; Fatal error, display it
   (and dbx
        (setq dbx (vl-catch-all-apply 'vlax-release-object (list dbx))))
   (princ))

 (if (and (setq
            path (getfiled "Select any DWG in the desired folder "
                           (getvar 'dwgprefix)
                           "dwg"
                           16))
          (setq path (strcat (vl-filename-directory path) "\\"))
          (setq sheets (vl-directory-files
                         path
                         "*.dwg"
                         1))
          (not (initget 1))
          (setq layoutName (strcase (getstring T "\nEnter layout name to find: ")))
          (setq dbx (vla-GetInterfaceObject
                      (vlax-Get-Acad-Object)
                      (strcat "ObjectDBX.AxDbDocument."
                              (substr (getvar 'acadver) 1 2)))))
   (progn
     (prompt "\nWorking, please wait... ")
     (foreach sheet  sheets
       (vl-catch-all-apply
         'vla-open
         (list dbx (strcat path sheet)))
       (vlax-for lay  (vla-get-layouts dbx)
         (if (or (= layoutName (setq n (strcase (vla-get-name lay))))
                 (vl-string-search layoutName n))
           (setq matchList (cons sheet matchList)))))
     (if matchList
       (progn
         (princ "Matches found! ")
         (terpri)
         (textpage)
         (foreach item  (reverse matchList)
           (prompt (strcat "\n\t\t" item)))
         (terpri))
       (princ "No matches found. "))
     (setq dbx (vl-catch-all-apply 'vlax-release-object (list dbx))))
   (cond
     (sheets (prompt "\n** ObjectDBX interface could not be initialized ** "))
     (T (prompt "\n** Invalid path selected ** "))))
 (princ))

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