Text Align to Object

Does anyone know if there is a simple way to align a piece of existing text to a line etc?

Comments

  • The option align may help with osnap nearest, I think for lots of us have a lisp that pick a pt on line and does 2 things offsets off line and part 2 is set to readable.
  • You could read the Angle of the line in the Properties panel, and enter that value as the Rotation of the text, also in the Properties panel.
  • Terry Dotson
    edited March 11
    If you are involved in Civil/Survey & GIS and are looking for something more than just a rotated line, take a look at the Text Align to Object Tool in DotSoft's CSGTools for BricsCAD. Here's a video showing how it works.

    https://www.youtube.com/watch?v=GHsSmDGymcM
  • You could read the Angle of the line in the Properties panel, and enter that value as the Rotation of the text, also in the Properties panel.

    You don't get that info in the properties panel that I could see as that is how I would've done it.
  • Just_Me
    edited March 20
    Align seems to work OK but more steps then i'd like.
  • Anthony Apostolaros
    edited March 21
    Just_Me said:

    You could read the Angle of the line in the Properties panel, and enter that value as the Rotation of the text, also in the Properties panel.

    You don't get that info in the properties panel that I could see as that is how I would've done it.
    You don't have this in your Properties panel when a line is selected? My v17 does. It's rounded to the nearest whole degree, but that should be close enough for text alignment.




    If not, maybe you can use the custom command by Stig Madsen in the attached lisp file. It gives you an angle by picking the vertex and then any point on each of the two legs.
  • "You don't have this in your Properties panel when a line is selected?"

    I do yes, it's greyed out so I didn't notice it. Well I say I do but I've since updated my version to the latest one before checking just now so I can't say it did before or not.
    But for reference, in the here and now I do get it, it is greyed out so not leaping of the screen at you and it isn't rounded up, it is accurate.

    Thanks to all who chimed in on this.
  • Here's a LISP (works with blocks too, BTW)
    ;;---------------------------------------------------------------------------------------------
    ;; OT (Orient Text) : COMMAND : orient a text object parallel to a given alignment, in three clicks (select text, then 2 points)
    ;;---------------------------------------------------------------------------------------------

    (defun C:OT(/ txt1 pt1 pt2 pt3 tan1 ang1 ent1p)
    (setq txt1 (car (entsel)))
    (setq pt1 (trans (getpoint "first alignment point...") 1 0))
    (setq pt2 (trans (getpoint (trans pt1 0 1) "second alignemnt point...") 1 0))
    (setq pt3 (list
    (- (car pt1) (car pt2))
    (- (cadr pt1) (cadr pt2))
    (- (caddr pt1) (caddr pt2))
    ))
    (setq tan1 (/ (cadr pt3) (car pt3)))
    (setq ang1 (atan tan1))
    (setq ent1p (entget txt1))
    (setq ent1m (subst (cons 50 ang1)(assoc 50 ent1p) ent1p))
    (entmod ent1m)
    (entupd txt1)
    (princ)
    )