+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 19
  1. #1
    Junior Member
    Discipline
    Landscape
    sephiroth11983's Discipline Details
    Occupation
    Landscape Technician
    Discipline
    Landscape
    Using
    AutoCAD 2012
    Join Date
    Oct 2012
    Location
    Manila Philippines
    Posts
    12

    Default Multiple Layouts in one file pls help me

    Registered forum members do not see this ad.

    Greetings,

    i hope someone can help me concerning multiple layouts.
    im just new to autolisp and im trying to create a lisp that can make multiple layouts in one file.. and will be renamed by numbers. (ex. is layouts 1001-1050)


    i tried to use someone's lisp here but it also has problems.



    im trying to remove the create a template since all i need to do is make the first layout (ex is 1001). then copy it upto the required number of layouts im gonna do...it is to time consuming copying,renaming, move to end the first layout expecially when making 100+ layouts in one file. can some help me do a string that i can use to just add a number to the first layout name upto to my required number of layouts... (ex is il make layout 1001. then the lisp will just do 1002,1003,1004 upto the desired number of layouts.)

    im trying to make it but i still dont understand the use of substr, and the other text concerning the usage.

    thanks you sirs.

    Sephiroth11983

    Note: Sorry i removed the code because i dont know here my vbulettin navigation bar is..so i cant place the code in its proper format..sorry for the honest mistake...i should have read the guidelines first before posting any messages...

    But i do appreciate and thank the people who are always open to help..and really helped me concerning LISP and sharing their knowledge. thank you PbE and Bigal. sorry for the problems moderators and admins.

    Code:
    (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 "\Ilang Sheets ang gusto mong gawin? How many Sheets? ")) ;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)
    )
    again this code is owned by another person, sorry i forgot who i got this from..i tried using his code as a background and study..then used masters Pbe and Bigals for new references..and new studies..i also wanna thank the person who made the original code...the LRNP command he made..

    i guess i panicked when a moderator wanred me..i just saw where the # click for making the code..hahaha
    Last edited by sephiroth11983; 23rd Oct 2012 at 03:35 pm. Reason: due to posting guidelines

  2. #2
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,089

    Default

    If you are starting from a new drawing it could be as simple as this:

    Code:
    (defun c:mkl (/ cnt lnum)
      (setvar 'cmdecho 0)
      (while
        (progn
          (initget 7)
          (setq cnt	 1000
    	    lnum (getint "\nHow Many Layouts: ")
          )
          (if (<= lnum (length (layoutlist)))
    	(princ "\nNumber is below/equal current number of Layout:")
    	nil
          )
        )
      )
      (foreach itm (layoutlist)
        (command "layout"
    	     "rename"
    	     itm
    	     (strcat (itoa (setq cnt (1+ cnt))))
        )
      )
      (repeat (- lnum (length (layoutlist)))
        (command "layout" "new" (strcat (itoa (setq cnt (1+ cnt)))))
      )
      (princ)
    )
    EDIT:
    Is there a situation that you need to add a layout on an existing drawing? were your layout tabs always have that name convention?

    The code posted above will still work only problem is the list generated by (layoutlist) will be sorted automatically, and that isn't always good. (but in your case i think its okay)
    Last edited by pBe; 20th Oct 2012 at 10:21 am.

  3. #3
    Junior Member
    Discipline
    Landscape
    sephiroth11983's Discipline Details
    Occupation
    Landscape Technician
    Discipline
    Landscape
    Using
    AutoCAD 2012
    Join Date
    Oct 2012
    Location
    Manila Philippines
    Posts
    12

    Default

    this is a great lisp, a good guide for me the study...mostly we make the first layout first then we make multiple layout copies from that.... how can i copy that layout sir? im still reading the basics of lee-mac.. (coz im a noob T_T) i hope someone can send me a guide about how to make the lisp..expecially if its complicated like this...

    but what u gave me really game me more guide..il study this..thanks Master pBe

  4. #4
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,089

    Default

    Quote Originally Posted by sephiroth11983 View Post
    this is a great lisp, a good guide for me the study...mostly we make the first layout first then we make multiple layout copies from that.... how can i copy that layout sir? im still reading the basics of lee-mac.. (coz im a noob T_T) i hope someone can send me a guide about how to make the lisp..expecially if its complicated like this...

    but what u gave me really game me more guide..il study this..thanks Master pBe
    Come to think of it, all i did was create a new layout. Copy a layout you say? its easy really. but do this apply to new drawings only? for an existing one, do you copy the first layout tab [1001] or the last?

  5. #5
    Junior Member
    Discipline
    Landscape
    sephiroth11983's Discipline Details
    Occupation
    Landscape Technician
    Discipline
    Landscape
    Using
    AutoCAD 2012
    Join Date
    Oct 2012
    Location
    Manila Philippines
    Posts
    12

    Default

    actually, i make the first layout, place the titleblock then viewport then callouts.. then i copy that first layout named 1001....upto example 150 layouts(depends on size of project)... and i do that copy layout again and again and again then rename rename move to end etc... than i tried to edit a certain lsp but its still complicated for me...

    then i make another layout from new file named 2001..then do it again upto example 150 again.. (2001,2002,2003,2004 layout names)

    i can use ur lisp the first you gave me..then i found an lsp copying all items in one layout then paste all in the other layouts.for now, thats what im doing.

    im reading beginner's tutorial in lisp thru pdf..coz im not yet familiar in making complex command..all i know is create basic commands like make a greeting (the alert statement ) hahaha

  6. #6
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,089

    Default

    After you do your thang on the first layout tab. type copyl

    Code:
    (defun c:copyl (/ cnm lnum)
      (initget 7)
      (setq	cnm  (last (layoutlist))
    	lnum (getint "\nNumber of Layouts to Add: ")
      )
      (repeat lnum
        (command "_layout"
    	     "_copy"
    	     cnm
    	     (setq cnm (itoa (1+ (atoi cnm))))
        )
      )
    )
    This code assumes everything is in order. layout names are named using numerical value and only one layout tab exist.
    This can be modified to your needs , like add another layout tab for existing drawings, in which case should copy the LAST layout tab to follow the last number.

    EDIT: car to last

  7. #7
    Junior Member
    Discipline
    Landscape
    sephiroth11983's Discipline Details
    Occupation
    Landscape Technician
    Discipline
    Landscape
    Using
    AutoCAD 2012
    Join Date
    Oct 2012
    Location
    Manila Philippines
    Posts
    12

    Default

    WOW!!!

    This is the exact lisp i need!!! thankyou Master pBe!!! im continuosly reading the lsp for beginners..i do hope to encounter the commands you masters type (ex. are the atoi, ssget, substr..) i still dont know them...basic things i now for now is the defun...but making multiple commands inside that defun is a long way to go.

    a noob thing i can do for now is make a greeting alert after loading lsp example is (alert "Compiled for work") .. . then try to edit old commands renaming them with new ones. thankyou MASTER pBe!!!

  8. #8
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,089

    Default

    Quote Originally Posted by sephiroth11983 View Post
    WOW!!!

    This is the exact lisp i need!!! thankyou MASTER pBe!!!
    You are welcome sephiroth11983 and enough of the Master salutation
    I'm a noob myself when it comes to programming, i have a loooong way to go. But i'm glad i could help a fellow noob.

    Cheers

  9. #9
    Senior Member nod684's Avatar
    Computer Details
    nod684's Computer Details
    Operating System:
    Windows 7 Home
    Discipline
    Architectural
    Using
    AutoCAD 2010
    Join Date
    Jul 2012
    Location
    Singapore
    Posts
    229

    Default

    nice work MASTER!
    "Memories fade but the scars still linger...."

  10. #10
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,780

    Default

    Registered forum members do not see this ad.

    One of the extra things you may like to add is when creating a new layout tab you can update your title block at same time with this layout name, so the original may have been 121 now the new one will show 122. It could also renumber the max number of sheets in the title. It would be pretty easy to add to Pbe code. Post if you want this option name of your titleblock.
    A man who never made mistakes never made anything

Similar Threads

  1. Move multiple layouts dwg to dwg
    By RRS1987 in forum AutoCAD Beginners' Area
    Replies: 6
    Last Post: 7th Feb 2012, 02:58 pm
  2. Replies: 10
    Last Post: 14th Sep 2010, 10:24 am
  3. Publish multiple layouts to PDF
    By shooter1 in forum AutoCAD Drawing Management & Output
    Replies: 5
    Last Post: 25th Jan 2010, 10:02 pm
  4. Plotting multiple layouts
    By MisterJingles in forum AutoCAD Beginners' Area
    Replies: 8
    Last Post: 24th Apr 2009, 03:52 pm
  5. Publish multiple layouts to PDF
    By NKG in forum AutoCAD Drawing Management & Output
    Replies: 3
    Last Post: 16th Sep 2008, 03:21 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts