rsdonna Posted Friday at 05:39 PM Posted Friday at 05:39 PM I'm looking for a lisp that will allow me to do the exact same thing I do with TCOUNT but for multileaders. I have a drawing where I have mleaders going to many different lines and each has three lines of text. The first line has cable id and I want to be able to replace the last two characters of that line. In TCOUNT I would select each mtext object in order, have the count start at 1 and increase by 1 (1,1) and then I would have it find and replace the '0' I left at the end of each line with the sequential numbers created by TCOUNT. This is what I need to be able to do but on all the mleaders I have in this drawing. Anyone have something like this? Quote
devitg Posted Friday at 08:20 PM Posted Friday at 08:20 PM 2 hours ago, rsdonna said: I'm looking for a lisp that will allow me to do the exact same thing I do with TCOUNT but for multileaders. I have a drawing where I have mleaders going to many different lines and each has three lines of text. The first line has cable id and I want to be able to replace the last two characters of that line. In TCOUNT I would select each mtext object in order, have the count start at 1 and increase by 1 (1,1) and then I would have it find and replace the '0' I left at the end of each line with the sequential numbers created by TCOUNT. This is what I need to be able to do but on all the mleaders I have in this drawing. Anyone have something like this? @rsdonna, please upload your sample.dwg and the TCOUNT lisp Quote
rsdonna Posted Friday at 08:27 PM Author Posted Friday at 08:27 PM I don't have a TCOUNT lisp. TCOUNT is part of the express tools in AutoCAD. It's what I use when I'm going to renumber text or mtext. Unfortunately TCOUNT doesn't work in mleaders so I'm looking for a way to be able to do with mleaders what I do for text and mtext. Quote
devitg Posted 19 hours ago Posted 19 hours ago @rsdonna Ok , please upload your sample.dwg where you need to apply. Quote
rsdonna Posted 19 hours ago Author Posted 19 hours ago Sure, here is a sample of what I'll have in my drawings. In my drawings I'll have maybe 50 mleaders like these and I'm looking for a way to be able to pick them in order and then have it replace the -00 at the end with the sequential numbering. In TCOUNT I can pick what number I want it to start from and what the increment will be and then whether I want to overwrite, find and replace (which is what I need it to do), and also a prefix and a suffix option to place the text. Thanks for your help SAMPLE.dwg Quote
BIGAL Posted 7 hours ago Posted 7 hours ago (edited) Give this a try, also it replaces what ever is the last 2 characters. Call it version 1. ; https://www.cadtutor.net/forum/topic/98622-tcount-for-multileaders/ ; change mleader text add number on end. ; By alanH jultu 2025 (defun c:wow1 ( / num str newstr obj len) (setq num (getint "\nEnter start number ")) (while (setq ent (entsel "\nPick Mleader - Enter to stop. ")) (setq obj (vlax-ename->vla-object (car ent))) (setq str (vlax-get obj 'textstring)) (setq len (strlen str)) (if (< num 10) (setq newstr (strcat (substr str 1 (- len 2)) "0" (rtos num 2 0))) (setq newstr (strcat (substr str 1 (- len 2)) (rtos num 2 0))) ) (vlax-put obj 'textstring newstr) (setq num (1+ num)) ) (princ) ) Edited 5 hours ago by BIGAL 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.