I am new to this stuff and dont know if this has been asked before or not. I am looking for a lisp routine that allows me to rename my layouts without opening the drawing itself.
provide more details on what you plan to do?
does the existing layouts names are known in advance?
do you have many files that need to be layouts rename?
Tried LAYOUTMERGE. It seems to work perfect.
But when I check the merged (original) layout - it deletes the view in that layout, even when I answer the promt not to do so.
Maybe that's just my machine or 3rd party software I'm using.
i have a master file with 20-25 layouts in it.
i bring all the layouts with thier viewport settings into the new files. so now there are 20 files with 25 layouts and all layout names are similar in each files.
i know the new names but instead of opening each files and manually renaming all layouts is there a way to rename all the layouts of one drawing in a single go.
Yes, but why the same layouts names in diffrent files is a problem?
AutoCAD has no problem in dealing it.
the solusion to this can go like this:-
create a text lisp file and name it as AutoLayoutRename.lsp and save it on a the folder where all the files are
copy and paste this lisp code and save the file.
note that you have to modify the code to replace your new_layout_names^ and the number of new_layout_names^ must fit to the number of existing layouts in each dwg the lisp does not check to see if the lists are match or exist
(defun c:AutoLayoutRename (/ new_layout_names^ i oldName) (command "undo" "begin") (setq new_layout_names^ '("Nick1" "Nick2" "Nick3" "Nick4" "Nick5")) (setq i 0) (mapcar '(lambda (oldName) (command "_.layout" "rename" oldName (nth i new_layout_names^)) (setq i (1+ i)) ) (layoutlist) ) (command "undo" "end") (princ) )
create another text script file call it AutoLayoutRename.scr and save it on a the folder where all the files are
copy and paste this script code and save the file
as you can see this is a repeatative code you need to modify it and enter the fix file name (full path) of each
dwg file in my code there are only 3 files so you need to complete it with your files.
be careful not to add extra white spaces between commands and it's arguments cause each white space is like pressing the spacebar key and would consider as enter
also do not create empty lines cause these are also consider as enter in scripts
open "c:\project\files\dwg1" (load "autolayoutrename") AutoLayoutRename qsave close open "c:\project\files\dwg2" (load "autolayoutrename") AutoLayoutRename qsave close open "c:\project\files\dwg3" (load "autolayoutrename") AutoLayoutRename qsave close open... .... .... .... close
to run this invoke the SCRIPT command and select the AutoLayoutRename.scr file and if evrey thing is in place?
it will should the job.
I might be under thinking this but couldn't this be achieved with simple sript??
If i read your post correctly what you want to do is re-name layout name from "Original-01" to "New name-01".
If so i have an excel spreadsheet that will allow you to create the script, you simply put in the old name (in column B) and the new name (in column C) and the copy & Paste Special (select skip blanks) into column A.
Then select the contents of Column A and paste into a new notepad file, saveas file with appropriate name and .scr extension.
Then drag and drop into your open file.
Then it's just a matter of changeing the new name and creating a script for each one, if you will re-use or overright the first one if you wont need them again.
I've attached the excel file.
Hope this helps.
oops forgot ot mention the method of dragging/replicating the new names down through the spreadsheet.
you have to select the cell to sequence and the blank cells below it, and then drag the bottom right corner as normal this will then star tth esequence in the right place and create names in the correct cells.
Hopefully the image attached helps explain this.
I'd like to know if anyone has a similar lisp that can create layouts (using my dwt--ie, I would code in the file path) reading data from a csv file??? I would create the drawings ahead of time, all I would need then is to run the lisp and it would create all the layouts in those dwgs.
The csv file contains the drawing names in column A and the layout names in column B. So, what I want to do is run a lisp that will create "n" number of layouts in specific dwgs, using the cell data it reads from column A--which are the drawing names, and then rename all those layouts with the cell data from B--note not to create duplicate (existing) tabs. So I can re-run it later to add new layouts.
The reason for the need is that I work on projects with several hundred layouts--thus the need to create layouts more easily at the beginning. Instead of renaming/deleting a ton of layouts from our template, it would be easier to start with a minimal template and have the lisp create the exact number of layouts we need for the project instead of going back and making hundreds of edits. And, since the csv is created at the beginning of the project, any changes later (adding layouts usually), can easily be done by running the lisp again adding the new layouts.
I'm not a lisp guy otherwise I'd tackle this. Any suggestions? Thx
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.