Author Topic: rename layouts tabs revisited  (Read 3225 times)

0 Members and 1 Guest are viewing this topic.

Eloquintet

  • Gator
  • Posts: 3206
rename layouts tabs revisited
« on: November 09, 2004, 03:52:30 PM »
cab i was just about to use your rename layouts routine when i realized it would rename my template layouts too. i was wondering if it would be possible to incorporate the same sort of ~ prefix omission as you did for plottabs to this routine so my template stay as is?


Code: [Select]
;;; FUNCTION
;;;  This routine will rename all layout tabs with
;;;   user entered prefix & number or letter suffix
;;;
;;; ARGUMENTS
;;; none
;;;
;;; USAGE
;;;  re-name-layouts
;;;
;;; PLATFORMS
;;;  2000+
;;;
;;; AUTHOR
;;; Copyright© 2004 Charles Alan Butler
;;; ab2draft@TampaBay.rr.com
;;;
;;; VERSION
;;;  1.0 Oct. 01, 2004
;;;
;;;  This software is provided "as is" without express or implied      ;
;;;  warranty.  All implied warranties of fitness for any particular   ;
;;;  purpose and of merchantability

 are hereby disclaimed.             ;
;;;  You are hereby granted permission to use, copy and modify this    ;
;;;  software without charge, provided you do so exclusively for       ;
;;;  your own use or for use by others in your organization in the     ;
;;;  performance of their normal duties, and provided further that     ;
;;;  the above copyright notice appears in all copies and both that    ;
;;;  copyright notice and the limited warranty and restricted rights   ;
;;;  notice appear in all supporting documentation.                    ;
;;;
(defun c:rnl (/ tab_name doc cnt x suffix new_list)
  (vl-load-com)
  (setq tab_name (getstring t "\nEnter Tab Name prefix (add trailing space): "))
  (cond (tab_name) ((setq tab_name "")))
  (initget "Numbers Letters")
  (setq suffix (getkword "\nSuffix to use? [Numbers or Letters] : <Numbers> "))
  (cond (suffix) ((setq suffix "Numbers")))
  (setq *doc* (vla-get-activedocument (vlax-get-acad-object)))

  (vlax-for tab (vla-get-layouts ; get list of layout tabs
                  (vla-get-activedocument (vlax-get-acad-object)))
    (if (/= (setq tmpname (vla-get-name tab)) "Model") ; omit MODEL space
      (setq new_list (cons (cons (vla-get-taborder tab) tab) new_list))
    )
  )
  ;;  sort list acording to tab order
  (setq new_list (vl-sort new_list
                  '(lambda (e1 e2) (< (car e1) (car e2)))))
  ;;remove the taborder numbers
  (setq new_list (mapcar 'cdr new_list))

  ;; rename the tabs
  (setq cnt (cond ((= suffix "Numbers") 0) (64)))
  (foreach x new_list
    (vla-put-name x
       (strcat tab_name
               (cond
                 ((= suffix "Numbers")
                   (itoa (setq cnt (1+ cnt))))
                 ((chr (setq cnt (1+ cnt))))
               )))
  )
  (princ)
) ; defun
(prompt "\n*-*  Rename Tab layouts Loaded, Enter rnl to run. *-*")
(princ)
Dan

AutoCAD Architecture 2015

CAB

  • Global Moderator
  • Seagull
  • Posts: 10395
rename layouts tabs revisited
« Reply #1 on: November 09, 2004, 04:26:03 PM »
Like This?
Code: [Select]
;;; FUNCTION
;;;  This routine will rename all layout tabs with
;;;   user entered prefix & number or letter suffix
;;;
;;; ARGUMENTS
;;; none
;;;
;;; USAGE
;;;  re-name-layouts
;;;
;;; PLATFORMS
;;;  2000+
;;;
;;; AUTHOR
;;; Copyright© 2004 Charles Alan Butler
;;; ab2draft@TampaBay.rr.com
;;;
;;; VERSION
;;;  1.0 Oct. 01, 2004
;;;  2.0 Nov. 09, 2004
;;;
;;;  This software is provided "as is" without express or implied      ;
;;;  warranty.  All implied warranties of fitness for any particular   ;
;;;  purpose and of merchantability are hereby disclaimed.             ;
;;;  You are hereby granted permission to use, copy and modify this    ;
;;;  software without charge, provided you do so exclusively for       ;
;;;  your own use or for use by others in your organization in the     ;
;;;  performance of their normal duties, and provided further that     ;
;;;  the above copyright notice appears in all copies and both that    ;
;;;  copyright notice and the limited warranty and restricted rights   ;
;;;  notice appear in all supporting documentation.                    ;
;;;
(defun c:re-name-layouts (/ tab_name doc cnt x suffix new_list excludechr
                            excludetab)
  (vl-load-com)
  (setq excludechr "~"
        excludetab T)
  (setq tab_name (getstring t "\nEnter Tab Name prefix (add trailing space): "))
  (cond (tab_name) ((setq tab_name "")))
  (initget "Numbers Letters")
  (setq suffix (getkword "\nSuffix to use? [Numbers or Letters] : <Numbers> "))
  (cond (suffix) ((setq suffix "Numbers")))
  (setq *doc* (vla-get-activedocument (vlax-get-acad-object)))

  (vlax-for tab (vla-get-layouts ; get list of layout tabs
                  (vla-get-activedocument (vlax-get-acad-object)))
    (if (/= (setq tmpname (vla-get-name tab)) "Model") ; omit MODEL space
      (setq new_list (cons (cons (vla-get-taborder tab) tab) new_list))
    )
  )
  ;;  sort list acording to tab order
  (setq new_list (vl-sort new_list
                  '(lambda (e1 e2) (< (car e1) (car e2)))))
  ;;remove the taborder numbers
  (setq new_list (mapcar 'cdr new_list))

  ;; rename the tabs
  (setq cnt (cond ((= suffix "Numbers") 0) (64)))
  (foreach x new_list
    (if (not (and excludetab (vl-string-search excludechr (vla-get-name x))))
      (vla-put-name x
        (strcat tab_name
               (cond
                 ((= suffix "Numbers")
                   (itoa (setq cnt (1+ cnt))))
                 ((chr (setq cnt (1+ cnt))))
               ))))
  )
  (princ)
) ; defun
(prompt "\n*-*  Rename Tab layouts Loaded, Enter re-name-layouts to run. *-*")
(princ)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ronjonp

  • Needs a day job
  • Posts: 7307
rename layouts tabs revisited
« Reply #2 on: November 09, 2004, 04:31:19 PM »
Here is another tab renaming program that Keith gave me. I just made a dialogue for it and added a start number and suffix....don't know if this helps, but here you go.

http://theswamp.org/lilly_pond/ronjonp/renametabs.dvb?nossi=1

to run....appload dvb then type -vbarun renametabs

Ron

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

Eloquintet

  • Gator
  • Posts: 3206
rename layouts tabs revisited
« Reply #3 on: November 09, 2004, 04:44:51 PM »
ya know this is gettin reeeeeally anoying just tried the routine and this one doesn't work nor does the other. i am getting that activex message on these too  :evil:  :evil:  :evil:
Dan

AutoCAD Architecture 2015

ronjonp

  • Needs a day job
  • Posts: 7307
rename layouts tabs revisited
« Reply #4 on: November 09, 2004, 05:24:15 PM »
The dvb doesn't work either?

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16867
  • Superior Stupidity at its best
rename layouts tabs revisited
« Reply #5 on: November 09, 2004, 05:30:08 PM »
It looks like Dan may have corrupted something that requires a repair re-install
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Eloquintet

  • Gator
  • Posts: 3206
rename layouts tabs revisited
« Reply #6 on: November 10, 2004, 11:05:50 AM »
by the way just tried out your rename layout tweak cab and it works beautifully just what i meant thanks alot buddy. ahhhhhhh exhale
Dan

AutoCAD Architecture 2015