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 yesterday at 11:31 AM Posted yesterday at 11:31 AM @rsdonna Ok , please upload your sample.dwg where you need to apply. Quote
rsdonna Posted yesterday at 12:03 PM Author Posted yesterday at 12:03 PM 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 14 hours ago Posted 14 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 13 hours ago by BIGAL Quote
rsdonna Posted 1 hour ago Author Posted 1 hour ago 13 hours ago, BIGAL said: 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) ) This is great. Is there a way to have it still do this if there are multiple lines of text in the mleader? I still have the wire name at the top line always but sometimes add 1 or 2 additional lines with other info about that wire. Thanks for your help. SAMPLE.dwg Quote
rsdonna Posted 1 hour ago Author Posted 1 hour ago 1 hour ago, SLW210 said: Did you try the codes in the thread I posted? I did. I had found it before and it is great just doesn't do exactly what i need. I can use it to add the numbering at the end but if I need to renumber then it won't work the way I need it to. Thank you for this. 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.