Adjusting spacing between whole text words

Anonymous

Adjusting spacing between whole text words

Anonymous
Not applicable

Hello,

 

I would like to know if there is a way to adjust the spacing between whole words but not the spacing between characters (i.e Tracking option). I have a single continuous series of numbers I'm creating for a graphical representation. I would like to have the spacing between numbers/text to be spaced/aligned with the associated vertical grid lines. I was able to perform the task on the horizontal axis numbers using the Text Editor Paragraph Line Spacing. To hopefully illustrate my goal:

1<->2<->3...10<->11<->12 (default)

Car<->Truck<->Airplane

 

What I'm looking for:

1<-->2<-->3...10<-->11<-->12

Car<-->Truck<-->Airplane

1<--->2<--->3...10<--->11<--->12 

Car<--->Truck<--->Airplane

 

All this, without skewing the character spacing between the multi-digit numbers or words.

0 Likes
Reply
1,666 Views
2 Replies
Replies (2)

cheryl.buck
Autodesk Support
Autodesk Support

Hi @Anonymous,

 

Welcome to the Autodesk Community! You can specify spacing between words, different from the characters, using the Tracking feature from the the Text Editor. With Tracking you can adjust spacing for individual selections, or groups. The spacing applies to all characters and spaces selected. 

 

It may be possible to create a LISP routine or a third party application that automates this, the AutoCAD Customizations Forum members may also be able to help. 

 

I encourage you to submit this suggestion to Product Feedback.

 

If a post was helpful, Likes are always welcome.

Please click the Accept Solution button for any posts that resolve the issue or answer your question.

 

All the best,

 

Cheryl Buck
Technical Support Specialist



Did a post answer your question or help resolve the issue? Please click the Accept Solution button.
If you find a response helpful, consider Liking the post.

0 Likes

Kent1Cooper
Consultant
Consultant

This may do it for you:

 

(defun C:SWA ; = Space Words Apart
  (/ mt mtobj strlist trk dimz newlist)
  (setq
    mt (car (entsel "\nSelect Mtext in which to Space Words Apart: "))
    mtobj (vlax-ename->vla-object mt)
    strlist (vl-string->list (vla-get-TextString mtobj))
    trk (getreal "\nFactor of adjustment in spacing between words: ")
    dimz (getvar 'dimzin)
  ); setq
  (setvar 'dimzin 8); suppress trailing zeros in (rtos)
  (foreach chr strlist
    (setq newlist
      (append
        newlist ; already
        (if (= chr 32); space?
          (append '(123 92 84) (vl-string->list (rtos trk 2)) '(59 32 125)); then:
            ; add Tracking factor at space
          (list chr); else: just the character
        ); if
      ); append
    ); setq
  ); foreach
  (vla-put-TextString mtobj (vl-list->string newlist))
  (setvar 'dimzin dimz)
  (princ)
); defun

 

What it does is to impose the code into the text content, at every space [only], that you get from selecting that space and putting a Tracking value on it in the Mtext formatting editor.  That can be greater than 1 as in your description, but it can also be less than 1.

 

It requires Mtext, not plain Text, since Tracking factors can be applied only in Mtext.  Something similar could be done with plain Text, that would replace all spaces with multiple spaces, but that would give you less flexibility, working only with whole multiples of the width of a space as defined in the font involved.  The tracking factor in Mtext doesn't need to be a whole number, but can include decimal places.

 

It doesn't yet do things it could be enhanced to do, such as verify that you selected the right kind of object, or apply the same tracking factor to spaces in multiple Mtexts.

 

It assumes that you don't type in a factor that has more decimal places than your Units setting is set to display, because it will put no more than the latter number of decimal places into the result.  But a greater precision argument could be included in the (rtos) function if needed.

 

I haven't tried it on a string that it has already been applied to -- that could give unexpected results.  If you don't like a result, I suggest you not run it again on the result, but Undo the first try and run it again with a different factor, on the un-adjusted original Mtext.

 

Bear in mind that it adjusts the size of spaces only, and has no concern with the number of characters in the words or digits in between.  So the words will not be equally spaced in center-to-center fashion as with center-justified tabs in a word processor, unless they are of equal width to begin with, and even that will be affected by the particular characters in them, unless the font is a mono-spaced one.

Kent Cooper, AIA