Jump to content

Dynamic Text Alignment


Lee Mac

Please Rate this Program  

59 members have voted

  1. 1. Please Rate this Program

    • * * * * * (Best)
    • * * * *
    • * * *
      0
    • * *
      0
    • * (Worst)
      0


Recommended Posts

Dynamic Text Alignment

 

This program will allow the user to dynamically align multiple MText and DText objects simultaneously to any angle, or along an object.

 

The user is prompted for a selection of text objects and an alignment point/text object to use as a base point to which the text is aligned.

 

The user can then switch between different modes, depending on how the text needs to be aligned, including:

 

  • Horizontal Mode: Can be accessed by pressing TAB - will align text by altering only its x-coordinate. [For aligning multiple lines of text].

 

  • Vertical Mode: Can be accessed by pressing TAB - will align text by altering only its y-coordinate. [For aligning a single line].

 

  • Stretch Mode: Can be accessed by pressing TAB - will evenly space text from the first text object in the selection.

Other options are available when the user is in these modes, including:

 

  • Rotation: The rotation of all the text can be made consistent by pressing 'R'. Alternatively, the user may hold Shift during text Alignment to rotate text perpendicular to the angle of alignment.

 

  • Justification: The Justification of all the text can be modified simultaneously by pressing 'J' during alignment.

 

  • Text Spacing: When the user is in Horizontal/Vertical Mode, text can be spaced to a user-determined distance by pressing 'S'.

 

  • Object Mode: Can be accessed by pressing 'O' (See below).

Demo:

 

TxAlign.gif

 

 

Object Alignment Mode:

 

Upon pressing 'O' during text alignment, the user is prompted to select an object along which to align text.

 

Text may be aligned to any Curve Object (Spline/Arc/Ellipse/Line/Polyline/Circle.. etc), and the user is provided with additional refinement options, including:

  • Reverse: By pressing 'V' during alignment, the order of the text objects along the curve is reversed.

 

  • Text Offset: By pressing 'O' during alignment, the text offset can be altered dynamically.

 

  • Text Spacing: By pressing 'S' during alignment, the spacing between successive text objects along the curve can be altered dynamically.

 

  • Text Rotation: By pressing 'R', text rotation can be altered, or, by holding Shift during alignment, the text is automatically aligned to the selected curve.

The user may exit the Object Alignment Mode by pressing 'E'.

 

Object Alignment Example:

 

TxAlignObj.gif

 

 

Function Syntax: TxAlign

 

;;;¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,;;;
;;;ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,¤º°`°º¤;;;
;;                                                                               ;;
;;                      --=={  Dynamic Text Align  }==--                         ;;
;;                                                                               ;;
;;  Allows the user to dynamically align text to any angle. User is prompted to  ;;
;;  make a selection of Text or MText objects to align, and pick an alignment    ;;
;;  point, or select a text object to use for alignment. The selection of text   ;;
;;  is then aligned by either x or y coordinate, or dynamically stretched        ;;
;;  depending on the mode chosen.                                                ;;
;;                                                                               ;;
;;  The mode can be switched upon pressing TAB during alignment. Text and MText  ;;
;;  entities will be aligned in accordance with their respective justifications. ;;
;;                                                                               ;;
;;  The user can also specify a fixed text spacing, by pressing 'S' during text  ;;
;;  alignment. Holding Shift whilst aligning Text will alter Text Rotation, the  ;;
;;  user can also refine Rotation by pressing 'R' during text alignment. Text    ;;
;;  Justfication can be altered by pressing 'J' during text alignment.           ;;
;;                                                                               ;;
;;                                                                               ;;
;;  Object Alignment Mode:-                                                      ;;
;;  --------------------------                                                   ;;
;;  Text can be aligned to an object by pressing 'O' during text alignment. In   ;;
;;  this mode, the text spacing along the object can be adjusted by pressing     ;;
;;  'S' and the text offset from the object can also be altered by pressing 'O'. ;;
;;                                                                               ;;
;;  Text Rotation can be aligned to the tangent vector of the object at the      ;;
;;  point of alignment by holding Shift during text placement. The user can      ;;
;;  furthermore specify a text rotation by pressing 'R'.                         ;;
;;                                                                               ;;
;;  The order of the text entities along the object can be Reversed by pressing  ;;
;;  'V' during Text placement. The original order of these entities is           ;;
;;  determined by the drawing direction of the object.                           ;;
;;                                                                               ;;
;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;;
;;                                                                               ;;
;;  FUNCTION SYNTAX:  TXALIGN                                                    ;;
;;                                                                               ;;
;;  Notes:-                                                                      ;;
;;  ---------                                                                    ;;
;;  Shift Functionality requires the user to have Express Tools installed.       ;;
;;                                                                               ;;
;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;;
;;                                                                               ;;
;;  AUTHOR:                                                                      ;;
;;                                                                               ;;
;;  Copyright © Lee McDonnell, October 2009. All Rights Reserved.                ;;
;;                                                                               ;;
;;      { Contact: Lee Mac @ TheSwamp.org, CADTutor.net }                        ;;
;;                                                                               ;;
;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;;
;;                                                                               ;;
;;  VERSION:                                                                     ;;
;;                                                                               ;;
;;    ø 1.0   ~¤~   12th October 2009   ~¤~   º First Release                    ;;
;;...............................................................................;;
;;    ø 1.1   ~¤~   14th October 2009   ~¤~   º Added ability to Specify fixed   ;;
;;                                              text spacing                     ;;
;;...............................................................................;;
;;    ø 1.2   ~¤~   15th October 2009   ~¤~   º Added Stretch Mode               ;;
;;                                            º Upgraded User messaging          ;;
;;...............................................................................;;
;;    ø 1.3   ~¤~   18th October 2009   ~¤~   º Added Rotation Functionality     ;;
;;...............................................................................;;
;;    ø 1.4   ~¤~   20th October 2009   ~¤~   º Added functionality to align     ;;
;;                                              text to object.                  ;;
;;...............................................................................;;
;;    ø 1.5   ~¤~   23rd October 2009   ~¤~   º Added Justification Options.     ;;
;;...............................................................................;;
;;    ø 1.6   ~¤~   28th October 2009   ~¤~   º Added Option to Select Text      ;;
;;                                              object at Alignment Point prompt ;;
;;...............................................................................;;
;;                                                                               ;;
;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;;
;;                                                                               ;;
;;;¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,;;;
;;;ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,¤º°`°º¤;;;

For instructions on how to run the program see here.

 

Any comments, criticism and suggestions are welcome. Either PM me directly, or reply to the original thread.

 

Enjoy,

 

Lee

 

Code available here.

Edited by Lee Mac
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...