只处理"LINE"的问题- (defun exztempl2( ss /)
- (command "layer" "m" "ZTEMPL" "c" 2 "ZTEMPL" "")
- (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))
- (setq mark (< dtmin 0.0000001))
- (if (and (< dtmin dtset)(/= mark T))
- (progn
- (if (> dt1 dt2)
- (command "circle" p4 dtset)
- (command "circle" p3 dtset)
- )
- )
- )
- )
- )
-
- (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)
- (progn
- (setq dt1 (distance p3 pxx))
- (setq dt2 (distance p4 pxx))
- (setq dtmin (min dt1 dt2))
- (setq mark (< dtmin 0.0000001))
- (if (and (< dtmin dtset)(/= mark T))
- (progn
- (if (< dt1 dt2)
- (command "circle" p3 dtset)
- (command "circle" p4 dtset)
-
- )
- )
- )
- )
- )
- )
- )
- )
- )
-
- (setq j (+ j 1))
- )
- (setq i (+ i 1)) )(prin1)
- )
- (defun c:xxx() (setvar "cmdecho" 0)
- (setvar "blipmode" 0)
- (setq sel (getvar "osmode"))
- (setvar "osmode" 0)
- (setvar "filletrad" 0)
- (setq cly (getvar "clayer"))
-
- (setq dtset (getreal "\nSetup join distance?"))
- (setq ss1 (ssget))
- (setq ss1 (ssget "P" '((0 . "LINE"))))
-
- (setq pkx (getvar "pickbox"))
- (setvar "pickbox" 0)
-
- (if (/= ss1 nil)(exztempl2 ss1)) (setvar "osmode" sel)
- (setvar "pickbox" pkx)
- (command "layer" "s" cly "") (prin1)
- )
|