CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE
Over 1.091.000 registered users (EN+CZ). AutoCAD tips, Inventor tips, Revit tips. Try the new precise Engineering calculator. New AutoCAD 2026 commands and variables.
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

?
CAD discussions, advices, exchange of experience

CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.
This is a peer-to-peer forum. The forum doesn't replace the official direct technical support provided by ARKANCE for its customers.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic Closedalign text

 Post Reply Post Reply
Author
Kajito View Drop Down
Senior Member
Senior Member


Joined: 29.Oct.2008
Location: Ireland
Status: Offline
Points: 130
Direct Link To This Post Topic: align text
    Posted: 11.Nov.2008 at 16:32
Hi guys,

I need help with the following. I guess it should be pretty simple but I cannot get this sorted myself.
What I'd like to have is a tool (command, button, lisp) that will align text to a line. Manually I would do it the way that I would select the text, go to properties and change the x or y value for all of them so that all the labels are aligned to x or y axis.
I've been thinking about an lisp that would work the way that I will select all the text (labels), enter, than pick the label or line from which the other text would adjust the x or y value.
Can anybody help?
Thanks
Back to Top
Kajito View Drop Down
Senior Member
Senior Member


Joined: 29.Oct.2008
Location: Ireland
Status: Offline
Points: 130
Direct Link To This Post Posted: 13.Nov.2008 at 13:58
ok,
actually I got it. I tried to googe it again and I've found the lisp I was looking for.
Here is the lisp just in case somebody would like to use it as well. My thanks goes to Ramesh Gopal on cadalyst forum.

;;; CADALYST 03/08 www.cadalyst.com/code
;;; Tip 2275: TAL.lsp     Align Text (c) 2008 Ramesh Gopal

; Align a group of TEXT in line with a reference TEXT, horizontally or vertically.
; BY G. Ramesh, NPCC, Abu Dhabi, UAE

(defun C:TALIGN(/ ang newpt p1 p2 p3 p4 chk ss sl i ref opt n rlist elist el1 ep)
(setq ss (ssget) sl (sslength ss) i 0
       ref (car(entsel "\nPick the reference TEXT: "))
       chk (reverse(cdr(reverse(assoc 11 (entget ref)))))
       ang (cdr(assoc 50 (entget ref)))
)
(initget "Ver Hor")
(setq opt (getkword "\nAlign TEXT Vertically or Horizontally <Ver>? "))
(if (not opt) (setq opt "Ver"))
(if (equal chk '(11 0.0 0.0)) (setq n 10) (setq n 11))
(setq rlist (assoc n (setq elist (entget ref))))
(repeat sl
(setq el1 (entget(ssname ss i)) ep (assoc n el1))
(if (= opt "Hor")
   (progn
    (setq p1 (cdr rlist) p2 (polar p1 ang 5.0)
      p3 (cdr ep) p4 (polar p3 (+ ang (/ pi 2)) 5.0)
      newpt (inters p1 p2 p3 p4 nil)
    )
    (entmod (subst (list (car ep) (car newpt) (cadr newpt) (last ep)) ep el1))
   )
   (progn
    (setq p1 (cdr rlist) p2 (polar p1 (- ang (/ pi 2)) 5.0)
      p3 (cdr ep) p4 (polar p3 ang 5.0)
      newpt (inters p1 p2 p3 p4 nil)
    )
    (entmod (subst (list (car ep) (car newpt) (cadr newpt) (last ep)) ep el1))
   )
)
(setq i (1+ i))
)(prin1)
)
Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,078 seconds.