明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1382|回复: 7

[讨论] 大侠们进来看看,稀疏多段线节点能做到吗?

[复制链接]
发表于 2015-8-2 17:07:29 | 显示全部楼层 |阅读模式
还是经常用矢量图刻绘,节点太密,想稀疏一下,大概意思是每隔5个节点就删掉4个保留1个,这样刻绘起来下刀没那么密,还请大侠们多多指教!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2015-8-2 18:07:41 | 显示全部楼层
  1. (defun c:tt()
  2.    (setq ss (ssget '((0 . "LWPOLYLINE"))))
  3.    (if ss
  4.    (foreach e1 (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
  5.      (setq e (entget e1)
  6.            h (reverse (member (assoc 39 e) (reverse e)))
  7.            l (LM:LWVertices e)
  8.            z (assoc 210 e)
  9.            i -1 lst nil)
  10.      (foreach a l (if (= 0 (rem (setq i (1+ i)) 4)) (setq lst (cons a lst))))
  11.      (entmod (append h(apply 'append (reverse lst))(list z)))
  12. ))
  13.    (princ)
  14. )
  15. ;; LW Vertices  -  Lee Mac
  16. ;; Returns a list of lists in which each sublist describes
  17. ;; the position, starting width, ending width and bulge of the
  18. ;; vertex of a supplied LWPolyline
  19. (defun LM:LWVertices ( e )
  20.     (if (setq e (member (assoc 10 e) e))
  21.         (cons
  22.             (list
  23.                 (assoc 10 e)
  24.                 (assoc 40 e)
  25.                 (assoc 41 e)
  26.                 (assoc 42 e)
  27.             )
  28.             (LM:LWVertices (cdr e))
  29. )))

  30. (vl-load-com) (princ)
 楼主| 发表于 2015-8-2 23:33:40 | 显示全部楼层
cable2004侠真是好人,每次提问题都帮热心解决,小妹无以为报,感激不尽!!!
 楼主| 发表于 2015-8-2 23:35:19 | 显示全部楼层
鲜花赠大侠!
 楼主| 发表于 2015-8-11 22:27:13 | 显示全部楼层
各位大侠,还有个小小的建议,按这个程序有可能会出现最后的端点被删除,如多段线有12个端点,每隔4个删除1个,那么最后1个刚好就被删除了,能增加一个判断保证最后的端点不被删除吗?
 楼主| 发表于 2015-8-13 09:04:57 | 显示全部楼层
还是要烦请cable2004侠出马。。
发表于 2019-12-23 15:42:10 | 显示全部楼层
谢谢cable2004
发表于 2022-3-30 01:20:43 | 显示全部楼层

这个效率很高呀。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-9-29 09:32 , Processed in 0.183603 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表