Please, what variable is text angle? rs
Um, no. Figured that out. Then there is no variable? How does dtext etc. know what angle to use the next time? More particularly, how can I save the present angle, write text at a new angle and then restore the original? Wait -- I know one way: write a single empty string. Get it as entlast and find assoc 50. Erase the freak string. Any saner suggestion? rs
1) Save the DXF code 50 from the current text style 2) Set it to something else 3) Write your text 4) Restore DXF 50 ....or use (entmake) or (vla-AddText) to write the text as you desire, and not worry about what the current style is set to.
Upon looking it up, dxf 50 is the Oblique angle in the style table, whereas it is the Rotation angle in text objects. (and 51 is the Oblique.) So the question is still open: How can one find the current (most recent) text rotation angle? How does Dtext know? vla-addtext sounds good but "help" is quiet on it. VLIDE looks it up and finds it but the description there is for Basic, not Lisp. Probably the same variables. But the subroutine does not seem to specify the insertion angle. rs 1) Save the DXF code 50 from the current text style 2) Set it to something else 3) Write your text 4) Restore DXF 50 ....or use (entmake) or (vla-AddText) to write the text as you desire, and not worry about what the current style is set to.
How can one find the current (defun get-last-rotationangle (/ ss) (if (setq ss (ssget "_x" '((0 . "TEXT")))) (* (/ (cdr (assoc 50 (entget (ssname ss 0)))) pi) 180.0))) not fully tested.
Sorry, I thought "text angle" meant "obliquing angle" instead of "text string rotation angle" It's all documented, except that the examples are in basic. Take a look at http://www.afralisp.com/vl/pm1.htm for an example in lisp.
But of course. Thanks for the reminder about ssget. I would have thought that the desired member of ss would be the most recent, rather than the first (ssname ss 0). In any case I will give it a twirl. It doesn't really say that ssget will return objects in the order of creation but it seems like a good assumption. rs
Afralisp is already on my favorites list; I should be quicker to look there when I have a question. Thanks for your suggestions, I an better informed now. rs Sorry, I thought "text angle" meant "obliquing angle" instead of "text string rotation angle" It's all documented, except that the examples are in basic. Take a look at http://www.afralisp.com/vl/pm1.htm for an example in lisp.
It doesn't really say that ssget will return objects in the order of other way (defun get-activespace (/ dwg) (setq dwg (vla-get-activedocument (vlax-get-acad-object))) (if (eq (vla-get-activeSpace dwg) acmodelspace) (vla-get-modelspace dwg) (if (eq (vla-get-mspace dwg) :vlax-true) (vla-get-modelspace dwg) (vla-get-paperSpace dwg)))) (defun get-lastobject (/ obj) (not (vl-catch-all-error-p (setq obj (vl-catch-all-apply 'vla-item (list (get-activespace) (1- (vla-get-count (get-activespace)))))))) obj) (defun get-last-textangle (/ obj) (if (and (setq obj (get-lastobject)) (eq (vla-get-objectname obj) "AcDbText")) (vla-get-rotation obj) 0.0))