I recently got an e-mail about how you could align a new text object vertically based on existing text object that already exists in the drawing. Most people and I am among them, often create a text object and then align it with an existing text object, but you can cut down on having to start the Move command and picking a base point and then a second point by using point filters or object snap tracking based on your preference to align text objects.
Note: How the text objects align is based on the current text alignment of the new text object and the existing text object.
Using Object Snap Tracking to Align Text Vertically
- Before you start creating a new text object, turn on the Insertion object snap and enable object snap tracking by clicking the OTRACK button on the status bar.
- Start the DTEXT or MTEXT command.
- At the Specify start point of text or Specify first corner prompt, hover over the text object's Insertion point. You should see a vector is displayed vertically from the Insertion point which allows you to specify a point along that vector path.
- Enter a distant to specify a new point, or simply click along the vector.
- Once the start point or first corner has been specified you can finish the command like you normally would.
Using Point Filters to Align Text Vertically
- Start the DTEXT or MTEXT command.
- At the Specify start point of text or Specify first corner prompts, enter .X and press Enter. You could also hold down the SHIFT key, right-click and select Point Filters >> .X.
- At the prompt .X of, enter INS and press Enter. You could also hold down the SHIFT key, right-click and select Insert.
- Select the Insertion point of the text object you want to vertically align with, and then pick a second point to determine the Y coordinate value.
- Once the start point or first corner has been specified you can finish the command like you normally would.
Alternatively, you could also use AutoLISP to simplify the process even further. Belolw is a very basic example that simply starts the DTEXT command based on the insertion point of a selected text object. The example lacks some error checking and is designed just to show a conceptual way of how to align text vertically or horizontally with other text object that already exists in a drawing.
(defun c:AlignVertically ( / ent ent_data pt-align)
(if (setq ent (entsel "\nSelect a text object to align vertically with: "))
(progn
(setq ent_data (entget (car ent)))
(if (setq pt-align (getpoint (cdr (assoc 10 ent_data)) "\nSpecify start point: "))
(command ".dtext" pt-align)
(prompt "\nNo Point selected.")
)
)
(prompt "\nNo object selected.")
)
(princ)
)
Sincerely,
Lee
Comments