MR MAN Posted December 22, 2008 Posted December 22, 2008 Is There Any Way To Rename Layouts In Multiple Drawings In Folder Without Opening Them BECAUSE I HAVE 100 DRAWINGS AND I WANT RENAME LAYOUT IN ALL 100 DRAWINGS I NEED FAST WAY TO DO THAT ANY HELP? Quote
CmdrDuh Posted December 22, 2008 Posted December 22, 2008 the short answer is yes, but the more realistic answer is no. Unless someone has code structure already in place to open dwg files w/o opening them, you would have to code it yourself. What about a script file? Also, are all your layouts being renamed consistent such that you could automate it? Quote
Lee Mac Posted December 22, 2008 Posted December 22, 2008 If it is all the layouts the same name, once you have found a way to open the drawings, this will help: (defun c:lay (/ laylist) (setvar "cmdecho" 0) (setq laylist (layoutlist)) (foreach x laylist (command "-layout" "R" x "NEW-LAYOUT-NAME") ) ;_ end foreach (setvar "cmdecho" 1) (princ) ) ;_ end defun Quote
rkmcswain Posted December 22, 2008 Posted December 22, 2008 If it is all the layouts the same name, once you have found a way to open the drawings, this will help: (defun c:lay (/ laylist) (setvar "cmdecho" 0) (setq laylist (layoutlist)) (foreach x laylist (command "-layout" "R" x "NEW-LAYOUT-NAME") ) ;_ end foreach (setvar "cmdecho" 1) (princ) ) ;_ end defun That won't work because you cannot have multiple layouts with the same name. Could easily be modified of course, given a list of replacement names. Quote
Lee Mac Posted December 22, 2008 Posted December 22, 2008 That won't work because you cannot have multiple layouts with the same name. Could easily be modified of course, given a list of replacement names. Good point rkmcswain - I just automatically assumed that each drawing had one layout Quote
Lee Mac Posted December 22, 2008 Posted December 22, 2008 Quick fix: (defun c:lay (/ laylist xth) (setvar "cmdecho" 0) (setq laylist (layoutlist) xth 1 ) ;_ end setq (foreach x laylist (command "-layout" "R" x (strcat "NEW-LAYOUT-NAME-" (itoa xth))) (setq xth (1+ xth)) ) ;_ end foreach (setvar "cmdecho" 1) (princ) ) ;_ end defun Sorry 'bout that guys Quote
MR MAN Posted December 23, 2008 Author Posted December 23, 2008 dear lee mac thanks alot for your help BUT i will explain more what i need exactily for my 100 DRAWINGS if i put them in excel sheet and replace (command "-layout" "R" x "NEW-LAYOUT-NAME") in you code with (command "-layout" "R" x ???????) and my ?????? mean i want lisp take cell A1 and then A2 and so on and then i will make script open multi drawings and run this lisp sorry i remember a point now some times script for opening files don't work in files contains space for example do you know why? thanks again Quote
dbroada Posted December 23, 2008 Posted December 23, 2008 sorry i remember a point now some times script for opening files don't work in files contains space for example do you know why? if a file name has a space in it you MUST enclose the file name in quotes. Without spaces you don't necessarily need the quotes. Quote
MR MAN Posted December 23, 2008 Author Posted December 23, 2008 sorry i don't understand you. can you explain more for eaisy way i will put the script in my attachment you can tell me what you mean on it take in your mined files have name like P-S5.L111 REV.7 script can't open them thanks for help bind.zip Quote
dbroada Posted December 23, 2008 Posted December 23, 2008 if you're asking me, I'm sorry I don't understand your question. Scripts (what I thought you were talking about) have a .scr extension and will only open dwg files. Quote
Lee Mac Posted December 23, 2008 Posted December 23, 2008 ...if i put them in excel sheet and replace (command "-layout" "R" x "NEW-LAYOUT-NAME") in you code with (command "-layout" "R" x ???????) and my ?????? mean i want lisp take cell A1 and then A2 and so on... I can't say much about script files (even though yours seems to be a batch file), just because, honestly, I don't properly understand them myself. But with your layout name problem - I think it would be easier read from a text file, just replacing the "NEW-LAYOUT-NAME-" with something containing a "read-line"... etc etc I'll have a look. Quote
dbroada Posted December 23, 2008 Posted December 23, 2008 I can't say much about script files (even though yours seems to be a batch file), just because, honestly, I don't properly understand them myself.I've only just looked at his code and it is indeed a batch file. I think it will run a script file on every file in a particular folder but we don't have sight of the script file itself. Quote
asos2000 Posted December 23, 2008 Posted December 23, 2008 As I understand the question you want to know how to rename the file - Rightclick on the file click on rename then delete the spaces using backspace button (in the keyboard) - Or Highlight the file then press F2 (instate of click rightclick on the file and rename) then delete the spaces Quote
Lee Mac Posted December 23, 2008 Posted December 23, 2008 Ok, this will read layout names from a text file - just don't have two identical layout names, we don't like that kind of thing (defun c:lay (/ laylist file1 layname) (defun *error* (msg) (setvar "cmdecho" 1) (if (= msg "") (princ "\nLayouts Renamed.") (princ "\nError or Esc Pressed...") ) ;_ end if (princ) ) ;_ end defun (selfile) (setq file1 (open file "R")) (setvar "cmdecho" 0) (setq laylist (layoutlist)) (foreach x laylist (if (setq layname (read-line file1)) (command "-layout" "R" x layname) (alert "No Layout Name found in Text File.") ) ;_ end if ) ;_ end foreach (*error* "") (close file1) (princ) ) ;_ end defun (defun selfile () (setq file (getfiled "Select a Text File" "C:\\" "txt" 8 ) ;_ end getfiled ) ;_ end setq ) ;_ end defun Quote
MR MAN Posted December 23, 2008 Author Posted December 23, 2008 iam so sorry for my error i write this reply quickly yes this is bat file which run attached script file this script file contain bb which is bind lisp sorry again for my error IssueRoutine.scr Quote
Lee Mac Posted December 23, 2008 Posted December 23, 2008 iam so sorry for my error i write this reply quickly yes this is bat file which run attached script file this script file contain bb which is bind lisp ...sorry again for my error No probs Mr Man, hope we can sort things out for you Quote
asos2000 Posted December 23, 2008 Posted December 23, 2008 MR MAN You attached a bind.bat file what is this type of files and how do I create one like that? Quote
Lee Mac Posted December 23, 2008 Posted December 23, 2008 MR MAN You attached a bind.bat file what is this type of files and how do I create one like that? See here: http://en.wikipedia.org/wiki/Batch_file Quote
MR MAN Posted December 25, 2008 Author Posted December 25, 2008 iam sorry asos2000 for late in reply i have alot of work but we have lee mac who give a very nice reference so i don't afraid. thanks lee mac for your care and i wait your help thanks again Quote
Lee Mac Posted December 25, 2008 Posted December 25, 2008 No probs Mr Man, happy to help - my posted LISP should read the required layout names from a txt file - just leaves you to work out how to open each drawing and save and close 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.