Rename layout for multiple files.

Rename layout for multiple files.

bmanalanDX6VM
Participant Participant
751 Views
13 Replies
Message 1 of 14

Rename layout for multiple files.

bmanalanDX6VM
Participant
Participant

I have multiple files with the same layout name.  I would like to rename the layout for all those files. (350 dwg files). Any suggestions. 

 

0 Likes
752 Views
13 Replies
Replies (13)
Message 2 of 14

Moshe-A
Mentor
Mentor
0 Likes
Message 3 of 14

cadffm
Consultant
Consultant

 

Command to rename a layout is LAYOUT

and a simple script for oldname Layout1 and the new name "newname"

_layout

_rename

Layout1

newname

_qsave

 

 

and because of possible mistake (drawing files without the oldname-Layout, or files with already have the newname layout)

use this one as script content (The

;---------------------------
(if (and
(member (strcase "Layout1") (mapcar 'strcase (layoutlist)))
(not(member "NewName" (mapcar 'strcase (layoutlist))))
)
(command "_.LAYOUT" "_RENAME" "Layout1" "NewName" "_.QSAVE")
)

;---------------------------

Sebastian

0 Likes
Message 4 of 14

ec-cad
Collaborator
Collaborator

You will be needing a Lisp that 'batches' drawings in a given folder, loads a rename type lisp,

and saves the drawings with the changes. Here's a couple of Lisps to do that.

 

You need to edit both of the routines. One needs a path to newlayoutname.lsp, and the

other needs your 'NewLayoutName; and 'OldLayoutName.

 

The main Lisp that allows for drawing folder selection and batching is: ChgLayoutName.lsp

Once loaded, type in CHGLAYOUTNAME at the Command prompt to run.

Place the newlayoutname.lsp somewhere on your drive, and put in that path/lispfilename

in the ChgLayoutName.lsp, so it can 'load' it for each drawing.

 

Cheers

ECCAD

 

0 Likes
Message 5 of 14

bmanalanDX6VM
Participant
Participant
Thank you for your suggestions.

I tested this command on the drawing (command "_.LAYOUT" "_RENAME" "MCW" "AHC" "_.QSAVE")
The layout name changed from MCW to AHC which is what I want. What should the command look like to run this for all files within "Myfolder" or would that be a lisp file to run.
0 Likes
Message 6 of 14

ec-cad
Collaborator
Collaborator

Download the 'ChgLayoutName.lsp and the 'newlayoutname.lsp from above.

Edit the 'newlayoutname.lsp to place your old and new layout names. Save the file in C:/mylisp  folder.

Save the 'ChgLayoutName.lsp in C:/mylisp  folder also.

Edit the 'ChgLayoutName.lsp, put in your path as "C:/mylisp/newlayoutname.lsp", save the file.

Open any drawing. At Command line, do: (load "c:/mylisp/ChgLayoutName.lsp") or drag/drop it into your drawing.

At Command Prompt line, type in:  CHGLAYOUTNAME<enter key>

You will get a dialog to select a Folder, browse, and select your folder.

The program will run and replace the Layout names and save the drawings also.

 

ECCAD

 

 

0 Likes
Message 7 of 14

bmanalanDX6VM
Participant
Participant

Hello Eccad,

I am not seeing any Lisp files for download. We you say download "from above" what is the location or site?

I appreciate your help and if I can get these files, your instructions make sense.

Thank you.

0 Likes
Message 8 of 14

bmanalanDX6VM
Participant
Participant
I am not seeing any Lisp files for download. When you say download from above, what is that location or site?
Sorry if I am being a pain in the butt, but if I can get the lisp files, your instructions make sense.
0 Likes
Message 9 of 14

paullimapa
Mentor
Mentor

I see them both @ec-cad 10:00am reply posting:

Re: Rename layout for multiple files. - Autodesk Community

paullimapa_0-1740692763867.png

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 10 of 14

ec-cad
Collaborator
Collaborator

It may be a Web Site issue, this AutoDesk site was updated recently.

 

If you cannot locate the Lisp files I posted, I'll post them here again.

Cheers!

ECCAD

0 Likes
Message 11 of 14

bmanalanDX6VM
Participant
Participant
I see them on my phone. I added some new security on my computer earlier this week. Anyway, thank you again. I will look at it tomorrow.

0 Likes
Message 12 of 14

Sea-Haven
Mentor
Mentor

Maybe look at Accoreconsole it will zoom through 350 dwg's compared to using a script. Hint @paullimapa has a good link about how to use.

 

https://through-the-interface.typepad.com/through_the_interface/2012/02/the-autocad-2013-core-consol...

 A BAT file approach

:: Path to AutoCAD core console
set accoreexe="C:\Program Files\Autodesk\AutoCAD 2014\accoreconsole.exe"

:: Path to the script to run
set script="C:\Users\[USERNAME]\Desktop\IPAD\TESTER\tester2.scr"

%accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST1.dwg /s %script%
%accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST2.dwg /s %script%
%accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST3.dwg /s %script%
%accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST4.dwg /s %script%
%accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST5.dwg /s %script%
pause

 

0 Likes
Message 13 of 14

paullimapa
Mentor
Mentor

@bmanalanDX6VM Here's a lisp function to run within AutoCAD that launches AccoreConsole. 

First select a folder & then a script file and all the drawings in that folder will be processed with AccoreConsole applying the commands within the script file without needing to open them.

So give this a try.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 14 of 14

baksconstructor
Advocate
Advocate

If you find it really hard to understand, you can use a ready-made solution. It will quickly do everything you need.

 

rename.PNG

0 Likes