Author Topic: rename layout tabs??  (Read 14609 times)

0 Members and 1 Guest are viewing this topic.

One Shot

  • Guest
rename layout tabs??
« Reply #15 on: October 01, 2004, 05:16:45 PM »
Quote from: CAB
Keith, man you are fast... 8)

Here is a lisp version.
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:re-name-layouts (/ 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 re-name-layouts to run. *-*")
(princ)


CAB,

This is really cool!  Here is a question that I think can it can be done but I don't know where to start.  Please just follow what it is saying.

Ok, lets start with a 4 tabs for sheets
in paper space.  Lets say that you name the 4 tabs BFDS, BFDW, CFP01 and
CFP02.

Now take the shape (dwg area in model) of the view port from the tab BFDS and paste it into model space.

You want that shape (dwg area in model) to match the name of the tab.  So you name the shape (dwg area in model) BFDS with text.

But I want to have that name of shape (dwg area in model) automatically
change with Rtext.  So when you change that tab BFDS to BFINB.

The shape (dwg area in model) will automatically update to BFINB.

That is my question.

How would you do that with the rest of that tabs BFDW, CFP01 and CFP02?  Is there a sequence diesel code for each tab?

danny

  • Guest
rename layout tabs??
« Reply #16 on: October 01, 2004, 05:49:07 PM »
keith,
how do I use your VBA macro.  I have 80 files where some of the layout tabs where renamed and some not.  I would like to rename to layout1 instead of the sheet number, but if it requires opening every dwg I'll have to ignore it.  BrowseForFolder macro?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
rename layout tabs??
« Reply #17 on: October 01, 2004, 06:52:28 PM »
Oneshot,
What you are asking is possible and i think would require a reactor.
I have not delt with reactors so I can not help you at this time.
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.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
rename layout tabs??
« Reply #18 on: October 01, 2004, 08:29:35 PM »
Quote from: danny
keith,
how do I use your VBA macro.  I have 80 files where some of the layout tabs where renamed and some not.  I would like to rename to layout1 instead of the sheet number, but if it requires opening every dwg I'll have to ignore it.  BrowseForFolder macro?

I'll have to put together that BrowseForFolder macro and post it.... there will be some additional coding required,  but it will streamline the process so that it will all happen in a matter of a couple of minutes, rather than a couple of hours of your time.
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

hendie

  • Guest
rename layout tabs??
« Reply #19 on: October 02, 2004, 07:25:22 AM »
Quote from: One Shot

CAB,

This is really cool!  Here is a question that I think can it can be done but I don't know where to start.  Please just follow what it is saying.

Ok, lets start with a 4 tabs for sheets
in paper space.  Lets say that you name the 4 tabs BFDS, BFDW, CFP01 and
CFP02.

Now take the shape (dwg area in model) of the view port from the tab BFDS and paste it into model space.

You want that shape (dwg area in model) to match the name of the tab.  So you name the shape (dwg area in model) BFDS with text.

But I want to have that name of shape (dwg area in model) automatically
change with Rtext.  So when you change that tab BFDS to BFINB.

The shape (dwg area in model) will automatically update to BFINB.

That is my question.

How would you do that with the rest of that tabs BFDW, CFP01 and CFP02?  Is there a sequence diesel code for each tab?


have a look at the A-MTEXT lisp in your Sample > Visual Lisp > Reactors directory. it adds Mtext linked to a circle ~ if you modify the circle, the mtext changes to reflect that. It should be able to be modified to suit your needs.

One Shot

  • Guest
rename layout tabs??
« Reply #20 on: October 04, 2004, 01:26:09 PM »
Quote from: hendie
Quote from: One Shot

CAB,

This is really cool!  Here is a question that I think can it can be done but I don't know where to start.  Please just follow what it is saying.

Ok, lets start with a 4 tabs for sheets
in paper space.  Lets say that you name the 4 tabs BFDS, BFDW, CFP01 and
CFP02.

Now take the shape (dwg area in model) of the view port from the tab BFDS and paste it into model space.

You want that shape (dwg area in model) to match the name of the tab.  So you name the shape (dwg area in model) BFDS with text.

But I want to have that name of shape (dwg area in model) automatically
change with Rtext.  So when you change that tab BFDS to BFINB.

The shape (dwg area in model) will automatically update to BFINB.

That is my question.

How would you do that with the rest of that tabs BFDW, CFP01 and CFP02?  Is there a sequence diesel code for each tab?


have a look at the A-MTEXT lisp in your Sample > Visual Lisp > Reactors directory. it adds Mtext linked to a circle ~ if you modify the circle, the mtext changes to reflect that. It should be able to be modified to suit your needs.


I have the A-Mtext.lisp open and know I am trying to figure out what do I need to change to make it work to my liking.  Can someone help me out?

One Shot

  • Guest
rename layout tabs??
« Reply #21 on: October 12, 2004, 05:44:27 PM »
I have been trying to figures this out.  I am have no luck with it.  Can someone help me out?  Thank you!

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
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.

ELOQUINTET

  • Guest
rename layout tabs??
« Reply #24 on: October 13, 2004, 12:39:47 PM »
cab just used your rename routine wooooow works beautifully

CADaver

  • Guest
rename layout tabs??
« Reply #25 on: October 13, 2004, 01:29:37 PM »
Okay, I have to ask the question.  I tried not to, but I just can't help it, I gotta know.  

What the heck is the advantage in changing the name of the layout tab back to layout1?

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
rename layout tabs??
« Reply #26 on: October 13, 2004, 02:23:39 PM »
got me... but you know I don't usually question why someone would like to do something .. perhaps I should ... but when it has absolutely no bearing on me, I couldn't care less
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

pmvliet

  • Guest
rename layout tabs??
« Reply #27 on: October 13, 2004, 02:27:41 PM »
Well I have a couple reasons:

First I have a 1-button routine that will plot to any device/size paper
but it requires that Layout1 is named Layout 1

Secondly, when you create a plot file or PDF, AutoCad will put the file name and then put a -layout name. For a drawings named A-101.dwg
with a layout called A-101, the plot file is A-101-A-101.plt. It gets to be a real nuisance.

Third, I see no real value and just takes time and more upkeep in a drawing. As soon as you do a saveas, if you don't go and update your layout name you will start getting inconsistencies. It just leads to errors.

Pieter

One Shot

  • Guest
rename layout tabs??
« Reply #28 on: October 13, 2004, 02:33:11 PM »
Quote from: pmvliet
Well I have a couple reasons:

First I have a 1-button routine that will plot to any device/size paper
but it requires that Layout1 is named Layout 1

Secondly, when you create a plot file or PDF, AutoCad will put the file name and then put a -layout name. For a drawings named A-101.dwg
with a layout called A-101, the plot file is A-101-A-101.plt. It gets to be a real nuisance.

Third, I see no real value and just takes time and more upkeep in a drawing. As soon as you do a saveas, if you don't go and update your layout name you will start getting inconsistencies. It just leads to errors.

Pieter



try this string with RText.  This is set to read the file name and then tab name.  Look at the RText where you put it.  I should only say A-101.  So when you plt the file, it will say A-101.plt.

$(substr,$(getvar,"dwgname"),1,$(-,$(strlen,($(getvar,"dwgname"))),6))$(getvar,"ctab")

ronjonp

  • Needs a day job
  • Posts: 7529
rename layout tabs??
« Reply #29 on: October 13, 2004, 05:13:25 PM »
I added a dialogue box to Keith's VBA routine and also added the suffix option like CAB's lisp. Edit: Also added a start number so you could designate what number you want the first tab to start numbering from.

http://theswamp.org/lilly.pond/Ron/rename.bmp

Here is the dvb:
http://theswamp.org/lilly.pond/Ron/rename_tabs.dvb


To run it, type -vbarun then renametabs.

For button access ^C^C-vbarun;renametabs;

Ron :D

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC