Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Aligning Text

Status
Not open for further replies.

kmacsys

Civil/Environmental
Feb 5, 2002
62
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.
 
Replies continue below

Recommended for you

Below is one routine I have used in the past, I did not write it, so I left in the credits, cut and paste into a lisp file



;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 &quot;\nALIGN <X> OR <Y> ORDINATE OF TEXT?: &quot;))
(SETQ ORD (GETPOINT &quot;\nPICK ORDINATE: &quot;))
(PRINC &quot;\nSELECT TEXT TO ALIGN&quot;)
(SETQ SS (SSGET))
(WHILE (> (SSLENGTH SS) 0)
(SETQ EN (SSNAME SS 0))
(SETQ ED (ENTGET EN))
(SETQ AS (CDR (ASSOC '0 ED)))
(if (= AS &quot;TEXT&quot;)
(progn
(setq code72 (cdr (assoc 72 ed)))
(setq code73 (cdr (assoc 73 ed)))
)
)
(cond ((and (= AS &quot;TEXT&quot;) (= code72 0) (= code73 0))
(setq pt1 (cdr (assoc '10 ed)))
(setq pt1_x (car pt1))
(setq pt1_y (cadr pt1))
)
((and (= AS &quot;TEXT&quot;) (/= code72 0) (/= code73 0))
(setq pt1 (cdr (assoc '11 ed)))
(setq pt1_x (car pt1))
(setq pt1_y (cadr pt1))
)
((and (= AS &quot;TEXT&quot;) (= code72 0) (/= code73 0))
(setq pt1 (cdr (assoc '11 ed)))
(setq pt1_x (car pt1))
(setq pt1_y (cadr pt1))
)
((and (= AS &quot;TEXT&quot;) (/= code72 0) (= code73 0))
(setq pt1 (cdr (assoc '11 ed)))
(setq pt1_x (car pt1))
(setq pt1_y (cadr pt1))
)
)
(COND ((and (= AS &quot;TEXT&quot;) (= XY_ORD &quot;X&quot;))
(COMMAND &quot;MOVE&quot; EN &quot;&quot; PT1 (LIST (CAR ORD) PT1_Y))
(SSDEL EN SS)
)
((AND (= AS &quot;TEXT&quot;) (= XY_ORD &quot;Y&quot;))
(COMMAND &quot;MOVE&quot; EN &quot;&quot; PT1 (LIST PT1_X (CADR ORD)))
(SSDEL EN SS)
)
((/= AS &quot;TEXT&quot;)
(SSDEL EN SS)
)
)
)
(PRIN1)
)
 
It seems to work fine with &quot;normal or exploded text&quot;, it does not work with mtext, all the text I have on these drawings is mtext. Any other thoughts?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor