找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 492|回复: 0

[工具] 请求,哪位师傅帮忙改下这个布点程序,源码是我从网上找的。

[复制链接]
发表于 2022-6-30 00:05:17 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

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

×
这是个45度方向的正方形形式布点程序,哪位师傅,帮忙改成正三角形形式,或者正方向正方形形式。如果可以选择3种方式布点更好,如图所示。或者设置成自己给定的直径布圆。
  1. (defun ace-getreal (msg default / ret)
  2. &#160;&#160;(setq ret (getreal (strcat msg " <" (rtos default) ">:")))
  3. &#160;&#160;(if (null ret)
  4. &#160; &#160; default
  5. &#160; &#160; ret
  6. &#160;&#160;)
  7. )

  8. (defun ace-addpoint (p)
  9. &#160;&#160;(vla-addpoint
  10. &#160; &#160; (vla-get-modelspace
  11. &#160; &#160;&#160; &#160;(vla-get-activedocument (vlax-get-acad-object))
  12. &#160; &#160; )
  13. &#160; &#160; (vlax-3d-point p)
  14. &#160;&#160;)
  15. )

  16. (setq *dot-span-dist* 1500.0)

  17. (defun c:tt (/ sx sy p0 p1)

  18. &#160;&#160;(if (and
  19. &#160; &#160; &#160; &#160; (setq p0 (getpoint "指定左下角点:"))
  20. &#160; &#160; &#160; &#160; (setq p1 (getcorner p0 "指定右上角点:"))
  21. &#160; &#160;&#160; &#160;)
  22. &#160; &#160; (progn
  23. &#160; &#160;&#160; &#160;(setq *dot-span-dist*
  24. &#160; &#160; &#160; &#160;&#160; &#160;&#160; &#160;(ace-getreal "输入布点间距" *dot-span-dist*)
  25. &#160; &#160; &#160; &#160;&#160; &#160;&#160;&#160;sx 0
  26. &#160; &#160; &#160; &#160;&#160; &#160;&#160;&#160;sy 0
  27. &#160; &#160;&#160; &#160;)

  28. &#160; &#160;&#160; &#160;(while (<= (+ (car p0) sx) (car p1))
  29. &#160; &#160; &#160; &#160; (while (<= (+ (cadr p0) sy) (cadr p1))
  30. &#160; &#160; &#160; &#160;&#160; &#160;(ace-addpoint (trans (list (+ (car p0) sx) (+ (cadr p0) sy)) 1 0))
  31. &#160; &#160; &#160; &#160;&#160; &#160;(setq sy (+ sy *dot-span-dist*))
  32. &#160; &#160; &#160; &#160; )

  33. &#160; &#160; &#160; &#160; (setq sx (+ sx (/ *dot-span-dist* 2.0)))
  34. &#160; &#160; &#160; &#160; (if (= 0 (rem (/ sx (/ *dot-span-dist* 2.0)) 2))
  35. &#160; &#160; &#160; &#160;&#160; &#160;(setq sy 0)
  36. &#160; &#160; &#160; &#160;&#160; &#160;(setq sy (/ *dot-span-dist* 2.0))
  37. &#160; &#160; &#160; &#160; )
  38. &#160; &#160;&#160; &#160;)
  39. &#160; &#160; )
  40. &#160;&#160;)
  41. &#160;&#160;(princ)
  42. )
-19ae5dacfaa9c12.jpg
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-12-26 15:16 , Processed in 0.609770 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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