Jump to content

Batch rename and increment layout tabs easily


Recommended Posts

Posted

I'm not sure if it possible although I am trying to rename layout tabs an easier way. Say I have layout tabs A01 to A99 and I want to insert another layout tab at position A20. I need to rename (the old) A20 to A21, then A21 to A22 then A99 to A100 etc.

 

Does anyone know of a fast way to do this or a lisp that does this. I've tried Lee macs TabSort lisp which is great although doesn't help much in this case.

Posted

Can be done the trick is to change the tab names first then add a tab, pretty sure in Lee's stuff there is a reorder tabs, you have to be carefull the tab list is different to the tab display order.

 

Should be able to do a get tabnae and then do a put-tabname

 

a start

(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for lay (vla-get-Layouts doc)
 (setq plotabs (cons (vla-get-name lay) plotabs)) ; get its name and then maybe use a put adding +1 see add to end of text
)
(setq plotabs (vl-sort plotabs '<))

 

You may need this also thanks to lee

;;-------------------=={ Parse Numbers }==--------------------;;
;;                                                            ;;
;;  Parses a list of numerical values from a supplied string. ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - [url="http://www.lee-mac.com"]www.lee-mac.com[/url]       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  s - String to process                                     ;;
;;------------------------------------------------------------;;
;;  Returns:  List of numerical values found in string.       ;;
;;------------------------------------------------------------;;
(defun LM:ParseNumbers ( s )
 (
   (lambda ( l )
     (read
       (strcat "("
         (vl-list->string
           (mapcar
             (function
               (lambda ( a b c )
                 (if
                   (or
                     (< 47 b 58)
                     (and (= 45 b) (< 47 c 58) (not (< 47 a 58)))
                     (and (= 46 b) (< 47 a 58) (< 47 c 58))
                   )
                   b 32
                 )
               )
             )
             (cons nil l) l (append (cdr l) (list nil))
           )
         )
         ")"
       )
     )
   )
   (vl-string->list s)
 )
)

  • 9 months later...

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