JJtre Posted January 17, 2012 Posted January 17, 2012 (edited) I created a basic lisp routine to allow us to create multiple layout tabs (from a template) at one time. My problem is that I cant get it to go past 9 layouts before it messes up. For example our naming convention is AL101, when I ask it to go more than ten it starts naming them AL109, AL1010, AL1011 ect. I would like it to be AL110, AL111. I know its how I laid out the program but I don't have time to redo it and I know there are a lot of people on here that could probably fix it in a matter of minutes, so any help would be appreciated. Thanks. (defun C:lrnp ( / lnum tnum lname lnamec lname2 lname3 lname4 lname5 lname6 lname7 lname8 tmplt) (setvar "tilemode" 1) ;changes to model space (setq lnum(getint "\HOW MANY LAYOUTS DO YOU WANT TO CREATE? ")) ;prompt for number of layouts (setq tnum(1- lnum)) (setq lname(getstring "\What is the naming convention (ie E1.1) :")) ;get naming convention (setq lnamec(strlen lname)) ;counts number of characters in naming convention (setq lname2(substr lname lnamec)) ;takes the last character of naming convention (setq lname4(atoi lname2)) (setq lname8(+ lname4 lnum)) (SETQ TMPLT(GETSTRING "\SELECT LAYOUT FOR TEMPLATE (8.5x11) (11x17) (24x36): " )) ;requests paper size (COMMAND "LAYOUT" (WRITE-LINE "T" SCRFILE) (WRITE-LINE "NTL Project Template (May 2010).dwt" SCRFILE) (WRITE-LINE TMPLT SCRFILE)) ;gets layout from main templait (command "layout" (write-line "r" scrfile) (write-line tmplt scrfile) (write-line lname scrfile)) ;rename first created layout (setq lname5(substr lname 1 (1- lnamec))) (repeat tnum (setq lname8 (1- lname8 )) (setq lname6(itoa lname8 )) (setq lname7(strcat lname5 lname6)) (command "layout" (write-line "c" scrfile) (write-line lname scrfile) (prin1 lname7)) ;copys layouts ) (princ "\Type 'LRNP' to run") (PRINC) ) Edited January 17, 2012 by JJtre Quote
SLW210 Posted January 17, 2012 Posted January 17, 2012 Please read the CODE POSTING GUIDELINES and edit your post. I have moved this thread to the AutoLISP, Visual LISP & DCL Quote
BIGAL Posted January 18, 2012 Posted January 18, 2012 (edited) I did a post similar the other day for the same type of thing a couple of things though I used layout "N" then a name very simple can do as many as you like The layout name would be better as a strcat alpha characters + number characters then the number would just increase as part of the repeat function. Now where is it. http://www.cadtutor.net/forum/showthread.php?65411-Match-Line-Refer-Dwg.-No./page2&highlight=layout example of strcat (setq layoutname (strcat alpha (rtos numlayouts 2 0))) Edited January 18, 2012 by BIGAL 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.