Change to Layout Renumbering
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I found this LISP that will take all the layout tabs and renumber them from left to right starting at 01 and that is it. I wish that this program had 1 major feature and one minor:
Major) instead of starting at the far left tab, it would start at the currently selected tab (assuming it isn’t the model tab). Even better would be for me to select all the layout tabs to be renumbered first and it would just renumber those selected ones from left to right starting at 01. This will help me renumber for multiple disciplines.
Minor) An option would be that the program asks me if I want to start with 1 or 01 and work up from there.
I believe I have done a limited amount of programming to find my variable, but I am unable to fix the code to do what I need.
;;; layoutrenum
;;; renumbers all the layout tabs with the first being 01 and then renames them all sequentially
(defun c:layoutrenum ( / l n lz ls lt)
;;; Check to see if the number should be 01,02,09,10 or 1,2,9,10 or 001,002,010, 099, 100
(initget "Yes No")
(setq lz (getkword "\nDo you want leading 0's in front of Numbers? [Yes/No] <Yes>: "))
(if (not lz) (setq lz "Yes"))
;;; check to see which tab is selected (cannot be model tab)
(setq ls (getvar 'ctab))
;;; Checks to see the number of tabs which would include model space
(setq lt (length (layoutlist))
;;; Need to find out what layout number ls is of lt so the replacement can start there.
;;; Start replacement routine (need to not start at the beginning but at selected tab)
;;; Code below is from another person based on just going left to right and replacing with next number.
(vlax-for x (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
(if (= :vlax-false (vla-get-modeltype x))
(progn
(vla-put-name x (vla-get-handle x))
(setq l (cons x l))
)
)
)
(foreach x l
(setq n (itoa (vla-get-taborder x)))
(repeat (- 2 (strlen n)) (setq n (strcat "0" n)))
(vla-put-name x n)
)
(princ)
)
(vl-load-com) (princ)