明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3114|回复: 2

求助高手

[复制链接]
发表于 2011-12-8 11:19:38 | 显示全部楼层 |阅读模式
为什么在我添加上角度之后反而不能终止循环呢?
  1. (defun GX-003 (a)
  2. (* a (/ pi 180.000000)))

  3. (defun GX-001 ()
  4. (if (tblsearch "layer" "H-SOLID LINE")
  5. (setvar "clayer" "H-SOLID LINE")
  6. (command "layer" "m" "H-SOLID LINE" "c" "3" "" "l" "continuous" "" "lw" "0.09" "" "")
  7. )
  8. )

  9. (defun c:ssaa (/ p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 e ee eee eeee eeee curlay sc ang mouse)
  10. (setvar "cmdecho" 0)
  11. (setq curlay (getvar "Clayer"))
  12. (setvar "osmode" 0)
  13. (SETQ curlay(getvar "clayer"))
  14. (setq p1 (getpoint "插入点:"))
  15. (setq p11 (cadr (setq mouse (grread T 5 0))))
  16. (setvar "OSMODE" 0)
  17. (GX-001)
  18. (setq p2 (polar p1 (GX-003 90) 2.5))
  19. (setq p3 (polar p1 (GX-003 90) 3.5))
  20. (setq p4 (polar p1 (GX-003 90) 4.5))
  21. (setq p5 (polar p1 (GX-003 90) 5))
  22. (setq p7 (polar p4 (GX-003 -45) 1))
  23. (setq p8 (polar p3 (GX-003 -45) 1))
  24. (setq p9 (polar p2 (GX-003 -45)1))
  25. (setq p6 (polar p7 (GX-003 90) 0.5))
  26. (setq p10 (polar p9 (GX-003 -90) 0.5))
  27. (command "line" p1 p5 "")
  28. (setq e (entlast))
  29. (setq ss (ssadd))
  30. (ssadd e ss)
  31. (command "line" p4 p7 "")
  32. (setq ee (entlast))
  33. (ssadd ee ss)
  34. (command "line" p3 p8 "")
  35. (setq eee (entlast))
  36. (ssadd eee ss)
  37. (command "line" p2 p9 "")
  38. (setq eeee (entlast))
  39. (ssadd eeee ss)
  40. (command "line" p6 p10 "")
  41. (setq eeeee (entlast))
  42. (ssadd eeeee ss)
  43. (setvar "Clayer" curlay)
  44. (if (null (tblsearch "block" "molded")
  45. )
  46. (COMMAND "block" "molded" p1 ss "")
  47. (command "erase" ss "")
  48. )
  49. (setq sc (* 2 (getvar "ltscale")))
  50. (while (/= (car (setq mouse (grread mouse 5 0))) 3)  
  51. (setq p11 (cadr mouse))
  52. (setq ang (angle p1 p11))
  53. (COMMAND "insert" "molded" "s" sc "r" ang p1 )
  54. )
  55. (setvar "osmode" 16383)

  56. (princ))

下面这个是没有增加角度的,程序可执行但提示有问题
  1. (defun GX-003 (a)
  2. (* a (/ pi 180.000000)))

  3. (defun GX-001 ()
  4. (if (tblsearch "layer" "H-SOLID LINE")
  5. (setvar "clayer" "H-SOLID LINE")
  6. (command "layer" "m" "H-SOLID LINE" "c" "3" "" "l" "continuous" "" "lw" "0.09" "" "")
  7. )
  8. )

  9. (defun c:ssaa (/ p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 e ee eee eeee eeee curlay sc ang mouse)
  10. (setvar "cmdecho" 0)
  11. (setq curlay (getvar "Clayer"))
  12. (setvar "osmode" 0)
  13. (SETQ curlay(getvar "clayer"))
  14. (setq p1 (getpoint "插入点:"))
  15. (setq p11 (cadr (setq mouse (grread T 5 0))))
  16. (setvar "OSMODE" 0)
  17. (GX-001)
  18. (setq p2 (polar p1 (GX-003 90) 2.5))
  19. (setq p3 (polar p1 (GX-003 90) 3.5))
  20. (setq p4 (polar p1 (GX-003 90) 4.5))
  21. (setq p5 (polar p1 (GX-003 90) 5))
  22. (setq p7 (polar p4 (GX-003 -45) 1))
  23. (setq p8 (polar p3 (GX-003 -45) 1))
  24. (setq p9 (polar p2 (GX-003 -45)1))
  25. (setq p6 (polar p7 (GX-003 90) 0.5))
  26. (setq p10 (polar p9 (GX-003 -90) 0.5))
  27. (command "line" p1 p5 "")
  28. (setq e (entlast))
  29. (setq ss (ssadd))
  30. (ssadd e ss)
  31. (command "line" p4 p7 "")
  32. (setq ee (entlast))
  33. (ssadd ee ss)
  34. (command "line" p3 p8 "")
  35. (setq eee (entlast))
  36. (ssadd eee ss)
  37. (command "line" p2 p9 "")
  38. (setq eeee (entlast))
  39. (ssadd eeee ss)
  40. (command "line" p6 p10 "")
  41. (setq eeeee (entlast))
  42. (ssadd eeeee ss)
  43. (setvar "Clayer" curlay)
  44. (if (null (tblsearch "block" "molded")
  45. )
  46. (COMMAND "block" "molded" p1 ss "")
  47. (command "erase" ss "")
  48. )
  49. (setq sc (* 2 (getvar "ltscale")))
  50. (while (/= (car (setq mouse (grread mouse 5 0))) 3)   
  51. (setq p11 (cadr mouse))
  52. (setq ang (angle p1 p11))
  53. (COMMAND "insert" "molded" "s" sc  p1 )
  54. )
  55. (setvar "osmode" 16383)

  56. (princ))

发表于 2011-12-8 12:22:34 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
 楼主| 发表于 2011-12-8 12:26:54 | 显示全部楼层
就是自己学习一下 功能意义不大
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-7-23 12:13 , Processed in 0.163892 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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