- 积分
- 6634
- 明经币
- 个
- 注册时间
- 2006-11-29
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2014-11-16 21:08:15
|
显示全部楼层
可以的,这个我最终完成版,呵呵,代码有点不太完善,由高手指正!
;;预设常用填充H
;;V1.2
;;增加记忆功能,提高填充的使用方便性
;;----------------------------------
(defun c:H (/ opt oldcolor *error*)
(defun *error* (msg)
(setvar "cecolor""bylayer") ;_ 恢复颜色随层;
(setvar "clayer" mylayer) ;恢复原有图层
(princ "错误信息: ")
(princ msg) ;_ 打印错误信息
(princ)
)
(setvar "measurement" 0) ; 设置公制单位
(setvar "cmdecho" 0) ; 关闭命令响应
(setvar "hpassoc" 0) ;设置填充时不关联
(setq mylayer (getvar "clayer")) ;保存当前层
(setq oldcolor (getvar "cecolor")) ;保存原有颜色
(if *num_HType*
(setq num_HType (getint (strcat "\n选择填充样式 ①砖墙 ②钢筋混凝土 ③素混凝土 ④玻璃 ⑤地砖600 ⑥地砖300 ⑦大理石 ⑧木纹 ⑨拉丝间距50 ⑩实体填充 ⑾水平胶合板 ⑿垂直胶合板 ⒀石膏板 ⒁石材 ⒂墙纸 ⒃磨砂 ⒄天花填充 ⒅600X800墙面抛光砖 ⒆450x300釉面砖: <" (rtos *num_HType* 2 0) ">")))
(setq num_HType (getint "\n选择填充样式 ①砖墙 ②钢筋混凝土 ③素混凝土 ④玻璃 ⑤地砖600 ⑥地砖300 ⑦大理石 ⑧木纹 ⑨拉丝间距50 ⑩实体填充 ⑾水平胶合板 ⑿垂直胶合板 ⒀石膏板 ⒁石材 ⒂墙纸 ⒃磨砂 ⒄天花填充 ⒅600X800墙面抛光砖 ⒆450x300釉面砖: " ))
)
(if (not num_HType)
(setq num_HType *num_HType*)
(setq *num_HType* num_HType)
)
(setq opt num_HType)
(if (< 0 opt 20) (eval (read(strcat "(tianchong" (itoa opt) ")"))));根据选项参数执行填充样式
(if (setq ss (ssget))
(command "bhatch" "s" ss "" "") ;如果选择集不为空,则执行对象填充
(progn ;如果选择集为空,则执行点选命令
(prompt "\n请拾取填充内部点:\n")
(command "bhatch" pause)
(while (> (getvar "CMDACTIVE") 0) (command PAUSE))
))
(command "color" oldcolor) ;设置为原有颜色
;;(setvar "cecolor" "bylayer") ;设置颜色随层
;;(setvar "color" "251") ;设置颜色随层
(setvar "clayer" mylayer)
(princ)
)
(defun tianchong1 ()
(prompt "\n当前样式: ①砖墙 比例500\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(if (= (tblsearch "layer" "PUB_HATCH") nil)
(Command "-layer" "m" "PUB_HATCH" "c" 251 "" "")
(Command "-layer" "t" "PUB_HATCH" "")
)
(setvar "clayer" "PUB_HATCH")
(command "-bhatch" "p" "AN31B" "500" "0" "")
)
(defun tianchong2 ()
(prompt "\n当前样式: ②钢筋混凝土\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(if (= (tblsearch "layer" "PUB_HATCH") nil)
(Command "-layer" "m" "PUB_HATCH" "c" 251 "" "")
(Command "-layer" "t" "PUB_HATCH" "")
)
(setvar "clayer" "PUB_HATCH")
(command "bhatch" "p" "AN31C" "500" "0" "")
)
(defun tianchong3 ()
(prompt "\n当前样式: ③素混凝土\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(if (= (tblsearch "layer" "PUB_HATCH") nil)
(Command "-layer" "m" "PUB_HATCH" "c" 251 "" "")
(Command "-layer" "t" "PUB_HATCH" "")
)
(setvar "clayer" "PUB_HATCH")
(command "bhatch" "p" "AN33C" "200" "0" "")
)
(defun tianchong4 ()
(prompt "\n当前样式: ④玻璃\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(if (= (tblsearch "layer" "PUB_HATCH") nil)
(Command "-layer" "m" "PUB_HATCH" "c" 251 "" "")
(Command "-layer" "t" "PUB_HATCH" "")
)
(setvar "clayer" "PUB_HATCH")
(command "bhatch" "p" "AR-RROOF" "350" "45" "")
)
(defun tianchong5 ()
(prompt "\n当前样式: ⑤600x600地砖\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(command "color" "251")
(command "bhatch" "p" "U" "0" "600" "Y" "")
)
(defun tianchong6 ()
(prompt "\n当前样式: ⑥300x300地砖\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(command "color" "251")
(command "bhatch" "p" "U" "0" "300" "Y" "")
)
(defun tianchong7 ()
(prompt "\n当前样式: ⑦大理石\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(if (= (tblsearch "layer" "PUB_HATCH") nil)
(Command "-layer" "m" "PUB_HATCH" "c" 251 "" "")
(Command "-layer" "t" "PUB_HATCH" "")
)
(setvar "clayer" "PUB_HATCH")
(command "bhatch" "p" "大理石" "100" "0" "")
)
(defun tianchong8 ()
(prompt "\n当前样式: ⑧木纹\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(if (= (tblsearch "layer" "PUB_HATCH") nil)
(Command "-layer" "m" "PUB_HATCH" "c" 251 "" "")
(Command "-layer" "t" "PUB_HATCH" "")
)
(setvar "clayer" "PUB_HATCH")
(command "bhatch" "p" "木纹02" "30" "0" "")
)
(defun tianchong9 ()
(prompt "\n当前样式: ⑨拉丝间距50\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(if (= (tblsearch "layer" "PUB_HATCH") nil)
(Command "-layer" "m" "PUB_HATCH" "c" 251 "" "")
(Command "-layer" "t" "PUB_HATCH" "")
)
(setvar "clayer" "PUB_HATCH")
(command "bhatch" "p" "U" "0" "50" "N" "")
)
(defun tianchong10 ()
(prompt "\n当前样式: ⑩实体填充\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(if (= (tblsearch "layer" "PUB_HATCH") nil)
(Command "-layer" "m" "PUB_HATCH" "c" 251 "" "")
(Command "-layer" "t" "PUB_HATCH" "")
)
(setvar "clayer" "PUB_HATCH")
(command "bhatch" "p" "SOLID" "0" "0" "")
)
(defun tianchong11 ()
(prompt "\n当前样式: ⑾水平胶合板\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(if (= (tblsearch "layer" "PUB_HATCH") nil)
(Command "-layer" "m" "PUB_HATCH" "c" 251 "" "")
(Command "-layer" "t" "PUB_HATCH" "")
)
(setvar "clayer" "PUB_HATCH")
(command "bhatch" "p" "胶合板" "4" "0" "")
)
(defun tianchong12 ()
(prompt "\n当前样式: ⑿垂直胶合板\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(if (= (tblsearch "layer" "PUB_HATCH") nil)
(Command "-layer" "m" "PUB_HATCH" "c" 251 "" "")
(Command "-layer" "t" "PUB_HATCH" "")
)
(setvar "clayer" "PUB_HATCH")
(command "bhatch" "p" "胶合板" "4" "90" "")
)
(defun tianchong13 ()
(prompt "\n当前样式: ⒀石膏板\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(if (= (tblsearch "layer" "PUB_HATCH") nil)
(Command "-layer" "m" "PUB_HATCH" "c" 251 "" "")
(Command "-layer" "t" "PUB_HATCH" "")
)
(setvar "clayer" "PUB_HATCH")
(command "bhatch" "p" "石膏板" "30" "0" "")
)
(defun tianchong14 ()
(prompt "\n当前样式: ⒁石材\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(if (= (tblsearch "layer" "PUB_HATCH") nil)
(Command "-layer" "m" "PUB_HATCH" "c" 251 "" "")
(Command "-layer" "t" "PUB_HATCH" "")
)
(setvar "clayer" "PUB_HATCH")
(command "bhatch" "p" "石材" "50" "0" "")
)
(defun tianchong15 ()
(prompt "\n当前样式: ⒂墙纸\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(if (= (tblsearch "layer" "PUB_HATCH") nil)
(Command "-layer" "m" "PUB_HATCH" "c" 251 "" "")
(Command "-layer" "t" "PUB_HATCH" "")
)
(setvar "clayer" "PUB_HATCH")
(command "bhatch" "p" "CROSS" "150" "0" "")
)
(defun tianchong16 ()
(prompt "\n当前样式: ⒃磨砂\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(if (= (tblsearch "layer" "PUB_HATCH") nil)
(Command "-layer" "m" "PUB_HATCH" "c" 251 "" "")
(Command "-layer" "t" "PUB_HATCH" "")
)
(setvar "clayer" "PUB_HATCH")
(command "bhatch" "p" "DOTS" "1000" "0" "")
)
(defun tianchong17 ()
(prompt "\n当前样式: ⒄天花填充\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(if (= (tblsearch "layer" "PUB_HATCH") nil)
(Command "-layer" "m" "PUB_HATCH" "c" 251 "" "")
(Command "-layer" "t" "PUB_HATCH" "")
)
(setvar "clayer" "PUB_HATCH")
(command "bhatch" "p" "ANSI33" "800" "0" "")
)
(defun tianchong18 ()
(prompt "\n当前样式: ⒅800X600墙面抛光砖\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(if (= (tblsearch "layer" "PUB_HATCH") nil)
(Command "-layer" "m" "PUB_HATCH" "c" 251 "" "")
(Command "-layer" "t" "PUB_HATCH" "")
)
(setvar "clayer" "PUB_HATCH")
(command "bhatch" "p" "800X600墙面抛光砖" "800" "0" "")
)
(defun tianchong19 ()
(prompt "\n当前样式: ⒆450x300釉面砖\n")
(prompt "\n请选择对象,跳过则为拾取内部点:\n")
(if (= (tblsearch "layer" "PUB_HATCH") nil)
(Command "-layer" "m" "PUB_HATCH" "c" 251 "" "")
(Command "-layer" "t" "PUB_HATCH" "")
)
(setvar "clayer" "PUB_HATCH")
(command "bhatch" "p" "450x300釉面砖" "450" "0" "")
) |
|