不改变属性和起点去除多线段冗余点(将假闭合改为闭合)
(defun Plinexy(e / p a b n ob q et d d1 en et) ;;多线段节点坐标(滤掉了多余点,未处理假闭合)(setq a(entget e)ob(vlax-ename->vla-object e)et(cdr(assoc 0 a))n 0 p nil d nil)
(cond((="LWPOLYLINE"et)
(repeat (length a)(setq b (nth n a) n (+ n 1))
(if (= 10 (car b))(progn
(setq q(list (cadr b) (caddr b))d1(vlax-curve-getDistAtPoint ob q))
(if p (if (not(member d1 d)) (setq p (append p (list q))d (append d (list d1))))
(setq p (list q))))
)))
((="POLYLINE"et)
(SETQ EN (ENTGET (SETQ E (ENTNEXT E))))
(WHILE (/= (CDR (ASSOC 0 EN)) "SEQEND")
(SETQ q (CDR (ASSOC 10 EN))d1(vlax-curve-getDistAtPoint ob q)q(reverse(cdr(reverse q))))
(if p(if (not(member d1 d)) (setq p (append p (list q))d (append d (list d1))))
(setq p (list q)))
(SETQ EN (ENTGET (SETQ E (ENTNEXT E)))))
(setq p(reverse p))
)
)
P
)
(defun RYD(/ m n e e1 f a);;删除冗余点
(VL-LOAD-COM)
(setq s(ssget "X"'((0 . "LWPOLYLINE"))))
(if s(progn
(setq m(sslength s)n 0)
(while(< n m)
(setq e1(ssname s n)n(1+ n)p(Plinexy e1)ob(vlax-ename->vla-object e1)e(entget e1'("*"))F 0)
(if (or(=(cdr(assoc 70 e))129)(=(cdr(assoc 70 e))1))(setq p(append p(list(car p)))))
(if (=(vlax-curve-getdistatpoint ob(vlax-curve-getendpoint ob))0)
(setq p(reverse(cdr(reverse p)))F 1)
)
(setq a(list(cons 0 "LWPOLYLINE")(cons 8(cdr(assoc 8 e)))(cons 6(if(assoc 6 e)(cdr(assoc 6 e))""))
(cons 62(if(assoc 62 e)(cdr(assoc 62 e))256))(cons 370(if(assoc 370 e)(cdr(assoc 370 e))0))
(cons 48(if(assoc 48 e)(cdr(assoc 48 e))1))(cons 100 "AcDbEntity")(cons 100 "AcDbPolyline")
(cons 90(-(length P)F))(cons 70 (+ 128 F))(cons 43(if(assoc 43 e)(cdr(assoc 43 e))0))
(cons 38(caddr(vlax-curve-getstartpoint ob)))(cons 39(if(assoc 39 e)(cdr(assoc 39 e))0)))
a(vl-remove (cons 6 "")a))
(foreach e P(setq a(append a(list(append(list 10) e)))))
(entmake(if(assoc -3 e)(append a(list(assoc -3 e)))a))
(entdel e1)
)
)
)
)
是删除多段线重复点吗 是的,不过可以不用entdel原线后再ENTMAKE,可以直接ENTMOD的 今天在研究这个关于多余点非重复点,来学习学习。 是真的好复杂啊... 怎么用不了啊,还是我不会用啊 你好楼主命令是啥呀这个程序
页:
[1]