PDA

View Full Version : Problem with rotation in lisp routine.

31st Oct 2004, 11:32 pm
I've been having a ball this weekend since discovering that handy routine to attach lisps to buttons.
I have a query with one of the lisps I found: Basically, the lisp places sequential numeric callouts inside circles on the end of straight leaders. perfect for what I want. The only problem is, when it places the number inside the circle, it appears rotated 90 degrees anticlockwise. I can see in the lisp that it refers to "polar p2" which presumably is the culprit, but I'm not brave enough to play with the code. Can any of you geniuses help with the number rotation.
Can anyone point to something I can change to correct the direction of rotation?
In AutoCAD, I have my base angle set to North and Direction is set to Clockwise.
Here's the code as I've loaded it:

(defun c:B1 ()
(setvar "cmdecho" 0)
(setvar "attdia" 0)
(setvar "texteval" 1)
(setq os (getvar "osmode"))
(setvar "orthomode" 0)
(setq pt1 (getpoint "Pick starting point:"))
(command "line" pt1 pause "")
(setq pt2 (getvar "lastpoint"))
(setq rang (angle pt1 pt2))
(setq ang (/ rang 0.017453))
(setq dsc (getvar "dimtxt"))
(setq pt3 (polar pt2 rang (* dsc 1.2903)))
(if (<= inc 100)
(progn
(setvar "osmode" 1024)
(command "circle" pt3 (* dsc 1.2903))
(command "text" "m" pt3 dsc "0" (itoa inc))
(command "donut" "0.001" (* 0.25 dsc) pt1 "")
(setq inc (+ inc 1))
)
)
(setvar "osmode" os)
(setvar "orthomode" 1)
)

CarlB
2nd Nov 2004, 12:58 am
Again you could avoid this problem by setting angular base& direction to the default. But to answer your question, the problem is in this line:

(command "text" "m" pt3 dsc "0" (itoa inc))

The "0" angle typically produces horizontal text but since you have 0 set to North it becomes vertical text. Change "0" to "90" to get it to work in the "Cadastrophic" angular system :)