meflying发表于2004-8-24 10:43:00(command \"_.extend\" dd \"\" (cons ee pt) \"\") 老大,我的经验是extend不可行,fillet可行参考程序:设定距离内,线段延伸或截断- (defun exztempl2 () (setq i 0)
- (repeat (sslength ss)
- (setq ename (ssname ss i))
- (setq endata (entget ename))
- (setq enlay (cdr (assoc 8 endata)))
- (setq p1 (cdr (assoc 10 endata)))
- (setq p2 (cdr (assoc 11 endata)))
- (setq j 0)
- (setq dtmin nil)
- (repeat (- (sslength ss) 0)
- (setq eename (ssname ss j))
- (setq eedata (entget eename))
- (setq eenlay (cdr (assoc 8 eedata)))
- (setq p3 (cdr (assoc 10 eedata)))
- (setq p4 (cdr (assoc 11 eedata)))
- (if (and (/= i j) (= enlay eenlay))
- (progn
- (setq px (inters p1 p2 p3 p4))
- (setq px2 (inters p1 p2 p3 p4 nil)) (if (/= px nil)
- (progn
- (setq dt1 (distance p3 px))
- (setq dt2 (distance p4 px))
- (setq dtmin (min dt1 dt2))
- (if (and (< dtmin dtset) (/= dtmin 0))
- (progn
- (if (> dt1 dt2)
- (command "trim" ename "" p4 "")
- (command "trim" ename "" p3 "")
- )
- )
- )
- )
- ) (if (and (= px nil) (/= px2 nil)) ;不平行,有延伸交点
- (progn
- (setq px (inters p1 p2 p3 p4 nil))
- (setq pxx (inters p3 px p1 p2))
- (if (/= pxx nil) ;有延伸交点在P12线上
- (progn
- (setq dt1 (distance p3 pxx))
- (setq dt2 (distance p4 pxx))
- (setq dtmin (min dt1 dt2))
- (if (< dtmin dtset)
- (progn
- (if (< dt1 dt2)
- (command "extend" ename "" p3 "")
- (command "extend" ename "" p4 "")
- )
- )
- )
- )
- (progn
- (setq dt1 (distance p3 px))
- (setq dt2 (distance p4 px))
- (setq dtmin (min dt1 dt2))
- (if (< dtmin dtset)
- (progn
- (if (< dt1 dt2)
- (command "fillet" ename (cons eename p3))
- (command "fillet" ename (cons eename p4))
- )
- )
- )
- )
- )
- )
- )
- )
- ) (setq j (+ j 1))
- )
- (setq i (+ i 1)) ) (prin1)
- )
- (defun c:xxx () (setvar "cmdecho" 0)
- (setvar "blipmode" 0)
- (setq sel (getvar "osmode"))
- (setq dfc (getvar "dimlfac"))
- (setvar "osmode" 0)
- (setvar "filletrad" 0)
- (setq cly (getvar "clayer"))
- (setq dtset (getreal "\nSetup join distance?")) (setq ss (ssget))
- (setq ss (ssget "p" '((0 . "LINE")))) (setq pkx (getvar "pickbox"))
- (setvar "pickbox" 0) (if (/= ss nil)
- (exztempl2)
- ) (setvar "osmode" sel)
- (setvar "pickbox" pkx)
- (command "layer" "s" cly "") (prin1)
- )
|