fathihvac Posted May 26, 2013 Share Posted May 26, 2013 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" Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 26, 2013 Share Posted May 26, 2013 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) ) Quote Link to comment Share on other sites More sharing options...
fathihvac Posted May 26, 2013 Author Share Posted May 26, 2013 Thank you Mr.LEE, Not working ,It do the same as normal explode! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 26, 2013 Share Posted May 26, 2013 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. Quote Link to comment Share on other sites More sharing options...
fathihvac Posted May 26, 2013 Author Share Posted May 26, 2013 It works but how to set to no Columns in autolisp code? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 26, 2013 Share Posted May 26, 2013 It works but how to set to no Columns in autolisp code? To my knowledge this setting is not exposed to AutoLISP. Quote Link to comment Share on other sites More sharing options...
LanloyLisp Posted June 30, 2013 Share Posted June 30, 2013 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) Quote Link to comment Share on other sites More sharing options...
fathihvac Posted July 4, 2013 Author Share Posted July 4, 2013 Thank you LanloyLisp ,failed to insert your code into Lee's autolisp. Could you help? Quote Link to comment Share on other sites More sharing options...
LanloyLisp Posted July 4, 2013 Share Posted July 4, 2013 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) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 4, 2013 Share Posted July 4, 2013 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 Quote Link to comment Share on other sites More sharing options...
LanloyLisp Posted July 4, 2013 Share Posted July 4, 2013 Tnx.. Lee Mac. You modified your code very well. See you on the other thread. Quote Link to comment Share on other sites More sharing options...
fathihvac Posted July 7, 2013 Author Share Posted July 7, 2013 Thank you for all, Mr.Lee it works great. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.