Edit multiple selections of text

Edit multiple selections of text

Anonymous
Not applicable
2,877 Views
4 Replies
Message 1 of 5

Edit multiple selections of text

Anonymous
Not applicable

Hi All, I've come into problem. I used to have a lisp routine that would allow me to select multiple single line text and edit without having to double click. It would just skip to the next line of text, open text editor dialog box, I edit, hit enter, then off to the next piece of text.

I do not recall the name of this routine. I lost it due to a system restore we had to perform at work. I didnt have the chance to save my LISP's.

Anyways, I have AutoCAD Electrical 2020, but for now, use the "2D Drafting & Annotation" workspace.

I have found several lisp routines that look like they would do what I am looking for, but with each one, I get some kind of error.

I first tried "TEDIT" (attached)  and this is the error I get:

TEDIT
Select objects: Specify opposite corner: 10 found
Select objects:
Unknown command "DDEDIT". Press F1 for help.


I have also tried two other LISP routines called "met" and "me" (attached). When I type in the command prompts for these other two, it doesnt even recognize the command. Thoughts anyone?

 

 

0 Likes
Accepted solutions (1)
2,878 Views
4 Replies
Replies (4)
Message 2 of 5

SeeMSixty7
Advisor
Advisor

This is something from the late 80's, but it does not work on MTEXT and it does not use a dialog box.

;By Clint Moore
(defun dxf(code elist)
    (cdr (assoc code elist))
)
(defun c:ct( / num count ss1 item inp ent new old)
    (setvar "cmdecho" 0)
    (setq ss1 (ssget)
          num (sslength ss1)
          count 0
    )
    (while (< count num)
           (setq item (ssname ss1 count)
                 ent (entget item)
           )
            (if (= (cdr (assoc 0 ent)) "TEXT")
              (progn
                   (command "select" item)
                   (setq inp 
                       (getstring T (strcat "\nNew text:<" (dxf 1 ent) ">: ")))
                   (command nil)
                   (if (= inp "")
                       (setq inp (dxf 1 ent))
                   )
                   (setq new (cons 1 inp))
                   (setq old (assoc 1 ent)
                         ent (subst new old ent)
                   )
                   (entmod ent)
           )   )
          (setq count (1+ count))
    )
    (princ)
)
0 Likes
Message 3 of 5

Anonymous
Not applicable

Not too bad! I like the text editor window, but this will do in a pinch. But I am still not sure why those others didnt work for me. By reading into AutoDesk forums, those LISP routines worked for others. Anyways, thanks!

0 Likes
Message 4 of 5

SeeMSixty7
Advisor
Advisor
Accepted solution

Looks like the DDEDIT command was killed, and is simply an alias to TEXTEDIT. Update your routines that call DDEDIT to use TEXTEDIT instead and that should resolve the issue.

Your TEDIT.LSP file should now look like this.

; Jason Piercey . May 29th, 2003
; similar command replacement for the Express Tool
; called TEDIT that was left out of AutoCAD 2004.

; edit any of the following in one operation.
; Text, Mtext, Attdef, Attributed Inserts,
; Dimensions, ArcAlignedText, and MultiLeaders

; briefly tested, if any trouble just say so.

; Revised: 06/09/2008 JP
;  - added support for multileaders
;  - reworked error handler and exiting

(defun c:tEdit (/ echo *error* ss i ename data)
  (setq echo (getvar "cmdecho"))
  (setvar "cmdecho" 0)
  
  (defun *error* (msg)
    (cond
      ((and
	 msg
	 (not (member msg '("Function cancelled" "quit / exit abort"))) )
       (princ (strcat "\ntEdit error: " msg))
       )
      (t princ)
      )
    (setvar "cmdecho" echo)
    )

  (if (setq
	ss
	 (ssget
	   '((-4 . "<or")
	     (0 . "TEXT,MTEXT,ATTDEF,ARCALIGNEDTEXT,DIMENSION,MULTILEADER")
	     (-4 . "<and") (0 . "INSERT") (66 . 1) (-4 . "and>")
	     (-4 . "or>")
	     )
	   )
	)
    (progn
      (setq i -1)
      (repeat (sslength ss)
	(setq ename (ssname ss (setq i (1+ i))))
	(setq data (cdr (assoc 0 (entget ename))))
	(cond
	  ((wcmatch data "TEXT,ATTDEF,MTEXT,DIMENSION,MULTILEADER")
	   (command "._textedit" ename "") )
	  
	  ((= "ARCALIGNEDTEXT" data) (command "._arctext" ename))
	  
	  ((= "INSERT" data) (command "._ddatte" ename))
	  
	  )
	(while (> (getvar "cmdactive") 0) (command pause))
	)
      )
    )
  (*error* nil)
  (princ)
  )
0 Likes
Message 5 of 5

Anonymous
Not applicable

Thanks so much for pointing this out!