Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TEXT EDIT WHAT I MISTAKE THESE ?

3 REPLIES 3
Reply
Message 1 of 4
DINGUBOY
226 Views, 3 Replies

TEXT EDIT WHAT I MISTAKE THESE ?

(DEFUN C:LL()

  (SETQ

    EN(ENTSEL)

    )

  (COMMAND "DDEDIT" EN  "KUMAR" "" "")

  )

3 REPLIES 3
Message 2 of 4
hmsilva
in reply to: DINGUBOY

Hi, I dont have AutoCAD with me at the moment, but I think it will not be possible to use the DDEDIT command that way.

So I would suggest something like this:

 

(defun c:LL ( / ent ss)
  (if (setq ss (ssget "_+.:E:S:L" '((0 . "TEXT,MTEXT"))))
    (entmod (subst (cons 1 "KUMAR") (assoc 1 (setq ent (entget (ssname ss 0)))) ent))
  )
(princ)
)

 

Hope that helps

Henrique

EESignature

Message 3 of 4
Kent1Cooper
in reply to: DINGUBOY

The reason you can't use DDEDIT that way is that the command calls up a dialog box [that's what the DD stands for, from back in the days when dialog boxes were not the standard interface for any command, and some special commands starting with DD were made that used them], which then won't take input from the line of code, but wants it typed in.

 

Here's another way to accomplish the same thing:

 

(vl-load-com); [if needed]

(defun C:LL ()

  (vla-put-TextString (vlax-ename->vla-object (car (entsel))) "KUMAR")

)

 

But it does depend on the User selecting something that has a TextString property, so using (ssget) to filter for entity type is probably better, and it can also be made to keep asking if the User picks something else, or misses when picking:

 

(vl-load-com); [if needed]

(defun C:LL (/ ss)
  (while (not ss)
    (prompt "\To change content of Text/Mtext to \"KUMAR\",")
    (setq ss (ssget "_+.:S:L" '((0 . "TEXT,MTEXT"))))
  ); while
  (vla-put-TextString (vlax-ename->vla-object (ssname ss 0)) "KUMAR")
); defun

Kent Cooper, AIA
Message 4 of 4
DINGUBOY
in reply to: Kent1Cooper

1000 TIMES THANKS FOR YOUR ANSWERS hmsilva & Kent1Cooper ITS WORK FINE T

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost