TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Kate M on February 20, 2004, 10:30:56 AM

Title: Adding a suffix to text
Post by: Kate M on February 20, 2004, 10:30:56 AM
I need to add " (E)" to about 200 beam designations -- they're all just single line text...any takers? :-) (This isn't really urgent, I'm just being lazy. :-))
Title: Adding a suffix to text
Post by: Mark on February 20, 2004, 10:50:01 AM
email me the dwg, i'll do it.
mark.thomas@tampagov.net
Title: Adding a suffix to text
Post by: SMadsen on February 20, 2004, 11:00:26 AM
Mark, you've got too much time on your hands .. first a batch of DGN's then ..

Is that guy helpful or what?
Title: Adding a suffix to text
Post by: Kate M on February 20, 2004, 11:03:24 AM
Hmm...not sure I'm allowed...thanks, though. :-) I thought TCOUNT might be work, but you have to use numbers.
Title: Adding a suffix to text
Post by: SMadsen on February 20, 2004, 11:10:18 AM
Find/replace maybe?
Title: Adding a suffix to text
Post by: Kate M on February 20, 2004, 11:14:13 AM
Could work, but there's a bunch of different sizes -- probably still faster than typing it all in individually. :-)
Title: Adding a suffix to text
Post by: Mark on February 20, 2004, 11:27:57 AM
anything common with all the text?
Title: Adding a suffix to text
Post by: daron on February 20, 2004, 11:30:00 AM
You do know that you can select all the objects you want to replace? Seems like the long way, but it is still quicker than selecting each object then locating the spot, then typing the change. Which can get annoying real quick.
Title: Adding a suffix to text
Post by: SMadsen on February 20, 2004, 12:29:37 PM
Oh well, forgot find/replace doesn't take wildcards. Sorry.

Here you go (change the "(22)" text to any suffix you want) - single line text only:
Code: [Select]
(defun C:go22 ()
  (cond ((setq sset (ssget '((0 . "TEXT"))) a 0)
         (while (setq ent (ssname sset a))
           (setq entl (entget ent) a (1+ a))
           (entmod (subst (cons 1 (strcat (cdr (assoc 1 entl)) "(22)"))
                          (assoc 1 entl)
                          entl)
  ))))
  (princ)
)
Title: Adding a suffix to text
Post by: SMadsen on February 20, 2004, 12:31:54 PM
Don't know where I got "(22)" from .. hmm  :roll: .. should've been " (E)" I see.
Title: Adding a suffix to text
Post by: CAB on February 20, 2004, 12:43:02 PM
Try this and use zero as the increment.

AutoNumb (http://www.theswamp.org/lilly.pond/index.php?subdir=Text%20Increment&sortby=name&msg=%3Cp%20class%3Dinfo%3EUpload%20of%20file%20autonumb_v2.zip%20succeeded0)
Title: Adding a suffix to text
Post by: DParcon on February 20, 2004, 01:21:16 PM
If the text to be changed are AISC beam designations,
try this routine or tweaked it to your needs:

Code: [Select]


(defun C:CHT ()
  (if (setq ss (ssget '((0 . "TEXT") (1 . "*X*"))))
    (while (setq e (ssname ss 0))
      (setq str (cdr (assoc 1 (setq ed (entget e))))
            str (strcat str "(E)")
      )
      (entmod (subst (cons 1 str) (assoc 1 ed) ed))
      (entupd e)
      (ssdel e ss)  
    );while
    (prompt "No Text to be changed..")
  )
  (princ)
)

Title: Adding a suffix to text
Post by: Kate M on February 20, 2004, 04:39:31 PM
I ended up just using find/replace, first to find all the different sizes, then to tack on the suffix -- but I'll definitely try out some of the code suggestions for the next time I forget to label all the existing beams. :-)

Thanks again for all the ideas!

-Kate