|
- ;;;圆心、半径、起始角度和终止角度画弧
- ;;;2024.6.21 动态显示
- (defun c:acr(/ *error* arcdata carc cen dxf50 dxf51 ea gr olderr pt r sa)
- (setq olderr *error*)
- (defun *error*(msg) (entdel carc) (princ "\n程序强制已退出!") (princ))
- (while (/= (type (setq cen (getpoint "\n指定圆弧的圆心[ESC退出]:"))) 'LIST))
- (while (/= (type (setq r (getdist cen "\n指定圆弧的半径[ESC退出]: "))) 'REAL))
- (while (/= (type (setq sa (getangle cen "\n指定圆弧起始角度[ESC退出]:"))) 'REAL))
- (setq carc (entmakex (list '(0 . "ARC") (cons 10 cen) (cons 40 r) (cons 50 sa) (cons 51 sa))) arcdata (entget carc))
- (prompt "\n指定圆弧终止角度[ESC退出]:")
- (while (or (and (setq gr (grread T 15 0)) (= (car gr) 5)) (or (= (car gr) 2) (= (car gr) 11) (= (car gr) 12) (= (car gr) 25)))
- (if (= (car gr) 5)
- (progn
- (setq ea (angle cen (cadr gr)))
- (setq arcdata (subst (cons 51 ea) (assoc 51 arcdata) arcdata))
- (entmod arcdata)
- )
- )
- )
- (prompt "\n请使用【空格】改变圆弧方向,左键单击完成!")
- (while (or (and (setq gr (grread T 15 0)) (= (car gr) 5)) (or (= (car gr) 2) (= (car gr) 11) (= (car gr) 12) (= (car gr) 25)))
- (if (equal gr '(2 32))
- (progn
- (setq dxf50 (cons 50 (cdr (assoc 51 arcdata))) dxf51 (cons 51 (cdr (assoc 50 arcdata))))
- (setq arcdata (subst dxf50 (assoc 50 arcdata) arcdata))
- (setq arcdata (subst dxf51 (assoc 51 arcdata) arcdata))
- (entmod arcdata)
- )
- )
- )
- (prin1)
- )
复制代码 |
|