Aligning Text
Aligning Text
(OP)
I have 3 or 4 different pieces of text that needs to be aligned. All have centered justification. I want to pick a point and have all 3 lined up to the "x" value of the pick point. Anyone know of any lisp or vba that will do this? I have about 1200 sets of these to do so any help would be greatly appreciated.





RE: Aligning Text
;TXTALIGN.lsp modified 04/07/97 Jeff Foster
;
;OBJECTIVE***
;The purpose of this routine is to allow the user to align
;multiple text objects based on either an x or y ordinate.
;The text is aligned based upon it's justification
;
;TO RUN***
;At the command line, type (load "c:/lispdir/txtalign")
;where c:/ is the drive where TXTALIGN.lsp is contained
;where lispdir/ is the directory where TXTALIGN.lsp is contained
;
;
;If you find this routine to be helpful, please give consideration
;to making a cash contribution of $10.00 to:
; Jeff Foster
; 590 Penny Rd.
; Angier, NC 27501
;
(DEFUN C:TXTALIGN ()
(INITGET 1 "X x Y y")
(SETQ XY_ORD (GETKWORD "\nALIGN <X> OR <Y> ORDINATE OF TEXT?: "))
(SETQ ORD (GETPOINT "\nPICK ORDINATE: "))
(PRINC "\nSELECT TEXT TO ALIGN")
(SETQ SS (SSGET))
(WHILE (> (SSLENGTH SS) 0)
(SETQ EN (SSNAME SS 0))
(SETQ ED (ENTGET EN))
(SETQ AS (CDR (ASSOC '0 ED)))
(if (= AS "TEXT")
(progn
(setq code72 (cdr (assoc 72 ed)))
(setq code73 (cdr (assoc 73 ed)))
)
)
(cond ((and (= AS "TEXT") (= code72 0) (= code73 0))
(setq pt1 (cdr (assoc '10 ed)))
(setq pt1_x (car pt1))
(setq pt1_y (cadr pt1))
)
((and (= AS "TEXT") (/= code72 0) (/= code73 0))
(setq pt1 (cdr (assoc '11 ed)))
(setq pt1_x (car pt1))
(setq pt1_y (cadr pt1))
)
((and (= AS "TEXT") (= code72 0) (/= code73 0))
(setq pt1 (cdr (assoc '11 ed)))
(setq pt1_x (car pt1))
(setq pt1_y (cadr pt1))
)
((and (= AS "TEXT") (/= code72 0) (= code73 0))
(setq pt1 (cdr (assoc '11 ed)))
(setq pt1_x (car pt1))
(setq pt1_y (cadr pt1))
)
)
(COND ((and (= AS "TEXT") (= XY_ORD "X"))
(COMMAND "MOVE" EN "" PT1 (LIST (CAR ORD) PT1_Y))
(SSDEL EN SS)
)
((AND (= AS "TEXT") (= XY_ORD "Y"))
(COMMAND "MOVE" EN "" PT1 (LIST PT1_X (CADR ORD)))
(SSDEL EN SS)
)
((/= AS "TEXT")
(SSDEL EN SS)
)
)
)
(PRIN1)
)
RE: Aligning Text