 - (defun dxf (grc lst) (cdr (assoc grc lst))
- )
- (defun c:tt (/ ent_bd l len cx js ename elist entna st ed dis st1 ed1 ange angs sy tc)
- (prompt "\n选择需要打断的线:")
- (setq ent_bd (car (cdr (ssgetfirst))))
- (while (= ent_bd nil) (setq ent_bd (ssget '((0 . "LINE")))))
- (setvar "osmode" 0)
- (setq l (getdist "\n两端需要断开的长度:<10>"))
- (if (= l "")
- (setq l 10)
- )
- (if (= l nil)
- (setq l 10)
- )
- (setq sy (getstring "\n是否保留两端断开线段?[是-Y][否-N]<Y>:"))
- (if (= sy "")
- (setq sy "Y")
- )
- (setq len (sslength ent_bd))
- (setq cx 0)
- (setq js 0)
- (repeat len
- (setq ename (ssname ent_bd cx))
- (setq elist (entget ename))
- (setq entna (dxf 0 elist))
- (if (= entna "LINE")
- (progn (setq st (dxf 10 elist))
- (setq ed (dxf 11 elist))
- (setq dis (distance st ed))
- (setq tc (dxf 8 elist))
- (setq angs (angle st ed))
- (setq st1 (polar st angs l))
- (setq bj0 (polar st1 (+ angs (/ pi 2)) 1.5))
- (setq bj1 (polar st1 (+ angs (/ pi 2) pi) 1.5))
- (setq ange (angle ed st))
- (setq ed1 (polar ed ange l))
- (setq bj2 (polar ed1 (+ angs (/ pi 2)) 1.5))
- (setq bj3 (polar ed1 (+ angs (/ pi 2) pi) 1.5))
- (entdel ename)
- (if (or (= sy "Y") (= sy "y"))
- (progn (entmake (list (cons 0 "LINE")
- (cons 8 tc)
- (cons 10 st)
- (cons 11 st1)
- )
- )
- (entmake (list (cons 0 "LINE")
- (cons 8 tc)
- (cons 10 st1)
- (cons 11 ed1)
- )
- )
- (entmake (list (cons 0 "LINE")
- (cons 8 tc)
- (cons 10 ed1)
- (cons 11 ed)
- )
- )
- (entmake (list (cons 0 "LINE")
- (cons 8 tc)
- (cons 10 bj0)
- (cons 11 bj1)
- )
- )
- (entmake (list (cons 0 "LINE")
- (cons 8 tc)
- (cons 10 bj2)
- (cons 11 bj3)
- )
- )
- )
- )
- (if (or (= sy "N") (= sy "n"))
- (entmake (list (cons 0 "LINE")
- (cons 8 tc)
- (cons 10 st1)
- (cons 11 ed1)
- )
- )
- )
- (setq js (+ js 1))
- )
- )
- (setq cx (+ cx 1))
- )
- (princ)
- )
补了个函数 改了两个变量 能用了 不知道是不是这个意思
|