×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Aligning Text

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

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 "\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

(OP)
It seems to work fine with "normal or exploded text", it does not work with mtext, all the text I have on these drawings is mtext. Any other thoughts?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources