Dtr and Rtd

Discussion in 'AutoCAD' started by Adesu, Jun 14, 2004.

  1. Adesu

    Adesu Guest

    Dear Alls,I've got problem if load program from forum,like this
    (setq opbase (polar b1 (+ a (dtr 0)) dist1)pt b1)
    (setq opbase (polar b2 (+ a (dtr 0)) dist2)pt b2))
    it contains "dtr or rtd",visual console editor said;
    ; error: no function definition: DTR/RTD
    and in my "AutoLisp reference" help,there isn't dtr or rtd (acad 2000)
    How to solve this ,thanks for your help
    Best regards
    Ade Suharna
     
    Adesu, Jun 14, 2004
    #1
  2. Adesu

    Josh C Guest

    ;degrees to radians function
    (defun dtr (x)(* pi (/ x 180.0)))

    ;radians to degrees function
    (defun rtd (x) (* x (/ 180.0 pi)))
     
    Josh C, Jun 14, 2004
    #2
  3. Adesu

    Jürg Menzi Guest

    (defun dtr (x)(* Pi (/ x 180.0))) ;Degrees To Radians
    Returns 0 in this case, finally not necessary.

    In most cases you can replace 'dtr' with a fraction of Pi:
    - 45° = (* Pi 0.25)
    - 90° = (* Pi 0.5)
    - 135° = (* Pi 0.75)
    - 180° = Pi
    - 225° = (* Pi 1.25)
    - 270° = (* Pi 1.5)
    - 315° = (* Pi 1.75)
    - 360° = (* Pi 2)

    It would be better to use radians in your programs. There is nearly
    no need to convert degrees to radians. Converting radians to degrees
    is only necessary for commands they ask for angles or messages to the
    user.

    Cheers
     
    Jürg Menzi, Jun 14, 2004
    #3
  4. Adesu

    Adesu Guest

    Hi Menzi & Josh ,thanks a lot for comment

     
    Adesu, Jun 14, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.