ofishil Posted May 3, 2011 Share Posted May 3, 2011 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? Quote Link to comment Share on other sites More sharing options...
ofishil Posted May 3, 2011 Author Share Posted May 3, 2011 Well I think i figured it out. Through DesignCenter i think i can search for layouts. Is there another way? Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 3, 2011 Share Posted May 3, 2011 The only other way I know of, is to use ObjectDBX to query a directory of drawings. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 3, 2011 Share Posted May 3, 2011 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)) Quote Link to comment Share on other sites More sharing options...
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.