对于外部偏移-可能只是这样:
- (defun c:xf ( / *error* cm e0 e1 e2 e3 el p1 pe ch ) (vl-load-com)
- (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
- (initget "Outside Inside")
- (setq ch (getkword "\nOutside or Inside <Inside> : "))
- (if (or (null ch) (eq ch "Inside"))
- (command "_.offset" 10.0 e1 "_non" p1 "")
- (command "_.offset" 10.0 e1 "_non" (getvar 'extmax) "")
- )
- (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))
- (setq el (cons (vlax-curve-getpointatparam e3 (+ (vlax-curve-getstartparam e3) (/ (- (vlax-curve-getendparam e3) (vlax-curve-getstartparam e3)) 2.0))) el))
- )
- (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。 |