本帖最后由 llsheng_73 于 2014-6-11 20:29 编辑
- (defun poinpl(pt e / p e1 area area1 dist dist1)
- (setq e(vlax-ename->vla-object e)dist(distance(reverse(cdr(reverse pt)))(vlax-curve-getclosestpointto e pt))area(vla-get-area e)
- e1(car(vlax-safearray->list(vlax-variant-value(vla-offset e(* dist 1e-4)))))area1(vla-get-area e1)
- dist1(distance(reverse(cdr(reverse pt)))(vlax-curve-getclosestpointto e1 pt))) (entdel(entlast))
- (if(< dist 1e-6)0;;线上
- (if(>(*(- area1 area)(- dist1 dist))0)1 -1)));1线内-1线外
- (defun c:tt(/ s1 s2 p m n l)
- (if(setq s1(ssget"X"(list'(0 . "TEXT")(cons 1 (strcat"*"(getstring"\n匹配内容")"*")))))
- (progn(setq i -1)
- (repeat(sslength s1)
- (setq i(1+ i)e(entget(ssname s1 i))p(cons(if(equal(cdr(assoc 10 e))'(0 0 0))(cdr(assoc 11 e))(cdr(assoc 10 e)))p)))
- (if(setq s1(ssget"X"'((0 . "*lyline")(-4 . "<OR")(70 . 1)(70 . 129)(-4 . "OR>"))))
- (progn(setq i -1)
- (repeat(sslength s1)
- (setq i(1+ i)e(ssname s1 i)l(length p)m 0)
- (while(< m l)
- (if(and(>(vla-get-area(vlax-ename->vla-object e))1e-3) (=(poinpl(nth m p)e)1))
- (entmod(setq p(vl-remove(nth m p)p)e(entget e)m l
- e(if(assoc 62 e)(subst'(62 . 1)(assoc 62 e)e)
- (append e'((62 . 1))))))
- (setq m(1+ m)))))))))
- (princ))
我的方法比较另类一点 |