Author Topic: Mtext with Space inbetween Characters  (Read 298 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Water Moccasin
  • Posts: 2026
  • I can't remeber what I already asked! I need help!
Mtext with Space inbetween Characters
« on: February 20, 2017, 10:50:02 am »
I know this is an odd one. I am searching "possibly" without lisp where as Mtext is used, a extra space would go in between.

i.e.

THIS IS A TITLE to T H I S  I S  A  T I T L E.

If not, is there a special type of font I could use?

thanks for the help!
Autodesk Infrastructure Design Suite 2017

CAB

  • Global Moderator
  • Seagull
  • Posts: 10228
Re: Mtext with Space inbetween Characters
« Reply #1 on: February 20, 2017, 11:18:18 am »
MAYBE THIS
Code: [Select]
;;  CAB 04/10/2006

;;  Add space(s) to text strings between characters
;; Note that there are problems with format codes especially with mText.

(defun c:textspacer (/ spc ent txt obj spacetext)
  (defun spacetext (txtstring spccnt / spaces newlst)
    (repeat spccnt (setq spaces (cons 32 spaces)))
    (foreach x (vl-string->list txtstring)
      (setq newlst (append newlst (list x) spaces))
    )
    (vl-list->string newlst)
  )
 
  (initget 6)
  (setq spc (getint "\nHow many spaces do you want to add? 1-5 <1> "))
  (or spc (setq spc 1))
  (if (> spc 5) (setq spc 5))

  (while (setq ent (entsel "\nSelect Text to add spaces to."))
    (setq txt (vla-get-textstring (setq obj (vlax-ename->vla-object (car ent)))))
    (setq txt (spacetext txt spc))
    (vla-put-textstring obj txt)
  )
  (princ)
)
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MSTG007

  • Water Moccasin
  • Posts: 2026
  • I can't remeber what I already asked! I need help!
Re: Mtext with Space inbetween Characters
« Reply #2 on: February 20, 2017, 11:21:11 am »
LOL.... Thanks CAB... Funny thing is. That is what I have been using to get the job done! Another awesome routine of yours!
Autodesk Infrastructure Design Suite 2017

CAB

  • Global Moderator
  • Seagull
  • Posts: 10228
Re: Mtext with Space inbetween Characters
« Reply #3 on: February 20, 2017, 11:43:56 am »
Happy to remind you.  8)
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MSTG007

  • Water Moccasin
  • Posts: 2026
  • I can't remeber what I already asked! I need help!
Re: Mtext with Space inbetween Characters
« Reply #4 on: February 20, 2017, 12:16:48 pm »
Did some more researching...

https://forums.autodesk.com/t5/autocad-2007-2008-2009/text-kerning/td-p/2731751

Text Kerning... Now I know what it does.
Autodesk Infrastructure Design Suite 2017

Cathy

  • Bull Frog
  • Posts: 251
Re: Mtext with Space inbetween Characters
« Reply #5 on: February 28, 2017, 03:21:58 pm »
Why don't you just set the spacing in the editor?

MSTG007

  • Water Moccasin
  • Posts: 2026
  • I can't remeber what I already asked! I need help!
Re: Mtext with Space inbetween Characters
« Reply #6 on: February 28, 2017, 03:24:54 pm »
I think that was genius....  :uglystupid2: Thank you!
Autodesk Infrastructure Design Suite 2017

Master_Shake

  • Swamp Rat
  • Posts: 1254
Re: Mtext with Space inbetween Characters
« Reply #7 on: March 01, 2017, 08:53:07 am »
Why don't you just set the spacing in the editor?

This is the way to go. When you finally switch over to TrueType fonts they will be correctly searchable vs the hard coded space between each letter.