I have an old lisp routine here that will allow you to pick a line of text and will rotate it to zero angle and allow you to replace its location.
It had always worked in the past, but for some reason now it does not.
Now it just changes the actual text to 0 and allows me to relocate it.
It's supposed to just change the text entity's rotation angle to 0 and allow me to relocate it.
Can someone help me with getting this lisp to work?
;ROTATE TEXT TO 0 DEGREES
;
;
(DEFUN C:R0 ()
(princ "\nSelect TEXT to rotate: ")
(SETq a (SSGET))
(if a (progN
(command "change" a "" "" "" "" "" "0" "")
(command "move" "P" "")
)(prompt "\n................nothing selected......Try again!!! "))
)
@zootango wrote:
....
Now it just changes the actual text to 0 and allows me to relocate it.
It's supposed to just change the text entity's rotation angle to 0 and allow me to relocate it.
....
It was apparently designed to work with Text whose Style does not have a fixed height, and you're using it on something in a Style that does have a fixed height. The Change command is therefore not asking for a new height, and therefore the rotation is being fed in as text content. The last "" is probably recalling the Change command, so the Move command is not being accepted.
You can confirm that by trying it on Text in a non-fixed-height [zero in the Style definition] Style. If that works correctly, and the Style of what it fails on has a fixed height, that's the issue. It can be handled in a couple of ways, but first check whether that is the source of the problem.
By the way, if you don't mind moving it before its rotation is changed to 0, one of those Enters [""] in the Change command is for a new location, and a pause in place of the "" will let you move it there, and eliminate the need for the Move command.
I guess that's another reason why to try to avoid using (command "xxxxx" ...), Kent?? Esp. ones with as many options as the 'change' command?
You can accomplish it with VisualLISP and avoid the issue. Minor code upgrade but still not the greatest. It would be better to loop until a is set instead of just exiting and also checking if a is a text object and has the vla properties used.
(DEFUN C:R0 ( / a) (vl-load-com) (princ "\nSelect TEXT to rotate: ") (setq a (car (entsel))) (if a (progn (setq a (vlax-ename->vla-object a)) (vla-put-rotation a 0.0) (command "move" (vlax-vla-object->ename a) "" (vlax-safearray->list (vlax-variant-value (vla-get-insertionpoint a)))) );progn (prompt "\n................nothing selected......Try again!!! ") );if );defun