วันพฤหัสบดีที่ 12 พฤศจิกายน พ.ศ. 2563

Draw Curve

 


;|

       Draw Curve

       - Pick P.C. Point

       - Pick P.I. Point

       - Pick P.T. Point

|;

(defun c:dcur ()

(setq old_cmdecho  (getvar "cmdecho"))

(setq old_osnap (getvar "osmode"))

(setvar "cmdecho" 0)

;;-----radial to dreegee

       (defun rtod (x)

       (/ (* x 180) pi)

       )

;;-----dreegee to radial   

       (defun dtor (x)

       (* x (/ pi 180))

       )

;;----------------------

       (setq ptc (getpoint "\nPick P.C. Point : "))

       (setq pti (getpoint ptc "\nPick P.I. Point : "))

       (setq ptt (getpoint pti "\nPick P.T. Point : "))

      

       (setq angpc (rtod(angle ptc pti))

                angpi (rtod(angle ptt pti))

                angpt (rtod(angle ptt ptc))

       )

       (setq angpi0 (- 180.0 angpi)

                angpc0 (- 180.0 (+ angpc angpi0))     

                angDT  (- 180.0 angpc0)

                angLR  (/ (- 180.0 angDT) 2.0)

       )

       (setq cr (distance ptc ptt)

                lr (/ (/ cr 2.0)(sin (dtor (/ angDT 2.0))))

       )

       (setq cfc (polar ptc (dtor(- (rtod (angle ptc ptt)) angLR)) lr))

       (setvar "osmode" 0)

       (command "_pline" ptc cfc ptt "a" "ce" cfc ptc "")

       (princ)

(setvar "cmdecho" old_cmdecho)

(setvar "osmode" old_osnap)

(princ)      

)

(prompt "\nEnter DCUR to Start Draw Curve.")

;;-----radial to dreegee

       (defun rtod (x)

       (/ (* x 180) pi)

       )

;;-----dreegee to radial   

       (defun dtor (x)

       (* x (/ pi 180))

       )

;;----------------------

ไม่มีความคิดเห็น:

แสดงความคิดเห็น