Jump to content

Recommended Posts

Posted

Hello,

I need a lisp to explode a text written on multiline text to only one single line text.

Example:

"First floor

meeting

room"

When exploded must gives one single line text: "First floor meeting room"

Not gives three single line text:

"First floor"

"meeting"

"room"

Posted

Quick hack:

(defun c:xtxt ( / e i s x )
   (if (setq s (ssget "_:L" '((0 . "MTEXT"))))
       (repeat (setq i (sslength s))
           (setq e (entget (ssname s (setq i (1- i))))
                 x (cdr (assoc 1 e))
           )
           (while (wcmatch x "*\\P*")
               (setq x (vl-string-subst " " "\\P" x))
           )
           (entmod (subst (cons 1 x) (assoc 1 e) (subst '(41 . 0.0) (assoc 41 e) e)))
           (command "_.explode" (cdr (assoc -1 e)))
       )
   )
   (princ)
)

Posted

Thank you Mr.LEE,

 

Not working ,It do the same as normal explode!

Posted
Not working ,It do the same as normal explode!

 

Please ensure that the 'Columns' setting (found under the 'Text' heading in the Properties Palette) for your MText is set to 'None' (No Columns) - you can change this setting for multiple MText objects simultaneously.

Posted

It works but how to set to no Columns in autolisp code?

Posted
It works but how to set to no Columns in autolisp code?

 

To my knowledge this setting is not exposed to AutoLISP.

  • 1 month later...
Posted
To my knowledge this setting is not exposed to AutoLISP.

 

Hope this will help..

Insert somewhere in your code. :)

 

(entmod (append e (list (cons 75 0))))
(entupd x)

MTEXT DXF 75 - 0 (Column Type - None)

Posted

Thank you LanloyLisp ,failed to insert your code into Lee's autolisp. Could you help?

Posted
Thank you LanloyLisp ,failed to insert your code into Lee's autolisp. Could you help?

 

(defun c:xtxt (/ e i s x)
   (if (setq s (ssget "_:L" '((0 . "MTEXT"))))
       (repeat (setq i (sslength s))
           (setq e (entget (ssname s (setq i (1- i))))
	  x (cdr (assoc 1 e))
           )
           (while (wcmatch x "*\\P*")
               (setq x (vl-string-subst " " "\\P" x))
           )
(entmod (append e (list (cons 75 0)))); here is the insertion
;;sorry for the "(entupd x)" i thought "x" was the entity, at least no need to insert the entity update.
          (entmod (subst (cons 1 x) (assoc 1 e) (subst '(41 . 0.0) (assoc 41 e) e)))
 (command "_.explode" (cdr (assoc -1 e)))
       )
   )
   (princ)
)

o:)

Posted

Or perhaps:

(defun c:xtxt ( / e i s x )
   (if (setq s (ssget "_:L" '((0 . "MTEXT"))))
       (repeat (setq i (sslength s))
           (setq e (entget (ssname s (setq i (1- i))))
                 x (cdr (assoc 1 e))
           )
           (while (wcmatch x "*\\P*")
               (setq x (vl-string-subst " " "\\P" x))
           )
           (entmod (append (subst (cons 1 x) (assoc 1 e) (subst '(41 . 0.0) (assoc 41 e) e)) '((75 . 0))))
           (command "_.explode" (cdr (assoc -1 e)))
       )
   )
   (princ)
)

Well spotted Lanloy :thumbsup:

Posted

Tnx.. Lee Mac. You modified your code very well. See you on the other thread. :D

Posted

Thank you for all, Mr.Lee it works great.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...