LISP2LEARN Posted June 2, 2011 Posted June 2, 2011 How can I add a string to a text? I have a text and forgot to put "cm" at the end of the values. Any help would be appreciated. Quote
Lee Mac Posted June 2, 2011 Posted June 2, 2011 Prompt for String to add (getstring) Prompt for SelectionSet of Text Entities (ssget) Iterate through SelectionSet (while/repeat/sslength/ssname etc.) Get entity text (DXF 1) Concatenate text with new string (strcat) Modify Entity (entmod) Quote
LISP2LEARN Posted June 2, 2011 Author Posted June 2, 2011 Thanks Lee. Entmod was the one I was looking for. Better to reread the basic tutorial again. Hehe. Thanks again Lee. Quote
Tharwat Posted June 2, 2011 Posted June 2, 2011 Simple example by codes . (defun c:Test (/ ss l sset str e) (if (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT")))) (repeat (setq l (sslength ss)) (setq sset (ssname ss (setq l (1- l)))) (setq str (cdr (assoc 1 (setq e (entget sset))))) (entupd (cdr (assoc -1 (entmod (subst (cons 1 (strcat str "cm")) (assoc 1 e) e)) ) ) ) ) (princ) ) (princ) ) Tharwat Quote
Lee Mac Posted June 2, 2011 Posted June 2, 2011 Thanks Lee. Entmod was the one I was looking for. Better to reread the basic tutorial again. Hehe. Thanks again Lee. Cool, if you need something explained, shout Quote
LISP2LEARN Posted June 2, 2011 Author Posted June 2, 2011 My code is 3 times longer than yours and you call that simple. LOL. That's what differentiate a newbie from an expert. Thanks Tharwat. Quote
LISP2LEARN Posted June 2, 2011 Author Posted June 2, 2011 Cool, if you need something explained, shout Thanks Lee but I'm ok for now and I can sleep sound for tonight. Just need to do a lot of reading lisp tutorial. 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.