add (0. "mtext") but doesn't work

add (0. "mtext") but doesn't work

nychoe1
Advocate Advocate
728 Views
4 Replies
Message 1 of 5

add (0. "mtext") but doesn't work

nychoe1
Advocate
Advocate

I added it a verse ((-4 . "<or")(0 . "TEXT")(0 . "MTEXT")(-4 . "or>"))))

but mtext is not working

please let me know what I should do.... thank you all.

 

(defun c:wd ()
 (setq ss (ssget '((-4 . "<or")(0 . "TEXT")(0 . "MTEXT")(-4 . "or>"))))
 (setq n (sslength ss))
 (setq wid (getreal "\ninput width :"))
 (setq k 0)
 (repeat n
 (setq var (entget (ssname ss k)))
 (setq old (assoc 41 var))
 (setq new (cons 41 wid))
 (setq cht (subst new old var))
 (entmod cht)
 (setq k (1+ k))
 )
(princ)
)

0 Likes
729 Views
4 Replies
Replies (4)
Message 2 of 5

marko_ribar
Advisor
Advisor

ssget function is expecting not literal filter... Try replacing your filter with this :

 

(setq ss (ssget "_:L" '((0 . "*TEXT"))))

 

or if you really want only TEXT and MTEXT, then :

 

(setq ss (ssget "_:L" (list '(-4 . "<or") '(0 . "TEXT") '(0 . "MTEXT") '(-4 . "or>"))))

 

Note - I've put "_:L" mode to be sure selected entities are on unlocked layer and ready for editing/modifications...

Marko Ribar, d.i.a. (graduated engineer of architecture)
0 Likes
Message 3 of 5

Anonymous
Not applicable

I usually just use:

(setq ss (ssget "_:L" '((0 . "MTEXT,TEXT"))))

Which selects only MTEXT & Text entities & is much the same as Marko's second option

 

 

There's a good tutorial on Selection Sets here & a full explination of ssget on Lee Macs website here

0 Likes
Message 4 of 5

nychoe1
Advocate
Advocate

oh, thank you

 

but

when I selected texts and mtexts all together the same time, texts are  working but mtexts are not working.Smiley Happy

.

0 Likes
Message 5 of 5

Anonymous
Not applicable

Hi nychoe1

 

Your problem lies in the assoc 41 group code, it is different in MTEXT - TEXT. See DXF Group Codes here

If you're trying to change the width factor of TEXT items at the same time as the Reference rectangle width of MTEXT items - two very different things.

What are you trying to achieve?