Jump to content

Recommended Posts

Posted

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?

  • Replies 43
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    16

  • MR MAN

    12

  • CAB

    5

  • ASMI

    4

Top Posters In This Topic

Posted

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?

Posted

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

:)

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

Posted
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 :oops::unsure:

Posted

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

Posted

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

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

Posted

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

Posted

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.

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

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

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

Posted

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

 

(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

Posted

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

Posted
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

Posted

MR MAN

 

You attached a bind.bat file

what is this type of files and how do I create one like that?

Posted

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

Posted

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

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