Jump to content

Recommended Posts

Posted

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?

Posted
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

Posted

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.

Posted

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

Posted (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 by BIGAL

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...