李好极了。。。仅对代码进行了轻微修改(突出显示):
- (defun c:xf ( / *error* cm e0 e1 e2 e3 el p1 pe ) [highlight](vl-load-com)[/highlight]
- (defun *error* ( msg )
- (if (= 'int (type cm))
- (setvar 'cmdecho cm)
- )
- (if (= 'int (type pe))
- (setvar 'peditaccept pe)
- )
- (if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
- (princ (strcat "\nError: " msg))
- )
- (princ)
- )
-
- (setq cm (getvar 'cmdecho)
- pe (getvar 'peditaccept)
- )
- (setvar 'cmdecho 0)
- (setvar 'peditaccept 1)
- (while (setq p1 (getpoint "\nPick Internal Point <Exit>: "))
- (setq e0 (entlast)
- el nil
- )
- (command "_.-boundary" "_A" "_I" "_N" "" "_O" "_P" "" "_non" p1 "")
- (setq e1 (entlast))
- (if (not (eq e0 e1))
- (progn
- (command "_.offset" 10.0 e1 "_non" p1 "")
- (setq e2 (entlast))
- (if (not (eq e1 e2))
- (progn
- (command "_.chprop" e2 "" "_LA" "0" "_C" 1 "")
- (command "_.explode" e2)
- (setq e3 e2)
- (while (setq e3 (entnext e3))
- [highlight](setq el (cons (vlax-curve-getpointatparam e3 (+ (vlax-curve-getstartparam e3) (/ (- (vlax-curve-getendparam e3) (vlax-curve-getstartparam e3)) 2.0))) el))[/highlight]
- )
- (mapcar
- '(lambda ( a b ) (setvar 'filletrad 10.0) (command "_.fillet" a b))
- (cons (last el) el)
- el
- )
- (command "_.pedit" "_M")
- (while (setq e2 (entnext e2))
- (command e2)
- )
- (command "" "_J" "" "")
- )
- (alert "Unable to perform offset.")
- )
- (entdel e1)
- )
- (alert "Unable to detect boundary.")
- )
- )
- (setvar 'peditaccept pe)
- (setvar 'cmdecho cm)
- (princ)
- )
M、 R。 |