Jump to content

Simple LISP To Explode All MText?


Recommended Posts

I tried this, but it does not seem to work:

 

(defun c:ExplodeMtext ()
(command "._explode" (ssget "_X" '((0 . "MTEXT"))) "" )
(princ)
)

 

Anyone have a simple LISP that will explode all mtext in a drawing?

Link to post
Share on other sites

I got this to work... But it only explodes one occurrence of mtext...

 

(defun c:EXMT ()
(command "._explode" (ssget "X" (list (cons 0 "MTEXT"))) )
(princ)
)

 

I want to explode all mtext in one sweep.

Link to post
Share on other sites

Try something like this, untested:

 

(defun c:Explode_Mtext (/ i ss ent)
 (if (setq i -1 ss (ssget "_X" '((0 . "MTEXT"))))
   (while (setq ent (ssname ss (setq i (1+ i))))
     (command "_.explode" ent)))
 (princ))

Link to post
Share on other sites

Hey Lee;

 

That works great... I am getting an Unknown command "Explode_Mtext" error at the end, but it is working. I guess there is one too many () or "" somewhere.

Link to post
Share on other sites

So this is what I changed to fix the error at the end:

(defun c:EXMT (/ i ss ent)
 (if (setq i -1 ss (ssget "_X" '((0 . "MTEXT"))))
   (while (setq ent (ssname ss (setq i (1+ i))))
     (command "_.explode" ent )))
 (princ)
)

 

I changed the name only because I have a button that calls that name out and I am too lazy to change it... lol...

 

Thanks for the help Lee!

Link to post
Share on other sites

The first lisp you posted would have worked, if you first set "QAFLAGS" to 1.

Or you can set it in the outine, then set back to original.

 

QAFLAGS affects exploding a set in lisp, among other undocumented effects.

Link to post
Share on other sites
The first lisp you posted would have worked, if you first set "QAFLAGS" to 1.

Or you can set it in the outine, then set back to original.

 

QAFLAGS affects exploding a set in lisp, among other undocumented effects.

 

I have never used QAFLAGS... Could you show me the LISP the way you are talking about with the QAFLAGS?

Link to post
Share on other sites

Sure...

 

(defun c:ExplodeMtext ()

(setq UsrQA (getvar "QAFLAGS"))

(setvar "QAFLAGS" 1)

(command "._explode" (ssget "_X" '((0 . "MTEXT"))) "" )

(setvar "QAFLAGS" UsrQA)

(princ)

)

Link to post
Share on other sites
  • 11 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...