需要用户提示lis的帮助
我无法使这部分代码正常工作。它甚至不会弹出一个错误,就像它忽略了它一样,是的,我确实列出了我的变量(cond
((setq hide (getkword "\nHide Box? ? <Y>"))
)
(if hide
(command "-layer" "s" "Dim" "off" "Dim" "")
("")
)
尝试更改:
(command "-layer" "s" "Dim" "off" "Dim" "")
为此:
(command "_.layer" "s" "Dim" "off" "Dim" "Y")
如果这不起作用,我建议提交lisp的重置。 只是稍微调整一下代码
使用getkword建立关键字以供下一个用户输入函数调用使用时添加Initget
(initget "Y N") ;Set the key words
(setq hide (getkword "\nHide Box? ? <Y>")) ;Get the input
(if
(= hide "Y") ;If the user has entered the required key "Y"
(command "_.layer" "s" "Dim" "off" "Dim" "Y" "") ;Turn off the layer
)
当做
杰米 不确定这是否适用,但在使用initget函数时,我通常在initget函数语法之后指定位引用。我没有太多使用initget函数的经验,如果我错了,请纠正我。
即
(initget 1 "Y N") ; 1 = no null input
(setq hide (getkword "\nHide Box? ? <Y>")) ;Get the input
(if
(= hide "Y") ;If the user has entered the required key "Y"
(command "_.layer" "s" "Dim" "off" "Dim" "Y" "") ;Turn off the layer
)
希望这有帮助
(initget "Yes No")
(if (/= "No" (getkword "\nHide Box? ? <Y>: "))
(command "_.LAYER" "s" "Dim" "_Off" "Dim" "_Y" ""))
通过使用(initget)位标志强制输入,可以否定默认的“Y”。因此,零响应不等于“否”,因此测试为T和_。将处理层调用。
我更喜欢initget调用中的完整单词。即使使用完全是非,非负矩阵不等式Y和N仍然有效。
这里有两个Gottcha。
-如果层DIM不存在怎么办?
-如果层DIM冻结了怎么办?
-如果sysvar EXPERT设置为5,则忽略关闭当前层的提示。
健壮的层命令可能是一个相当长的调用。我的0.02美元-David 我得到“无效用户关键字”
页:
[1]