- (vl-load-com)
- (defun c:draw_arc_custom ()
- (prompt "请输入圆心坐标(x,y): ")
- (setq center (getpoint))
- (prompt "请输入半径: ")
- (setq radius (vl-catch-all-apply 'getreal))
- (if (vl-catch-all-error-p radius) (progn (princ "\n输入的半径无效,请重新输入。") (exit)))
- (prompt "请输入起点坐标(x,y): ")
- (setq start_point (getpoint))
- (prompt "请输入圆弧角度的度: ")
- (setq deg (vl-catch-all-apply 'getint))
- (if (vl-catch-all-error-p deg) (progn (princ "\n输入的度无效,请重新输入。") (exit)))
- (prompt "请输入圆弧角度的分: ")
- (setq min (vl-catch-all-apply 'getint))
- (if (or (vl-catch-all-error-p min) (< min 0) (> min 59))
- (progn (princ "\n输入的分无效,请重新输入。") (exit))
- )
- (prompt "请输入圆弧角度的秒: ")
- (setq sec (vl-catch-all-apply 'getint))
- (if (or (vl-catch-all-error-p sec) (< sec 0) (> sec 59))
- (progn (princ "\n输入的秒无效,请重新输入。") (exit))
- )
- (setq radian_angle (+ (* deg pi) (* min (/ pi 60)) (* sec (/ pi 3600))))
- (setq vec1 (mapcar '- start_point center))
- (setq radian_start (atan (cadr vec1) (car vec1))) ;直接获取圆心的坐标值
- (setq center_real (list (car center) (cadr center)))
- (command "ARC" center_real radius radian_start radian_angle)
- )
|