MKearney028 Posted November 8, 2010 Posted November 8, 2010 Can anyone help me edit the LISP for TCOUNT to include the text for Multileaders? I've added (0 . "MULTILEADER") to the LISP but it will not edit the text. I haven't done much with LISP's, so any help would be appreciated. Thanks. Quote
Lee Mac Posted November 8, 2010 Posted November 8, 2010 What code are you referring to? My program here? Quote
alanjt Posted November 8, 2010 Posted November 8, 2010 What code are you referring to? My program here? Express Tool: TCount Quote
MKearney028 Posted November 8, 2010 Author Posted November 8, 2010 Express Tool: TCount Sorry, I should have mentioned that. Yes, it is the express tool TCount. alanjt, while searching for an answer to this question, I came across a previous post of yours here: http://www.cadtutor.net/forum/showthread.php?40266-CopyText.lsp-Copy-Swap-Text-MText-Multileader-Attribute-Values The reason this caught my eye is because you were able to modify the text in a multileader through a lisp, which is what I need to do. However, the code was not in that post, so I couldn't look at it to figure it out. Quote
Lee Mac Posted November 8, 2010 Posted November 8, 2010 Sorry, I should have mentioned that. Yes, it is the express tool TCount. No worries Quote
alanjt Posted November 8, 2010 Posted November 8, 2010 (assoc 304 (entget )) or (vla-get-TextString ) Quote
MKearney028 Posted November 9, 2010 Author Posted November 9, 2010 Hmmm...I think I'm still missing something. In the file ACETXT.LSP provided with the Express Tools, there is this: (setq flt '((-4 . " (0 . "TEXT") (0 . "MTEXT") (0 . "ATTDEF") (-4 . "OR>") ) );setq From my breif understanding of Lisp routines, that's setting up a query for text, mtext or an attribute definetion. If I add the line (assoc 304 (entget )) or (vla-get-TextString ), I get "bad SSGET list" when I try to run the routine. I'm not quite sure how that line of code is supposed to fit in. As I mentioned, this is my first stab at modifying a lisp, so please bear with me and all your help is greatly appreciated. Quote
v-pro Posted November 14, 2011 Posted November 14, 2011 Hi! Have you got any result in improving TCOUNT for mleaderds? Quote
graham79 Posted August 15 Posted August 15 This functionality is still not available in 2024? When I try to use the 'Auto Number' function from 'Express Tools' menu I cannot select any of my multileader objects. Is there a workaround? Quote
SLW210 Posted August 15 Posted August 15 Maybe check out these options... Solved: LISP for Multileader with increment - Autodesk Community - AutoCAD Solved: numeric Increment along with multileader - Autodesk Community - AutoCAD Automatically Label Attributes | Lee Mac Programming (lee-mac.com) Already mentioned earlier in the thread... Quote
SLW210 Posted August 15 Posted August 15 This seems to work for me. I had some old code I had started for something else and decided to see what I could do for MLeaders. Weren't easy for me at all, but a little searching provided some hints. Only quickly tested on a couple of quick mleaders, text and mtext. ;;; Sequential Number added to MLeader, Mtext and Text as Prefix, Suffix. *| ;;; *| ;;; Inspired By: https://www.cadtutor.net/forum/topic/26420-tcount-in-a-multileader/#comment-648519 *| ;;; *| ;;; With help from: https://forums.augi.com/showthread.php?117315-Modify-text-in-multileader *| ;;; *| ;;; By SLW210 (Steve Wilson) *| ;;; *| ;;; No guarantees use at your own risk *| ;;; *| ;;; Original 08/15/2024 *| ;;; *| ;;; *| ;;; Thanks most to AlanJT, lpseifert and irneb (Where have y'all gone?) *| ;;; *| ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*| (vl-load-com) (defun c:MTMTMLT () (c:ModifyTextMTextMLeaderText)) ; shortcut (defun c:ModifyTextMTextMLeaderText (/ ss ent en_obj current_text new_text num prefix suffix numType i entType ) ;; Prompt for prefix text (setq prefix (getstring "\nEnter prefix text (or leave blank): ")) ;; Prompt for suffix text (setq suffix (getstring "\nEnter suffix text (or leave blank): ")) ;; Prompt for type of numbering (setq numType (strcase (getstring "\nEnter 'P' for Prefix, 'S' for Suffix, or 'N' for No modification: " ) ) ) ;; Check if the type entered is valid (if (not (member numType '("P" "S" "N"))) (progn (princ "\nInvalid choice. Exiting.") (exit) ) ) ;; Select all TEXT, MTEXT, and MLEADER entities (setq ss (ssget '((0 . "TEXT,MTEXT,MULTILEADER")))) ;; Check if the selection set is valid (if (not ss) (progn (princ "\nNo TEXT, MTEXT, or MLEADER entities found.") (exit) ) ) (setq i 0) ; Initialize counter ;; Process (repeat (sslength ss) (setq ent (ssname ss i)) (setq en_obj (vlax-ename->vla-object ent)) (setq entType (cdr (assoc 0 (entget ent)))) (cond ;; TEXT entities ((= entType "TEXT") (setq current_text (vla-get-TextString en_obj)) (princ (strcat "\nCurrent TEXT: " current_text)) (setq num (itoa (1+ i))) (setq new_text (cond ((= numType "P") (strcat prefix num " " current_text)) ((= numType "S") (strcat current_text " " suffix num)) ((= numType "N") (strcat current_text)) ) ) (vla-put-TextString en_obj new_text) (princ (strcat "\nNew TEXT: " (vla-get-TextString en_obj))) ) ;; MTEXT entities ((= entType "MTEXT") (setq current_text (vla-get-TextString en_obj)) (princ (strcat "\nCurrent MTEXT: " current_text)) (setq num (itoa (1+ i))) (setq new_text (cond ((= numType "P") (strcat prefix num " " current_text)) ((= numType "S") (strcat current_text " " suffix num)) ((= numType "N") (strcat current_text)) ) ) (vla-put-TextString en_obj new_text) (princ (strcat "\nNew MTEXT: " (vla-get-TextString en_obj))) ) ;; MLEADER entities ((= entType "MULTILEADER") (progn ;; Retrieve the text of the MLEADER and apply modifications (setq current_text (vla-get-TextString en_obj)) (princ (strcat "\nCurrent MLEADER Text: " current_text)) (setq num (itoa (1+ i))) (setq new_text (cond ((= numType "P") (strcat prefix num " " current_text)) ((= numType "S") (strcat current_text " " suffix num)) ((= numType "N") (strcat current_text)) ) ) (vla-put-TextString en_obj new_text) (princ (strcat "\nNew MLEADER Text: " (vla-get-TextString en_obj)) ) ) ) (t (princ "\nUnsupported entity type.") ) ) ;; Increment counter (setq i (1+ i)) ) (princ "\nModifications completed.") (princ) ) Now back to my "get paid for job". I am sure any number of LISPers can greatly improve this. TCOUNT does more I think. I have several related versions of this, hence the long name so I don't get confused, you could rename the function or change the shortcut to something easier IMO. 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.