Jump to content

Recommended Posts

Posted

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.

Posted

  • 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)

Posted

Thanks Lee. Entmod was the one I was looking for. Better to reread the basic tutorial again. Hehe. Thanks again Lee.

Posted

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

Posted
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 :)

Posted

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.

Posted
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.

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...