issammesk Posted April 4, 2018 Share Posted April 4, 2018 hi sir please if you can help me i have sheet with layout name start from BWSIP-2R-DD-TP-M01 to BWSIP-2R-DD-TP-M10 now i take copy from this sheet but i want to rename layout name frome 01..10 to BWSIP-2R-DD-TP-M02 to BWSIP-2R-DD-TP-M20 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 4, 2018 Share Posted April 4, 2018 In the time it takes to work out a lisp they could be renamed just click on the last one and use "Rename" option if you have more than 10 and this occurs all the time then please confirm. Quote Link to comment Share on other sites More sharing options...
issammesk Posted April 4, 2018 Author Share Posted April 4, 2018 thank sir for you replay really yes always we have project some time more 70 layout in on sheet and we copied for other design Quote Link to comment Share on other sites More sharing options...
Dadgad Posted April 4, 2018 Share Posted April 4, 2018 You should take a look at http://www.lee-mac.com/layoutfield.html by Lee Mac. Thanks Lee! I have not used it myself, but it looks pretty great. Not that we would expect anything less from Lee Mac! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 4, 2018 Share Posted April 4, 2018 Found a couple of minutes try this it has no error checking about layout names and numbers within. (vl-load-com) (defun renumlayout ( / doc tabs len tabsnewnum lenstr layname) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (setq tabs (vla-get-Layouts doc)) (setq len (vla-get-count tabs)) (alert (rtos len 2 0)) (setq newnum (getint "input last layout number")) (if (> newnum len) (vlax-for layname tabs (setq tabname (vla-get-name layname)) (if (= "Model" tabname) (princ) (progn (setq lenstr (strlen tabname)) (setq tabname (substr tabname 1 (- lenstr 2))) (vla-put-name layname (strcat tabname (rtos newnum 2 0))) ) ) (setq newnum (- newnum 1)) ) ) (princ) ) (renumlayout) Quote Link to comment Share on other sites More sharing options...
SLW210 Posted April 4, 2018 Share Posted April 4, 2018 I moved your thread to the AutoLISP, Visual LISP & DCL Forum. Quote Link to comment Share on other sites More sharing options...
ronjonp Posted April 4, 2018 Share Posted April 4, 2018 Here's a quick example: (defun c:foo (/ i l n o) ;; Prefix (setq pre "BWSIP-2R-DD-TP-M") ;; Start number (setq n 1) ;; Get all paperspace layouts (vlax-for x (setq lo (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))) (cond ((> (vla-get-taborder x) 0) (setq o (cons x o)))) ) ;; Sort left to right (setq o (vl-sort o '(lambda (r j) (< (vla-get-taborder r) (vla-get-taborder j))))) ;; Apply a temp name to avoid duplicates (foreach l o (vla-put-name l (rtos (/ (getvar 'cdate) (vla-get-taborder l)) 2 12))) ;; Renumber (foreach l o (setq i (cond ((< n 10) (strcat "0" (itoa n))) ((itoa n)) ) ) (vla-put-name l (strcat pre i)) (setq n (1+ n)) ) (princ) ) (vl-load-com) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 4, 2018 Share Posted April 4, 2018 < ... > ;; Apply a temp name to avoid duplicates (foreach l o (vla-put-name l (rtos (/ (getvar 'cdate) (vla-get-taborder l)) 2 12))) < ... > Interesting - I typically use the Layout Handle Quote Link to comment Share on other sites More sharing options...
ronjonp Posted April 4, 2018 Share Posted April 4, 2018 Interesting - I typically use the Layout Handle That's because you're smarter than me Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted April 4, 2018 Share Posted April 4, 2018 I am not sure I understand Lee's suggestion, but in theory a layout may have a name that matches the handle of another layout. So using layout handles as temporary names can be risky. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 4, 2018 Share Posted April 4, 2018 I am not sure I understand Lee's suggestion, but in theory a layout may have a name that matches the handle of another layout. So using layout handles as temporary names can be risky. That applies to any methodology you choose... Quote Link to comment Share on other sites More sharing options...
Mystogan Posted April 9, 2018 Share Posted April 9, 2018 Requesting for a LSP that can change layout tab from its original tab name into a new name(user defined). Hoping you can help me creating this script data. Would like to create a batch layout rename. TIA Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.