Jump to content

Renaming All Layouts consecutively


sephiroth11983

Recommended Posts

Greetings,

 

I would like to inquire about editing an LISP (got it here from Sir LEEMAC's post in "Rename Layouts")

 

my problem is we do alot of layouts in a single cad file.. example is 150 layouts and named ex. 1001,1002,1003,1004.... then another set named 2001,2002, etc. in renaming the layouts (layoutlist) it is so time consuming to rename all when. example is the 1000 series will be renamed to 3000 series... im still trying to make my own lisp based on what i read here. but it doesnt work..obviously wrong strings. here is my lsp (being studied and edited till now sir T_T)

 

(defun c:RAL (/ laylist xth)
   (setvar "cmdecho" 0)
   (setq laylist (layoutlist)
    lnum (getint "\n Layout numbering starts with? ")
    xth      1
   
   ) ;_  end setq
   (foreach x laylist
   (command "-layout" "R" laylist (lnum (itoa xth)))
   (setq xth (1+ xth))
   ) ;_  end foreach
   (setvar "cmdecho" 1)
   (princ)
) ;_  end defun

I just copied Sir LEEMAC's LISP file and tried to edit it. testing it.

 

I hope someone can help me. sir PBE, Bigal and Sir LEE Mac. ^_^

 

Thank you and more power

Edited by sephiroth11983
Link to comment
Share on other sites

For the layouts maybe something like

 

; not tested
(setq newtab (getint "\nEnter start number"))
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for lay (vla-get-Layouts doc)
  (vla-put-name newtab lay)
(setq newtab (+ 1 newtab))
)

Link to comment
Share on other sites

(defun c:RAL (/ laylist n)
 (setvar "cmdecho" 0)
 (setq	laylist	(layoutlist)
lnum	(getint "\n Layout numbering starts with? ")
 ) ;_  end setq
[color="blue"]  (setq	n (*
    (- lnum (/ (atoi (car laylist)) 1000))
    1000
  )
 )[/color]
 (foreach x laylist
   (command "-layout"
     "R"
    [color="blue"] x
     (itoa (+ (atoi x) n))[/color]
   )
 ) ;_  end foreach
 (setvar "cmdecho" 1)
 (princ)
)

Link to comment
Share on other sites

thanks Pbe for the correction of my too many error lisp...:D

 

Sir Bigal, the parameters you gave, ill try to put it in my lisp so that i can different testings...

 

maybe in the future, i can mix up alphanumeric naming of layouts..Thanks to everyone...

Link to comment
Share on other sites

Not long ago it was either Lee or PBe posted a simple way of pulling apart text that is say alphas and numbers, this way you can adjust the numbers, start with Lee-macs .

 

;;-------------------=={ Parse Numbers }==--------------------;;

;; ;;

;; Parses a list of numerical values from a supplied string. ;;

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

;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;;

Link to comment
Share on other sites

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