I'm trying to do a simple lisp with just a 2 letter shortcut to set the base angle. It kind of works in that it prompts me for the angle but the results are not right. If I put in 90, it sets the angle at 117. if I enter 180, it sets it at 235. I'm lost. What am I doing wrong.
(defun c:ba ()
(setvar "angbase" (getreal))
(princ)
)
Solved! Go to Solution.
Solved by rkmcswain. Go to Solution.
It looks like the (setvar) is expecting radians instead of degrees.
To see this, try this: where we are converting the degrees entered at the (getreal) to radians before passing it to the (Setvar) function.
(defun Degrees->Radians (numberOfDegrees) (* pi (/ numberOfDegrees 180.0)))
(setvar "angbase" (Degrees->Radians (getreal)))
You could also use the (getangle) function instead with no conversion required.
(setvar "angbase" (getangle))
Ref:
[2] http://help.autodesk.com/view/ACD/2015/ENU/?guid=GUID-947F34FA-5E58-4C7C-A169-556D4B8E2208
OK, so it is a real number, just not the one I was expecting I used the getangle function and it works great.
Thanks for the explanation and help.