明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1043|回复: 2

[源码] 索引程序请帮忙看看怎么不对啊

[复制链接]
发表于 2016-7-29 10:38:06 | 显示全部楼层 |阅读模式
  1. (defun c:tbsy()
  2. (princ "【欢迎使用,程序命令为(圈索引):tbsy】")
  3. (setq oldcmdecho (getvar "cmdecho"))
  4. (setq oldosmode (getvar "osmode"))
  5. (setvar "cmdecho" 0)
  6. (setvar "osmode" 16417)
  7. (command "layer" "m" "索引图层" "c" "7" "" "lt" "CONTINUOUS" "" "p" "n" "" "");索引图层
  8. (setq pt1 (getpoint "\n索引区域中心点位置:"))
  9. (setq pt2 (getpoint pt1 "\n索引线转折点:"))
  10. (command "line" pt1 pt2 "")
  11. (setq l_ast1 (entlast))
  12. (command "change" l_ast1 "" "p" "c" 3 "" )
  13. (setvar "ORTHOMODE" 1)
  14. (setq pt5 (getpoint pt2 "\n索引符号位置:"))
  15. (setq k (angle pt2 pt5))
  16. (setq pt3 (polar pt2 k 2200))
  17. (setq pt4 (polar pt3 k 100))
  18. (command "line" pt2 pt4 ""))
  19. (setq l_ast (entlast))
  20. (command "change" l_ast "" "p" "c" 3 "" )
  21. (setvar "ORTHOMODE" 0)
  22. (setq pt1_mid (mid_pt pt3 pt4))
  23. (command "circle" pt3 pt4)
  24. (setq l_ast (entlast))
  25. (command "change" l_ast "" "p" "c" 3 "" )
  26. (setq t1 (getstring "\n索引代号:"))
  27. (setq t2 (getstring "\n索引图纸编号:"))
  28. (command "style" "TSSD_Bold" "tssdeng2,china" "0" "1.0" "0" "" "" "")
  29. (command "-style" "TSSD_Bold" "" 0 1 0 "n" "n" "n")
  30. (setq pt7 (polar pt1_mid (* pi 0.5) 200))
  31. (command "-text" "j" "m" pt7 350 0 t1)
  32. (setq pt7 (polar pt1_mid (* pi -0.5) 210))
  33. (command "-text" "j" "m" pt7 350 0 t2)
  34. (setq pt1_mid (mid_pt pt2 pt3)
  35.       p4   (polar pt1_mid (* 0.5 pi) 100) ;;文字起点
  36.       )
  37. (setq str "TB2012-1")
  38. (command "text" "j" "c" "non" p4 300 0 str)
  39. (command "-style" "TSSD_Bold" "" 0 75 0 "n" "n" "n")
  40. (setvar "cmdecho" oldcmdecho)
  41. (setvar "osmode" oldosmode)
  42. (setvar "PLINEWID" 0)
  43. (setvar "AUTOSNAP" 61)
  44. (print)
  45. )
请帮忙看看怎么不对啊


"觉得好,就打赏"
还没有人打赏,支持一下
 楼主| 发表于 2016-7-29 11:13:13 | 显示全部楼层
(defun mid_pt (a b)
(mapcar
'(lambda (a b) (/ (+ a b) 2))
a
b
)
)
漏了一个这个,补上
发表于 2016-7-29 17:52:18 | 显示全部楼层
你要改一改,不然这个图层是非打印图层,因为这个程序是那天我发群里的,当时没有注意,图层设置成非打印了,我又加了两个命令。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-26 03:06 , Processed in 0.169361 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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