TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Craig 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
-
Having spent too much time looking for it I'm pretty sure there isn't one. Please someone tell me I'm wrong.
-
^C^C-attedit;;;;;\;P;\A;\N;
sorry, havent had time to fully explore the new ins and outs of the new stuff
-
ooops sorry, I'm in block mode, thats the move/rotate for attributes (maybe someone can still use it) :oops:
-
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.
-
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. :?
-
This worked fine even though it's not what I wanted to do.
(command "text" "bl" mecGetPoint mecTxtSize "0" mecLineLength)
(command "rotate" "l" "" mecGetPoint mecAngle)
-
This worked fine even though it's not what I wanted to do.
(command "text" "bl" mecGetPoint mecTxtSize "0" mecLineLength)
(command "rotate" "l" "" mecGetPoint mecAngle)
Try this:
(command ".text" "bl" mecGetPoint mecTxtSize mecAngle mecLineLength)
-
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
(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)
-
This worked fine even though it's not what I wanted to do.
(command "text" "bl" mecGetPoint mecTxtSize "0" mecLineLength)
(command "rotate" "l" "" mecGetPoint mecAngle)
Try this:
(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
(command ".text" "bl" mecGetPoint mecTxtSize mecAngle mecLineLength)
(setvar 'textrotation 0)
even though that variable does not exist
-
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.
-
All I wanted was to set the text rotation to zero....
O....I shoud read first....
-
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
(command "text" "bl" mecGetPoint mecTxtSize "0" mecLineLength)
(command "rotate" "l" "" mecGetPoint mecAngle)
-
All I wanted was to set the text rotation to zero....
O....I shoud read first....
Thanks for the replies
-
Here is one way to set text angle to zero.
(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)
)
-
OK, here is another version, single 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)
)