Author Topic: Mtext Word wrap removal  (Read 5918 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Mtext Word wrap removal
« Reply #15 on: April 14, 2006, 11:09:49 AM »
The problem with Mtext, and dxf codes is that if the string is too long, then you need to check if it has a dxf code of 3 (for continueing the string).  I would reccomend that you use the ActiveX properties to get the text string.
Example using what Mark posted.
Code: [Select]
(defun c:blastReturns (/ rm-returns ent entlst str new_str TxtObj)

 (defun rm-returns (str)
   (while (wcmatch str "*\\P*")
     (setq str (vl-string-subst " " "\\P" str))
   )
   str
 )

 (if (setq ent (car (entsel "\nSelect MTEXT: ")))
   (progn

     (setq entlst  (entget ent)
;   str    (cdr (assoc 1 entlst))
   str (vla-get-TextString (setq TxtObj (vlax-ename->vla-object Ent)))
   new_str (rm-returns str)
     )

;     (setq entlst
;    (subst (cons 1 new_str) (assoc 1 entlst) entlst)
;     )
;     (entmod entlst)
    (vla-put-TextString TxtObj new_str)
   )
 )

 (princ)
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Mtext Word wrap removal
« Reply #16 on: April 14, 2006, 11:40:36 AM »
.....
     (setq entlst  (entget ent)
;   str    (cdr (assoc 1 entlst))
   str (vla-get-TextString (setq TxtObj (vlax-ename->vla-object Ent)))
   new_str (rm-returns str)
     )

;     (setq entlst
;    (subst (cons 1 new_str) (assoc 1 entlst) entlst)
;     )
;     (entmod entlst)
.......


It works, though I had to remove the Semi-Colans that you had place in the code. 
It as crashing @  line that contain the code [ "new_str (rm-returns str) ]
Don't ask me why  :?  but it works.
Thanks
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Mtext Word wrap removal
« Reply #17 on: April 14, 2006, 11:55:44 AM »
Weird, but as long as you got it working.
You're welcome for the little I did, it's still Mark's code.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Mtext Word wrap removal
« Reply #18 on: April 14, 2006, 12:04:00 PM »
You're welcome for the little I did, it's still Mark's code.

Thanks to all of you.  Everytime I am come here I learn something.  And thanks for some of the cool routines too. :kewl:
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans