2009年4月9日 星期四

AutoLisp homework

Input the Diameter D and a point in the work area
  • (defun C:CIR_Ex(/ )
  • (setvar "BLIPMODE" 0)
  • (setq OSM (getvar "osmode"))
  • (setvar "osmode" 0)
  • (setq CP (getpoint "\nEnter Center Point..."))
  • (setq RA (getdist CP "\nEnter Radius ..."))
  • (command "circle" CP RA)
  • (princ)
  • (command "ARC" "C" (POLAR CP (DTR 0) RA) (POLAR CP (DTR 60) RA) (POLAR CP (DTR -60) RA))
  • (setvar "osmode" OSM)
  • )
  • (DEFUN DTR (a)
  • (* Pi (/ a 180.0))
  • )

1 則留言:

horng jt 提到...

(defun C:CIR_Ex(/ )
(setvar "BLIPMODE" 0)
(setq CP (getpoint "\nEnter Center Point..."))
(setq RA (getdist CP "\nEnter Radius ..."))
(command "circle" CP RA)

(setq SA 0)
(repeat 6
(princ)
(command "ARC" "C" (POLAR CP (DTR SA) RA) (POLAR CP (DTR (+ SA 60)) RA) (POLAR CP (DTR (- SA 60)) RA))
(setq SA (+ SA 60))
)
)

(DEFUN DTR (a)
(* Pi (/ a 180.0))
)