Is there a way to identify the files with a non-standard layer convention?Once identified and located,I plan to clean up manually
The folder I'm working with contains thousands of DWGs and I've discovered some layer names which differ from our standard naming conventions.
Any tools/links greatly appreciated!!
Thanks.
lkenney9876 wrote:
Is there a way to identify the files with a non-standard layer convention? Once identified and located,I plan to clean up manually
The folder I'm working with contains thousands of DWGs and I've discovered some layer names which differ from our standard naming conventions.
...
One way:
with a script I think it is possible to identify the dwg's that have layers names "non-standard".
How do you have your "standard naming conventions" saved, in a txt, a dwt, a xls...
Henrique
@Anonymous wrote:
Is there a way to identify the files with a non-standard layer convention?Once identified and located,I plan to clean up manually
The folder I'm working with contains thousands of DWGs and I've discovered some layer names which differ from our standard naming conventions.
Any tools/links greatly appreciated!!
Thanks.
Another approach besides script is ODBX
ODBX sample <---- linky
In order for us to help you.
As Henrique stated you need to provide more info like "what is" and "what sould be" (your standard naming convention.
HTH
lkenney9876,
after pbejse's idea, I thought ODBX would be faster, so, here's something that should result.
This code will ask to select a txt file with the Standard layer names (names are case sensitive), read it, then asks to select the folder with the dwg's to scan,
perform a scan through the layer names, trying to find layers non-standard, is find, writes a txt file in the same directory as the dwg's,
under the name "LayersNonStandard.txt", with the dwg's names that have these non-standard names.
Save the code below as "Lynst.lsp", load the code and type "lynst" to run
;; Load Supporting Functions ;; Old Version of 'BrowseForFolder' by: Tony Tanzillo (defun BrowseForFolder (Message / sh folder parentfolder folderobject result) (vl-load-com) (setq sh (vla-getInterfaceObject (vlax-get-acad-object) "Shell.Application" ) ) (setq folder (vlax-invoke-method sh 'BrowseForFolder 0 Message 0) ) (vlax-release-object sh) (if folder (progn (setq parentfolder (vlax-get-property folder 'ParentFolder) ) (setq FolderObject (vlax-invoke-method ParentFolder 'ParseName (vlax-get-property Folder 'Title) ) ) (setq result (vlax-get-property FolderObject 'Path) ) (mapcar 'vlax-release-object (list folder parentfolder folderobject) ) (if (/= (substr result (strlen result)) "\\") (setq result (strcat result "\\")) result ) ) ) );; defun ;;; Scan a directory of dwg's to find different layer names from the names that are supplied via a txt file ;;; hms - 02-21-2013 (defun c:Lynst (/ DirPath DwgList CadVer Id LayLst Dwg DwgFile Dbx Num Layer TxtFile OFile ) (setq fname (getfiled "" "" "txt" 8)) (if (setq Layfile (open fname "r")) (progn (while (setq Line (read-line layfile)) (setq LayLst (cons Line LayLst)) ) (reverse LayLst) ) ) (if (setq DirPath (BrowseForFolder "Select directory to scan drawings.") ) (progn (setq DwgList (vl-directory-files DirPath "*.dwg" 1)) (if (findfile (strcat DirPath "LayerNonStandard.txt")) (vl-file-delete (strcat DirPath "LayerNonStandard.txt")) );; if (setq CadVer (substr (getvar "acadver") 1 2));; get cad version (setq Id (strcat "objectdbx.AxDbDocument." CadVer));; creat prog id (foreach Dwg DwgList (setq DwgFile (strcat DirPath Dwg)) (setq Dbx (vlax-create-object Id));; creat dbx object (setq Num 0) (vla-open Dbx DwgFile) (vlax-for Layer (vla-get-layers Dbx) (if (member (vla-get-name Layer) LayLst) (princ) (setq Num (+ 1 Num)) );; if );; vlax (vlax-release-object Dbx) (if (> Num 0) (progn (setq TxtFile (strcat DirPath "LayerNonStandard.txt" ) ) (setq OFile (open TxtFile "a")) (write-line Dwg OFile) (close OFile) );; progn );; if (princ) );; foreach );; progn );; if (princ) );; function
If you don't have a txt file with the Standard layer names, open a dwg or a dwt that have all the Standard layer names, save the code below as "LayerList.lsp", load the code and type "layerList" to run and to write all the layer names to a txt file to use in the previous code
;;;Posted by Some Buddy ;;;forums.autodesk.com - Visual LISP AutoLISP and General Customization ;;;04-08-2010 (defun c:layerList ( / fname f lay) (setq fname "C:\\Test\\Test\\layerlist.txt");; <== change the file location and name (setq f (open fname "w")) (while (setq lay (tblnext "LAYER" (not lay))) (if lay (write-line (cdr (assoc 2 lay)) f)) ) (close f) (princ (strcat fname " created.")) (princ) ) (princ "LayerList loaded.") (princ)
Hope that helps
Henrique
Henrique,
I used a script to address our standard layers' states . The problem is that I cannot possibly know the anomaly layer names or how many there are. I'm working with a folder of 1,100 DWGs.
Our standard layer names are in excel.
I'll try the ODBX suggestion.
lkenney9876 wrote:
Henrique,
I used a script to address our standard layers' states . The problem is that I cannot possibly know the anomaly layer names or how many there are. I'm working with a folder of 1,100 DWGs.
Our standard layer names are in excel.
I'll try the ODBX suggestion.
To use the code I post, you do not need to know the anomaly layer names, you need to know the Standard layer names, as you say, they are in excel. You only need to have one dwg or one dwt that have all the Standard layer names, only the correct layer names...
One more thing, I followed the pbejse's suggestion, ODBX.
Henrique