明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1410|回复: 1

[源码] 填充源码小程序,看看对大家有用没

[复制链接]
发表于 2015-1-25 19:46:04 | 显示全部楼层 |阅读模式
本帖最后由 HGHG011 于 2015-1-28 14:37 编辑

代替原来的bh填充命令

本人菜鸟一枚,程序写得不好勿怪

  1. ;;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. ;;;;;;说明
  3. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4. ;1.填充命令 bh (输入命令后 1左键直接指定多段线内部点填充,
  5. ;                           2 右键选择需要填充的对象)
  6. ;2.设置填充 sbh (选择填充体)

  7. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  8. ;;;;;;说明
  9. ;;;----------------------------------------------------------------------



  10. ;;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  11. ;;;;;;主程序
  12. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;






  13. (defun c:bh ( / *error*)
  14.        
  15.         (defun *error* (msg)
  16.   (setvar "osmode" os)
  17.   (setvar "clayer" dqtc)
  18.   (princ "出错: ")
  19.   (princ msg)

  20.   (princ)
  21. )
  22.        
  23.         (setq os (getvar "osmode"))

  24. (setvar "osmode" 0)
  25.        
  26.        
  27.        
  28.        
  29.         (setq dqtc (getvar "clayer"))
  30.         (if tatc
  31.                 (command "layer"  "s"  tatc "")
  32.         )
  33.         (if (= tuan nil)
  34.                 (setq
  35.                         tuan "SOLID"
  36.                         tabl 100
  37.                         tajd 0
  38.                 )
  39.         )
  40.        
  41.        
  42.         (if (= tuan "SOLID" )
  43.                
  44.                 (progn
  45. (setq pt (getpoint))
  46.                         (command "-hatch"  "p" "SOLID" pt)
  47.                         (while (> (getvar "CMDACTIVE") 0) (command PAUSE))
  48.                         (if  pt
  49.                                 (princ)
  50.                                 (command "-hatch"  "p" "SOLID" "s" (setq ss (ssget)) "" "")
  51.                         )
  52.                 )
  53.                 (progn
  54.                         (setq pt (getpoint))
  55.                         (command "-hatch"  "p" tuan tabl tajd pt)
  56.                         (while (> (getvar "CMDACTIVE") 0) (command PAUSE))
  57.                         (if   pt
  58.                                 (princ)
  59.                                 (command "-hatch"  "p" tuan tabl tajd "s" (setq ss (ssget)) "" "")
  60.                         )
  61.                 )
  62.         )
  63.         (setvar "clayer" dqtc)
  64. (setvar "osmode" os)

  65.         (princ)
  66. )
  67. (defun c:sbh( / ss )
  68.         (setq tuan (cdr (assoc 2 (entget (car (setq ss (entsel) ))))));提取属性
  69.        
  70.         (if (= tuan "SOLID")
  71.                 (setq tatc (cdr (assoc 8 (entget (car ss)))))
  72.                 (progn
  73.                        
  74.                         (setq tabl (cdr (assoc 41 (entget (car ss)))))
  75.                         (setq tatc (cdr (assoc 8 (entget (car ss)))))
  76.                         (setq tajd (angtos (cdr (assoc 52 (entget (car ss))))  0 4) )
  77.                 )
  78.         )
  79.         ;(setq tajd (cdr (assoc 41 (entget (car ss)))))

  80.         (princ)
  81. )
  82. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  83. ;;;;;;主程序
  84. ;;;----------------------------------------------------------------------





2015-1-28 改

本帖子中包含更多资源

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

x
发表于 2015-1-28 12:56:36 | 显示全部楼层
有待验证,先支持一下
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-23 13:07 , Processed in 0.197026 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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