Apply a command to all text and mtext

Apply a command to all text and mtext

renanemeyer
Advocate Advocate
570 Views
2 Replies
Message 1 of 3

Apply a command to all text and mtext

renanemeyer
Advocate
Advocate

Hello everyone
I've been trying to develop a code that would apply the tspaceinvaders command only to text and mtext of the selection, and on asking "Step through each one for visual verification?" already selected the "N".
But what I was starting didn't have functionality. Please, would anyone know what could be changed in this code?

 

(defun C:TINV (/ ss i elist)
(prompt "\nSelect an area: ")
(setq ss (ssget (list (cons 0 "TEXT"))))
(setq i -1)
(if ss
(repeat (sslength ss)
(setq elist (cdr (assoc -1 (entget (ssname ss (setq i (1+ i)))))))
(command "TSPACEINVADERS" elist ""); 
)
)
)
0 Likes
Accepted solutions (1)
571 Views
2 Replies
Replies (2)
Message 2 of 3

ВeekeeCZ
Consultant
Consultant
Accepted solution

Try this one.

It's not so simple due to it's not a regular built-in command but an express tool... probably just a LISP but didn't wonder.

 

(defun c:InvAll ( / s)

  (if (setq s (ssget "_:L" '((0 . "*TEXT"))))
    (progn
      (command "_.select" s "")
      (vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) "TSPACEINVADERS\rP\r\r\r")))
  (princ)
  )

 

Message 3 of 3

renanemeyer
Advocate
Advocate

Thank you very much @ВeekeeCZ 

I did some tests, in most cases they were great (in some not, but it's due to the range of distance that the tspace command works, I go to see how to adjust)
I appreciate your availability to evaluate and adjust the code, it will be very useful

0 Likes