本帖最后由 cheefeel 于 2022-11-11 20:44 编辑
又来求助大佬了,他这套代码中,别的填充都没问题。
但如果填充是SOLID的话,有的时候未选择任何对象的情况下选择填充样式编号后回车,就会立刻填充一个对象,这个对象往往是鼠标范围附近的。
- (defun c:DefaultHatch (/ opt )
- (setvar "measurement" 1) ; 设置公制单位
- (setvar "cmdecho" 0) ; 关闭命令响应
- (setq oldcolor (getvar "cecolor"))
- (if *num_HType*
- (setq num_HType (getint (strcat "\n选择填充样式 ①实体 ②钢砼 ③斜线 ④玻璃 ⑤毛面 ⑥60板 ⑦木纹 ⑧填柱 ⑨填墙: <" (rtos *num_HType* 2 0) ">")))
- (setq num_HType (getint "\n选择填充样式 ①实体 ②钢砼 ③斜线 ④玻璃 ⑤毛面 ⑥60板 ⑦木纹 ⑧填柱 ⑨填墙: " ))
- )
- (if (not num_HType)
- (setq num_HType *num_HType*)
- (setq *num_HType* num_HType)
- )
- (setq opt num_HType)
-
- (if (< 0 opt 10) (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)
- (princ)
- )
- (defun tianchong1 ()
- (prompt "\n当前样式: ①实体\n")
- (prompt "\n请选择对象,跳过则为拾取内部点:\n")
- (command "bhatch" "an" "y" "p" "SOLID" "1" "0" "")
- )
- (defun tianchong2 ()
- (prompt "\n当前样式: ②钢砼\n")
- (prompt "\n请选择对象,跳过则为拾取内部点:\n")
- (command "bhatch" "an" "y" "p" "★钢砼" "0.5" "0" "")
- )
|