Millsy29 Posted July 13, 2010 Posted July 13, 2010 As part of my archive procedure we leave the empty shell of the drawing in the archive folder next to an etransmit so you know if you are about to over wright an archived drawing and the deleting of tabs is just part of the cleaning process. so basically if a drawing has 5 tabs we archive 5 time 1 for each layout tab each time removing all other tabs. i would like to automatically delete all tabs beside one chosen tab, whether it is the current tab or the name typed in via a lisp routine. i have been given a lisp routine below that deletes all. (defun c:deletetabs () (setq *doc (cond (*doc) ((vla-get-ActiveDocument (vlax-get-acad-object))))) (vlax-for lay (vla-get-layouts *doc) (if (not (eq "MODEL" (strcase (vla-get-Name lay)))) (vla-delete lay))) ) can anyone help? millsy Quote
Lee Mac Posted July 13, 2010 Posted July 13, 2010 I'll leave you to come up with a more concise syntax... (defun c:DeleteAllButCurrentTab nil (vl-load-com) ;; © Lee Mac 2010 (vlax-for l (vla-get-Layouts (vla-get-ActiveDocument (vlax-get-acad-object) ) ) (if (not (vl-position (strcase (vla-get-name l)) (cons (strcase (getvar 'CTAB)) '("MODEL") ) ) ) (vla-delete l) ) ) (princ) ) Quote
alanjt Posted July 13, 2010 Posted July 13, 2010 Specify filter string... (defun LayoutDeleteExcept (except) (vlax-for x (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) (or (wcmatch (strcase (vla-get-name x)) (strcase (strcat "MODEL," except))) (vla-delete x) ) ) ) eg. (LayoutDeleteExcept "Layout*") Quote
VVA Posted July 13, 2010 Posted July 13, 2010 Added a little interface to # 3 (defun C:DT (/ pat) ;;; Delete Tabs (vl-load-com) (and (setq pat (mydcl "Select Save Layout" (acad_strlsort (layoutlist)))) (LayoutDeleteExcept pat) ) (princ) ) ;_ end of defun (defun LayoutDeleteExcept (except) (vlax-for x (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) (or (wcmatch (strcase (vla-get-name x)) (strcase (strcat "MODEL," except))) (vla-delete x) ) ) ) (defun mydcl (zagl info-list / fl ret dcl_id) (vl-load-com) (if (null zagl) (setq zagl "Select") ) ;_ end of if (setq fl (vl-filename-mktemp "mip" nil ".dcl")) (setq ret (open fl "w")) (mapcar '(lambda (x) (write-line x ret)) (list "mip_msg : dialog { " (strcat "label=\"" zagl "\";") " :list_box {" "alignment=top ;" "width=51 ;" "tabs = \"16 32\";" "tab_truncate = true;" (if (> (length info-list) 26) "height= 26 ;" (strcat "height= " (itoa (+ 3 (length info-list))) ";") ) ;_ end of if "is_tab_stop = false ;" "key = \"info\";}" "ok_cancel;}" ) ;_ end of list ) ;_ end of mapcar (setq ret (close ret)) (if (and (not (minusp (setq dcl_id (load_dialog fl)))) (new_dialog "mip_msg" dcl_id) ) ;_ end of and (progn (start_list "info") (mapcar 'add_list info-list) (end_list) (set_tile "info" "0") (setq ret (car info-list)) (action_tile "info" "(setq ret (nth (atoi $value) info-list))" ) ;_ end of action_tile (action_tile "cancel" "(progn(setq ret nil)(done_dialog 0))" ) ;_ end of action_tile (action_tile "accept" "(done_dialog 1)") (start_dialog) ) ;_ end of progn ) ;_ end of if (unload_dialog dcl_id) (vl-file-delete fl) ret ) ;_ end of defun Quote
Millsy29 Posted July 14, 2010 Author Posted July 14, 2010 thanks everyone i'll go away and try it, i'll let you know how i get on. millsy Quote
Millsy29 Posted July 14, 2010 Author Posted July 14, 2010 VVA that works brilliantly, thank you millsy Quote
James281 Posted May 13, 2011 Posted May 13, 2011 can anyone please modify one of the lisp to delete only 2-3 tab depend on the tab name? like i have 20 tab on my template but sometime only want 16 of them and 4 of them i always want to delete. thanks, James Quote
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.