Author Topic: Text Rotation  (Read 5943 times)

0 Members and 2 Guests are viewing this topic.

Craig

  • Guest
Text Rotation
« on: September 07, 2005, 12:55:53 PM »
Does anyone know what the variable for text rotation is?

Something like (getvar 'textsize) but for the text rotation/angle

TIA

tombu

  • Bull Frog
  • Posts: 289
  • ByLayer=>Not0
Re: Text Rotation
« Reply #1 on: September 07, 2005, 01:13:39 PM »
Having spent too much time looking for it I'm pretty sure there isn't one.  Please someone tell me I'm wrong.
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D

CottageCGirl

  • Guest
Re: Text Rotation
« Reply #2 on: September 07, 2005, 01:40:48 PM »
^C^C-attedit;;;;;\;P;\A;\N;

sorry, havent had time to fully explore the new ins and outs of the new stuff

CottageCGirl

  • Guest
Re: Text Rotation
« Reply #3 on: September 07, 2005, 01:42:10 PM »
ooops sorry, I'm in block mode, thats the move/rotate for attributes (maybe someone can still use it) :oops:

Craig

  • Guest
Re: Text Rotation
« Reply #4 on: September 07, 2005, 01:45:25 PM »
I find it hard to believe that it shows up in a list but it's not accessible as some type of variable.

What I want is I've written a program that places an identifier on a line with the distance of the selected line and places the text at a certain distance off the line, at the angle of the line and in the middle of it. What I need is to be able to reset the text rotation back to zero. It seems fairly simple thing to do but in my searching I've yet to find anything that will do this.

Craig

  • Guest
Re: Text Rotation
« Reply #5 on: September 07, 2005, 01:52:30 PM »
Thinkg more I guess a work around is to place the text at zero and auto rotate it to the correct angle. Not what I want to do but if no else has an answer I guess it will have to do.  :?

Craig

  • Guest
Re: Text Rotation
« Reply #6 on: September 07, 2005, 02:02:46 PM »
This worked fine even though it's not what I wanted to do.
Code: [Select]
(command "text" "bl" mecGetPoint mecTxtSize "0" mecLineLength)
(command "rotate" "l" "" mecGetPoint mecAngle)

Crank

  • Water Moccasin
  • Posts: 1503
Re: Text Rotation
« Reply #7 on: September 07, 2005, 02:25:13 PM »
This worked fine even though it's not what I wanted to do.
Code: [Select]
(command "text" "bl" mecGetPoint mecTxtSize "0" mecLineLength)
(command "rotate" "l" "" mecGetPoint mecAngle)
Try this:
Code: [Select]
(command ".text" "bl" mecGetPoint mecTxtSize mecAngle mecLineLength)
Vault Professional 2023     +     AEC Collection

LE

  • Guest
Re: Text Rotation
« Reply #8 on: September 07, 2005, 02:28:52 PM »
Hi,

See if this quick code does what you are looking for.

Load the code in your drawing session, type any text or mtext and use: (get_txtrot_angle)
To read the rotation angle.

HTH

Code: [Select]
(vl-load-com)

(if (not (getenv "TextRotationAngle"))
  (setenv "TextRotationAngle" "0.0"))

(defun savetxtrotangle (reactor params / ename obj)
  (if (and (wcmatch (car params) "TEXT,MTEXT")
   (setq ename (entlast))
   (wcmatch (cdadr (entget ename)) "TEXT,MTEXT"))
    (progn
      (setq obj (vlax-ename->vla-object ename))
      (setenv "TextRotationAngle"
      (rtos (vla-get-rotation obj) 2 8)))))

(if (not text_rotation_angle_reactor)
  (setq text_rotation_angle_reactor
(vlr-editor-reactor
   "text rotation angle"
   '((:vlr-commandended . savetxtrotangle)))))

(defun rtd (a) (* (/ a pi) 180.0))

(defun get_txtrot_angle ()
  (rtd (atof (getenv "TextRotationAngle"))))

(princ)

Craig

  • Guest
Re: Text Rotation
« Reply #9 on: September 07, 2005, 03:00:05 PM »
This worked fine even though it's not what I wanted to do.
Code: [Select]
(command "text" "bl" mecGetPoint mecTxtSize "0" mecLineLength)
(command "rotate" "l" "" mecGetPoint mecAngle)
Try this:
Code: [Select]
(command ".text" "bl" mecGetPoint mecTxtSize mecAngle mecLineLength)


Thats the way I had it at the start. Thats the reason for this thread, to be able to set the text rotation back to zero. If I use the one you show the text is set to that angle throughout the session unless I manually change it.

All I wanted was to set the text rotation to zero after using something like
Code: [Select]
(command ".text" "bl" mecGetPoint mecTxtSize mecAngle mecLineLength)
(setvar 'textrotation 0)

even though that variable does not exist

Bob Wahr

  • Guest
Re: Text Rotation
« Reply #10 on: September 07, 2005, 03:01:32 PM »
you could put your text in along the line, then put in a piece of text at 0 and erase it.  Sloppy, ugly, nasty, but as a last resort.

LE

  • Guest
Re: Text Rotation
« Reply #11 on: September 07, 2005, 03:03:52 PM »
Quote
All I wanted was to set the text rotation to zero....

O....I shoud read first....

Craig

  • Guest
Re: Text Rotation
« Reply #12 on: September 07, 2005, 03:07:08 PM »
you could put your text in along the line, then put in a piece of text at 0 and erase it.  Sloppy, ugly, nasty, but as a last resort.
Thanks, this works fine, just didn't want it that way

Code: [Select]
(command "text" "bl" mecGetPoint mecTxtSize "0" mecLineLength)
(command "rotate" "l" "" mecGetPoint mecAngle)

Craig

  • Guest
Re: Text Rotation
« Reply #13 on: September 07, 2005, 03:08:14 PM »
Quote
All I wanted was to set the text rotation to zero....

O....I shoud read first....

Thanks for the replies

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Text Rotation
« Reply #14 on: September 07, 2005, 04:04:49 PM »
Here is one way to set text angle to zero.
Code: [Select]
(defun c:txt2ang0 (/ ss i obj ename)
  (vl-load-com)
  (prompt "\nSelect text to change angle to zero")
  (and (setq ss (ssget '((0 . "TEXT,MTEXT"))))
       (setq i -1)
       (while (setq ename (ssname ss (setq i (1+ i))))
         (setq obj (vlax-ename->vla-object ename))
         (vlax-put-property obj 'Rotation 0.0)
       )
  )
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Text Rotation
« Reply #15 on: September 07, 2005, 04:14:24 PM »
OK, here is another version, single select.

Code: [Select]
(defun c:txt2ang0 (/ obj ent)
  (vl-load-com)
  (and
    (setq ent (entsel "\nSelect text to change angle to zero"))
    (member (cdr (assoc 0 (entget (car ent)))) '("TEXT" "MTEXT"))
    (setq obj (vlax-ename->vla-object (car ent)))
    (vlax-put-property obj 'Rotation 0.0)
  )
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.