Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ANGBASE NOT A REAL NUMBER?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
sthompson1021
375 Views, 2 Replies

ANGBASE NOT A REAL NUMBER?

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)
)

2 REPLIES 2
Message 2 of 3
rkmcswain
in reply to: sthompson1021

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: 

[1] http://exchange.autodesk.com/autocadmep/enu/online-help/BLDSYS/2012/ENU/pages/WS1a9193826455f5ff18cb...

[2] http://help.autodesk.com/view/ACD/2015/ENU/?guid=GUID-947F34FA-5E58-4C7C-A169-556D4B8E2208

 

R.K. McSwain     | CADpanacea | on twitter
Message 3 of 3
sthompson1021
in reply to: rkmcswain

OK, so it is a real number, just not the one I was expectingSmiley Surprised I used the getangle function and it works great.

Thanks for the explanation and help.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost