AutoCAD 2000/2000i/2002 Archive (Read Only)
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reply
Message 1 of 3
yongwoocho
166 Views, 2 Replies

aligning texts

Is there an easy way to align (or line up) several texts (including leader texts) globally to an existing text?
2 REPLIES 2
Message 2 of 3
Campman
in reply to: yongwoocho

draw a straight line from the insertion point of the text you want to line every thing up with then move the other lines of text perpendicular to that line from there respective insertion points.
Message 3 of 3
Anonymous
in reply to: yongwoocho

I found this routine that may do what you want it to. I'm not sure if if
works on leader text. This routine will align all selected text with the
top line of text. It will also change the style, size, ect...if they are
different.

;(c)1999, Matt Fischer
;freeware
(princ)
(prompt "/n Select text objects: ")
(setq ssText (ssget '((0 . "TEXT")))) ; select text
(setq ssNumber (sslength ssText) ; lines of text
ssIndex ssNumber ; pointer
ssY_Handles '() ; list of Y values and Handles
dYfactor 1.6 ; default Y displacement factor
)
(repeat ssNumber
(setq ssIndex (- ssIndex 1))
(setq eName (ssname ssText ssIndex)); entity name
(setq eData (entget eName))
(setq eY (caddr (assoc '10 eData))) ; entity Y location value
(setq eYe (/ eY 100000)) ; assure correct ordering
(setq eYe (+ eYe 5))
(setq eYe (rtos eYe 2 8)) ; change to a string
(setq eHnd (cdr (assoc '5 eData))) ; entity handle
(setq ssY_Handles
(cons (strcat eYe "*" eHnd) ; add string to
ssY_Handles ; list
)
)
);repeat
(setq ssY_Handles
(acad_strlsort ssY_Handles) ; sort in order of Y value
)
(setq ssIndex ssNumber ; pointer
ssY '() ; sorted list of Y values
ssHandles '() ; sorted list of handles
)
(repeat ssNumber
(setq ssIndex (- ssIndex 1))
(setq eY_H ; entity Y value and handle
(nth ssIndex ssY_Handles)
)
(setq eSL (strlen eY_H)) ; entity string length
(setq eSLIndex 1) ; pointer
(repeat eSL
(if (/=
(substr eY_H eSLIndex 1) ; if substring is not "-"
"*"
)
(setq eSLIndex (+ eSLIndex 1)); go to next substring
)
); repeat
(setq eHnd
(substr eY_H (+ eSLIndex 1) eSL) ; entity handle
)
(setq
eName (handent eHnd) ; get name of entity
eData (entget eName) ; get entity data
eText (assoc 1 eData) ; get text
lName (assoc '-1 eData)
)
(if (= (- ssNumber 1) ssIndex) ; if this is first line of text
(progn
(setq
eX (cadr (assoc '10 eData)) ; X location value
eY (caddr (assoc '10 eData)) ; Y location
eZ (cadddr(assoc '10 eData)) ; Z location
eX1 (cadr (assoc '11 eData)) ; X location value
eY1 (caddr (assoc '11 eData)) ; Y location
eZ1 (cadddr(assoc '11 eData)) ; Z location
eH (cdr (assoc '40 eData)) ; text height
eColor (assoc 62 eData) ; color
); setq
(if (not eColor) (setq
eData (subst '(62 . 256) (assoc 62 eData) eData))
)
(setq
feData eData
)
);progn
(progn
(setq eY (- eY (* eH dYfactor))) ; otherwise decrease y value
(setq eY1 (- eY1 (* eH dYfactor))) ; otherwise decrease y1 value
)
);if
(setq eXYZ (list 10 eX eY eZ ))
(setq eXYZ1 (list 11 eX1 eY1 eZ1))
(setq eData feData)
(setq eData (subst eText (assoc 1 eData) eData))
(setq eData (subst eXYZ (assoc '10 eData) eData))
(setq eData (subst eXYZ1 (assoc '11 eData) eData))
(setq eData (subst (cons 5 eHnd) (assoc 5 eData) eData))
(setq eData (subst lName (assoc -1 eData) eData))
; (if (= (cdr (assoc 62 feData)) nil) (setq
; eData (subst '(62 . 256) (assoc 62 eData) eData))
; )
(entmod eData) ; modify text entity
); repeat
)
(princ)

"yongwoocho" wrote in message
news:f14d66c.-1@WebX.maYIadrTaRb...
Is there an easy way to align (or line up) several texts (including leader
texts) globally to an existing text?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report