一個也許有用的 AutoLISP 程式

cpp 代码
  1. ; file: s-arc.lsp   
  2.   
  3. ; create a useful lisp of small- arc   
  4. ; 模擬 人工畫圖的時候,使用圓規 或是 分規,   
  5. ; 取 等長線段 的動作   
  6. ; -----------------------------------------------   
  7.   
  8. (defun rtod(r1 / )   
  9.   ; d1= (r1/pi)*180.0   
  10.   (* (/ r1 pi) 180.0)   
  11.   ); end of rtod()   
  12. ; -----------------------------------------------   
  13.   
  14. (defun dtor(d1 / )   
  15.   ; r1= (d1/180.0)*pi   
  16.   (* (/ d1 180.0) pi)   
  17.   ); end of dtor()   
  18. ; -----------------------------------------------   
  19.   
  20. (defun c:s-arc( / )   
  21.   (setq p1 (getpoint "\n Get 1st point: "))   
  22.   (setq p2 (getpoint p1 "\n Get 2nd point: "))   
  23.   
  24.   (setq p3 (getpoint "\n Get 3rd point: "))   
  25.   (setq p4 (getpoint p3 "\n Get 4th point: "))   
  26.   ; -----------------------------------------------   
  27.   
  28.   (setq s1 (distance p1 p2))   
  29.   (setq a1 (angle p3 p4))   
  30.   
  31.   (setq a1 (rtod a1))   
  32.   (setq a2 (+ a1 8)   
  33.     a3 (- a1 8))   
  34.      
  35.   (setq p5 (polar p3 (dtor a2) s1)   
  36.     p6 (polar p3 (dtor a3) s1)   
  37.     p4 (polar p3 (dtor a1) s1))   
  38.   
  39.   (command "arc" p5 p4 p6)   
  40.   (princ)   
  41.   ); end of c:s-arc()   
  42. ; end of file   

你可能感兴趣的:(C++,c,PHP,C#,lisp)