Selecting a selection set instead of one object at a time

Selecting a selection set instead of one object at a time

dmadduxjr
Participant Participant
908 Views
2 Replies
Message 1 of 3

Selecting a selection set instead of one object at a time

dmadduxjr
Participant
Participant

Very new to lisp and just kind of pieced this lisp file together from what little I understand and what I could find online. It allows me to run the txt2mtxt command and quickly change the formatting of the line spacing by clicking the mtext object after creating it. The problem is that I am unable to figure out how to do a selection set type of selecting as opposed to selecting one object at a time. I have tried multiple variations but I am clearly not understanding something because my selection set tends to skip the paragraph line spacing correction or perform the command out of order. Any help with fixing this lisp routine would be great. Thanks in advance!!

 

(defun C:t2m();
(command "txt2mtxt")
(while (= 1 (getvar "cmdactive"))
(command pause))
(setq vla_mtext (vlax-ename->vla-object (setq mymtext (car
(entsel)))))
(vla-put-LineSpacingFactor vla_mtext 0.9)

)

0 Likes
Accepted solutions (1)
909 Views
2 Replies
Replies (2)
Message 2 of 3

phanaem
Collaborator
Collaborator
Accepted solution

Make first the selection set and then pass it to the TXT2MTXT command.

The new created MTXT can be retrieved by (entlast) function, so you don't need to pick it.

Try this

 

(defun c:t2m ( / e ss)
  (if
    (setq ss (ssget '((0 . "TEXT"))))
    (progn
(setq e (entlast)) (command "txt2mtxt" ss "") (if (not (eq e (setq e (entlast)))) (entmod (append (entget e) '((44 . 0.9)))) ) ) ) (princ) )
0 Likes
Message 3 of 3

dmadduxjr
Participant
Participant

Worked perfectly!! Better in fact than I had it thank you. Now to spend the next few hours googling every part of this to understand exactly how it works. Almost everything in that if statement is completely lost on me but I do want to get better at this. Thank you again

0 Likes