PICKAUTO=1了,还是不能交叉窗口选择对象,是pause问题吗?
本帖最后由 作者 于 2008-6-22 14:38:01 编辑帮忙看看这段程序。
按S后的选择跟PICKAUTO=0时的选择一样,就是点空白地方不能自动用交叉窗口选择。可是明明PICKAUTO=1了;;;;下面是定义填充范围
(defun getarea() (while (/= 0 (getvar "cmdactive"))(princ "\n 指定PboHatch内部点或 [选择对象(S)]:")(command pause)))
;;;;下面是定义填充好后自动改到正确图层
(defun hatchcly () (while (/= 0 (getvar "cmdactive"))(command pause))(if (not (tblsearch "layer" "!0-hatch"))(command "-layer" "n" "!0-hatch" "c" "8""!0-hatch"""))(if (not (equal entmp1 (entlast)))(command ".CHPROP" "L" "" "LA" "!0-hatch" "")(princ "填充失败!"))(princ))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun C:ht1()(setq entmp1 (entlast))(command "-hatch" "p" "!amberina" "1" "0" (getarea))(hatchcly));
我不会编程,望大家指教。
现在的情况就是:
1、输入命令HT1后,默认点选内部,这个没问题,问题在于,按S后,选择对象时只能一个一个地去选,不是交叉窗口选择。跟PICKAUTO=0时的情况一样,可是已经设置PICKAUTO=1了。
2、如果只是执行(command "-hatch" "p" "!amberina" "1" "0" )其它代码不要。就完全没问题(即默认是点选内部,按S后是交叉窗口选择对象)
不知我表达清楚没
应该怎么改啊。望指点。。。
看看 PICKDRAG 的值是否为 0 <p> PICKDRAG 也是0</p><p>配置如下:</p><p> </p><p></p><p>这里面的配置全都反复试过了,包括各种组合下</p> <p>我看了一下你的程序,不是系统变量的问题</p><p>pause还是少用为好</p><p></p> <p>caoyin大侠</p><p></p><p>那应该怎么改啊。能指点一下吗?</p><p>我要实现的功能就是自动填充(按设置好的比例、角度进行填充,填充完的图层是对的,且不改变当前工作图层)</p><p></p><p>感谢啊。。。</p><p></p> 本帖最后由 作者 于 2008-6-22 18:54:38 编辑
(defun C:ht1 (/ pick entmp1 laytmp)
(initget "Sel")
(setq pick (getpoint "\n指定PboHatch内部点或 [选择对象(S)]: "))
(if (= pick "Sel")
(setq pick (ssget))
)
(if pick
(progn
(setq entmp1 (entlast)
laytmp (getvar "clayer")
)
(if (not (tblsearch "layer" "!0-hatch"))
(command "_.layer" "_n" "!0-hatch" "c" "8" "!0-hatch" "")
)
(setvar "clayer" "!0-hatch")
(if (vl-consp pick)
(command "_.-hatch" "_p" "AR-SAND" "1" "0" pick "")
(command "_.-hatch" "_p" "AR-SAND" "1" "0" "_s" pick "" "")
)
(if (equal entmp1 (entlast))
(princ "填充失败!")
)
(setvar "clayer" laytmp)
)
)
(princ)
) 本帖最后由 作者 于 2008-6-22 18:02:34 编辑
非常感谢
不过好像有点问题。无法运行
我改了一点,我不懂,可能是瞎改。改完可以运行。但图层的无法自换。好像在这段代码里,感觉有很多代码都没执行到。
我改动如下:
1。大侠原代码中有一个地方有个笔误,多了一个双引号
2。为方便调试,我将填充图案的名称改为系统内置的AR-SAND,这样方便有好心人帮忙试一下
3。原来的两行(command pick "")、(command pick """") 我改为(command pick)、(command pick)了,不然运行不了
我改后的代码如下:能再帮忙看看吗?(defun C:ht1 (/ pick entmp1 laytmp)
(initget "Sel")
(setq pick (getpoint "\n指定PboHatch内部点或 [选择对象(S)]: "))
(if (= pick "Obj")
(setq pick (ssget))
)
(if pick
(progn
(setq entmp1 (entlast)
laytmp (getvar "clayer")
)
(if (not (tblsearch "layer" "!0-hatch"))
(command "_.layer" "_n" "!0-hatch" "c" "8" "!0-hatch" "")
)
(setvar "clayer" "!0-hatch")
(command "_.-hatch" "_p" "ar-sand" "1" "0")
(if (vl-consp pick)
(command pick)
(command pick)
)
(if (equal entmp1 (entlast))
(princ "填充失败!")
)
(setvar "clayer" laytmp)
)
)
(princ)
)
本帖最后由 作者 于 2008-6-22 18:55:31 编辑
已修改,我在CAD2009上测试通过 非常感谢
页:
[1]