Lee Mac Posted September 23, 2009 Posted September 23, 2009 (edited) This is a program I posted over at theSwamp.org, but I thought I'd share it with you guys here too. Just a project I was working on recently, written for a bit of fun. TabSort.lsp Version 2.2 Program Controls: Top: Move selected Tabs to the top of the list. Up: Move selected Tabs up one notch in the list. Down: Move selected Tabs down one notch in the list. Bottom: Move selected Tabs to the bottom of the list. Sort: Opens the Sort Dialog: Alphabetical: Sort Tabs alphabetically: Hence ~ ("A23" "C22" "B3" "E7") Becomes ~ ("A23" "B3" "C22" "E7") Numerical: Sort Tabs numerically: Hence ~ ("A23" "C22" "B3" "E7") Becomes ~ ("B3" "E7" "C22" "A23") Architectural: Use an Architectural Sorting Method: Hence ~ ("A-1A" "B-3" "A-10C" "B-1.2" "B-1") Becomes ~ ("A-1A" "A-10C" "B-1" "B-1.2" "B-3") Reverse: Reverse the Tab order. Pref/Suff: Opens the Prefix/Suffix Dialog to allow the user to add a Prefix and/or Suffix to selected/all Tabs. Add: Add a new layout Tab. Delete: Deletes selected Tabs. Copy: Copies the selected Tabs. Current: Makes the selected Tab the Current Tab. Find: Allows the user to perform a Find & Replace: Done: Finished sorting Tabs, will implement sorting. Reset: Will reset Tab names and Tab order ~ will not reset deleted/added Tabs. Screenshot: Enjoy! Lee Full Description here. TabSortV2-2.lsp Edited May 17, 2011 by Lee Mac 1 Quote
CADMASTER1128 Posted September 23, 2009 Posted September 23, 2009 Can this be used in AutoCAD Architectural Desktop 2004? Quote
CADMASTER1128 Posted September 23, 2009 Posted September 23, 2009 Just used in 2004, works very nice!! I am going to start using it often! Thanks a ton for the LISP!!!!! Quote
Lee Mac Posted September 23, 2009 Author Posted September 23, 2009 Glad you like it Steve I got the bug for adding things to it, and it went a bit out of control Quote
tzframpton Posted September 23, 2009 Posted September 23, 2009 Lee, this program is awesome. It has now instantly been incorporated into our ACADDOC.LSP file and already I'm working on an icon for our Tool Palettes. Thank you much for this very nice addition, my friend. Helps out a lot for us. Quote
CADMASTER1128 Posted September 23, 2009 Posted September 23, 2009 Glad you like it Steve I got the bug for adding things to it, and it went a bit out of control What else do you plan to add to it? Quote
Lee Mac Posted September 23, 2009 Author Posted September 23, 2009 Lee, this program is awesome. It has now instantly been incorporated into our ACADDOC.LSP file and already I'm working on an icon for our Tool Palettes. Thank you much for this very nice addition, my friend. Helps out a lot for us. Thanks Styk - glad you like it Its always great to know that a program is going to be useful for someone What else do you plan to add to it? Well, I had a few other ideas, such as the option of an increment in the Prefix/Suffix Dialog, but I didn't want to "over-do" it, and clutter the dialog too much... Quote
Lee Mac Posted September 23, 2009 Author Posted September 23, 2009 Code in first post updated to fix a bug that was causing a crash when deleting all tabs and resetting. Quote
Lee Mac Posted October 6, 2009 Author Posted October 6, 2009 I will not be visiting as regularly as I used to, due to the start of the university academic year, but the latest updates for this program can be found here: http://www.theswamp.org/index.php?topic=30262.0 Quote
ReMark Posted October 6, 2009 Posted October 6, 2009 Wishing you success in your academic studies this year Lee! You're presence will be missed. Quote
bogdancic26 Posted January 12, 2011 Posted January 12, 2011 Hello, Regarding the lisp routine "Tabsort v1.9" is there any way to re-number the layouts automaticaly? i have the layouts name something like (1) (2) (3) ... and i want to change in (73) (74) (75)... Of course the number of layouts in bigger (hundreds). Anyway the lisp is great and is very usefull. Thank you. Quote
Lee Mac Posted January 12, 2011 Author Posted January 12, 2011 Hi bogdancic26, Would you be able to accomplish your task using the existing Pref/Suffix and/or Find/Replace functionalities? Also, bear in mind that the latest version of the program is 2.1 Regards, Lee Quote
Lee Mac Posted January 12, 2011 Author Posted January 12, 2011 Try something like this: (defun c:LayoutNum ( / *error* _StartUndo _EndUndo doc pref suff l ) (vl-load-com) ;; © Lee Mac 2010 (defun *error* ( msg ) (if doc (_EndUndo doc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ) ) (defun _StartUndo ( doc ) (_EndUndo doc) (vla-StartUndoMark doc) ) (defun _EndUndo ( doc ) (if (= 8 (logand 8 (getvar 'UNDOCTL))) (vla-EndUndoMark doc) ) ) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (setq *num (1- (cond ( (getint (strcat "\nSpecify Starting Number <" (itoa (setq *num (1+ (cond ( *num ) ( 0 )) ) ) ) "> : " ) ) ) ( *num ) ) ) ) (setq pref (getstring t "\nSpecify Prefix <None>: ") suff (getstring t "\nSpecify Suffix <None>: ") ) (_StartUndo doc) (mapcar (function (lambda ( layout ) (vla-put-name layout (strcat pref (itoa (setq *num (1+ *num))) suff)) ) ) (vl-sort (vlax-for layout (vla-get-Layouts doc) (if (not (eq "MODEL" (strcase (vla-get-Name layout)))) (setq l (cons layout l)) ) l ) (function (lambda ( a b ) (< (vla-get-TabOrder a) (vla-get-TabOrder b))) ) ) ) (_EndUndo doc) (princ) ) Quote
alanjt Posted January 12, 2011 Posted January 12, 2011 Something similar I did a while back... (defun c:TabInc (/ pre suf num) ;; Tab Increment ;; Rename layout tabs with number, based on location ;; Prefix and Suffix optional ;; Alan J. Thompson, 02.25.09 / 04.08.10 / 12.16.10 (setq pre (getstring T "\nSpecify prefix <None>: ")) (setq suf (getstring T "\nSpecify suffix <None>: ")) (initget 6) (setq num (1- (cond ((getint "\nSpecify starting number <1>: ")) (1) ) ) ) (vlax-for x (vla-get-layouts (cond (*AcadDoc*) ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object) ) ) ) ) ) (vl-catch-all-apply (function vla-put-name) (list x (strcat (rtos (getvar 'date) 2 16) "-" (itoa (vla-get-taborder x)))) ) ) (vlax-for x (vla-get-layouts *AcadDoc*) (vl-catch-all-apply (function vla-put-name) (list x (strcat pre (itoa (+ num (vla-get-taborder x))) suf)) ) ) (princ) ) Quote
bogdancic26 Posted January 13, 2011 Posted January 13, 2011 (edited) Thank you Lee and Alanjt, Both routine is working for what i want. You did a great work. Have a great day! Edited January 13, 2011 by bogdancic26 Quote
Lee Mac Posted January 13, 2011 Author Posted January 13, 2011 You're welcome Bogdancic, have a nice day too Quote
Lee Mac Posted May 17, 2011 Author Posted May 17, 2011 Finally decided it was time to give this program a complete overhaul Version 2.2 is a complete rewrite of the program to update many of the old subfunctions, and to reformat the code to get rid of that terrible formatting I used to use. I haven't added any new functionality, but the program should be more robust and run smoother than the previous version, with a few bugs squashed in the process. The Find and Replace engine has been completely rewritten, now permitting the user to use self-referencing find and replace terms (for example, replacing 'ABC' with 'AB'), and the visual feedback during the find and replace process has been improved significantly. With the vast number of changes to the program, I expect there are still a few bugs lurking, but in my preliminary tests, I haven't found anything as yet (but I'm sure you guys will!). Enjoy! Lee Quote
tzframpton Posted May 17, 2011 Posted May 17, 2011 Awesome Lee, thanks again. This is one of my most beloved programs I use practically on a daily basis. Quote
Lee Mac Posted May 17, 2011 Author Posted May 17, 2011 Awesome Lee, thanks again. This is one of my most beloved programs I use practically on a daily basis. Cheers Styk, its great to hear a program is being put to good use Enjoy my friend 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.