;稍微改了下,当练练手,加了个错误处理
 - (defun c:tt ( / *error* s ss ww x sysvar values i )
- (defun *error* (msg)
- (mapcar 'setvar sysvar values)
- (princ)
- )
- (setq sysvar '(cmdecho peditaccept) values (mapcar 'getvar sysvar))
- (mapcar 'setvar '("CMDECHO" "PEDITACCEPT") '(0 1))
- (princ"\n程序功能:支持*LINE,ARC,CIRCLE加粗")
- (if (= jcxw_0 nil) (setq jcxw_0 1))
- (setq ww (getdist (strcat "\n 请输入线宽 <" (rtos jcxw_0 2) ">: ")))
- (if (= ww nil) (setq ww jcxw_0))(setq jcxw_0 ww)
- (command "undo" "be")
- (if (setq ss (ssget ":L" '((0 . "line,*POLYLINE,arc,CIRCLE"))))
- (repeat (setq i (sslength ss))
- (setq s (ssname ss (setq i (1- i))))
- (setq x (cdr (assoc 0 (entget s))))
- (cond
- ((wcmatch x "LINE,ARC")
- (command "_.pedit" s "_j" "" "_w" ww "")
- )
- ((wcmatch x "*POLYLINE")
- (vla-put-constantWidth (Vlax-Ename->Vla-Object s)ww)
- )
- ((eq x "CIRCLE")
- (setq rr (cdr (assoc 40 (entget s))) cen (cdr (assoc 10 (entget s))))
- (command "donut" (* 2 (- rr (/ ww 2))) (* 2 (+ rr (/ ww 2))) cen "")
- (entdel s)
- )
- )
- )
- )
- (command "undo" "e")
- (*error* nil)
- )
|