TheSwamp

CAD Forums => CAD General => Topic started by: MSTG007 on February 20, 2017, 10:50:02 AM

Title: Mtext with Space inbetween Characters
Post by: MSTG007 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!
Title: Re: Mtext with Space inbetween Characters
Post by: CAB 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)
)
Title: Re: Mtext with Space inbetween Characters
Post by: MSTG007 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!
Title: Re: Mtext with Space inbetween Characters
Post by: CAB on February 20, 2017, 11:43:56 AM
Happy to remind you.  8)
Title: Re: Mtext with Space inbetween Characters
Post by: MSTG007 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 (https://forums.autodesk.com/t5/autocad-2007-2008-2009/text-kerning/td-p/2731751)

Text Kerning... Now I know what it does.
Title: Re: Mtext with Space inbetween Characters
Post by: Cathy on February 28, 2017, 03:21:58 PM
Why don't you just set the spacing in the editor?
Title: Re: Mtext with Space inbetween Characters
Post by: MSTG007 on February 28, 2017, 03:24:54 PM
I think that was genius....  :uglystupid2: Thank you!
Title: Re: Mtext with Space inbetween Characters
Post by: ChrisCarlson 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.