大侠们进来看看,稀疏多段线节点能做到吗?
还是经常用矢量图刻绘,节点太密,想稀疏一下,大概意思是每隔5个节点就删掉4个保留1个,这样刻绘起来下刀没那么密,还请大侠们多多指教!(defun c:tt()
(setq ss (ssget '((0 . "LWPOLYLINE"))))
(if ss
(foreach e1 (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
(setq e (entget e1)
h (reverse (member (assoc 39 e) (reverse e)))
l (LM:LWVertices e)
z (assoc 210 e)
i -1 lst nil)
(foreach a l (if (= 0 (rem (setq i (1+ i)) 4)) (setq lst (cons a lst))))
(entmod (append h(apply 'append (reverse lst))(list z)))
))
(princ)
)
;; LW Vertices-Lee Mac
;; Returns a list of lists in which each sublist describes
;; the position, starting width, ending width and bulge of the
;; vertex of a supplied LWPolyline
(defun LM:LWVertices ( e )
(if (setq e (member (assoc 10 e) e))
(cons
(list
(assoc 10 e)
(assoc 40 e)
(assoc 41 e)
(assoc 42 e)
)
(LM:LWVertices (cdr e))
)))
(vl-load-com) (princ) cable2004侠真是好人,每次提问题都帮热心解决,小妹无以为报,感激不尽!!! 鲜花赠大侠! 各位大侠,还有个小小的建议,按这个程序有可能会出现最后的端点被删除,如多段线有12个端点,每隔4个删除1个,那么最后1个刚好就被删除了,能增加一个判断保证最后的端点不被删除吗? 还是要烦请cable2004侠出马。。 谢谢cable2004 cable2004 发表于 2015-8-2 18:07
这个效率很高呀。
页:
[1]