itacad Posted November 29, 2022 Share Posted November 29, 2022 Hello, I have a stupid problem but how often I do this makes it become important. Is it possible to create a copy of a layout by placing it near to the original layout? I have files with many layouts, and this operation forces me to waste time every time to move the new layouts created (which are placed either at the beginning or at the end of existing layouts). Thanks in advance for any help Quote Link to comment Share on other sites More sharing options...
devitg Posted November 30, 2022 Share Posted November 30, 2022 15 hours ago, itacad said: Hello, I have a stupid problem but how often I do this makes it become important. Is it possible to create a copy of a layout by placing it near to the original layout? I have files with many layouts, and this operation forces me to waste time every time to move the new layouts created (which are placed either at the beginning or at the end of existing layouts). Thanks in advance for any help A simple google copy of a layout Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 1, 2022 Share Posted December 1, 2022 I think Itacad wants like copy layout3 so new is now layout4 not layout23. A copy is added to end of layouts. You can reset the layout order so get layout name to be copied and find its current postion then find last and push all layouts to new order. Note need to remove "MODEL" from the vla-get-layouts. Started it but struggling for time. Quote Link to comment Share on other sites More sharing options...
tombu Posted December 1, 2022 Share Posted December 1, 2022 I've always Ctrl+pick, dragged & dropped the layout to whatever location I wanted the copy to be at. If you want all the bells and whistles Lee Mac's TabSort may be what you're looking for. Quote Link to comment Share on other sites More sharing options...
itacad Posted December 1, 2022 Author Share Posted December 1, 2022 Thanks everyone for your opinions, I know TabSort lisp very well and it saves me a lot of time! that is great! Unfortunately, when working with files of up to 240 layouts, the trivial operation of creating a copy of a layout but finding it "distant" from the original wastes a lot of time for moving. Fortunately TabSort speeds up the sorting operation a lot Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 10, 2022 Share Posted December 10, 2022 (edited) Sorry it took so long I lost my to do list and found again. Give this a try. ; https://www.cadtutor.net/forum/topic/76384-place-layout-copy-next-to-the-original/ ; By Alanh DEC 2022 (defun c:tab-after ( / tabs pos1 pos2 lst lst2 x cnt layname layname2) (vl-load-com) (setq layname (strcase (getstring "\nEnter Layout name to copy "))) (setq layname2 (getstring "\nEnter New layout name ")) (command "layout" "C" layname layname2) (setq tabs (vla-get-Layouts (vla-get-Activedocument (vlax-get-acad-object)))) (setq cnt (- (vla-get-count tabs) 1)) (setq lst '()) (vlax-for tab tabs (setq lst (cons (list (vla-get-TabOrder tab) (vla-get-name tab) ) lst)) ) (setq lst (vl-remove (list 0 "Model") lst)) (setq lst (vl-sort lst '(lambda (x y) (< (car x)(car y))))) (setq x 0 lst2 '()) (repeat (- (length lst) 1) (if (= (strcase (cadr (nth x lst)))layname) (progn (setq lst2 (cons (nth x lst) lst2)) (setq lst2 (cons (last lst) lst2)) ) (setq lst2 (cons (nth x lst) lst2)) ) (setq x (1+ x)) ) (setq lst2 (reverse lst2)) (setq cnt 1) (foreach lay lst2 (vla-put-taborder (vla-item (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))(cadr lay)) cnt) (setq cnt (1+ cnt)) ) (setvar 'ctab layname2) (princ "\nTo run again type tab-after ") (princ) ) (c:tab-after) We used a simple layout naming convention D01 D02 etc so for me the extra step is do a rename of all layouts to new order. The other is renumber the sheet numbers in the title blocks in the layouts. Edited December 12, 2022 by BIGAL Quote Link to comment Share on other sites More sharing options...
itacad Posted December 11, 2022 Author Share Posted December 11, 2022 Thank you for your works! I tried it and I report this anomaly: At the end of the lisp execution, the new layout is created to the right of the layout indicated for copying, but between them is placed the last layout that already existed before the lisp execution. Maybe it depends on the method I name the layouts? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 12, 2022 Share Posted December 12, 2022 (edited) I did not do anything about checking layout names, yes d01 is different to D01, if wrong will add to end, have adjusted code to removes case problem. Edited December 12, 2022 by BIGAL 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.