警报框帮助
你好我是使用lisp代码设置规模t**** Hidden Message ***** 也许吧。。这给了你想要的结果吗??
(defun c:test (/ s)
(if (setq s (getvar 'useri1))
(progn
(princ (strcat "\n The drawing scale is 1:" (itoa s)))
(if (not (atoms-family 0 '("c:setsc")))
(alert "Scale not set. Aborting ... ")
(progn
(c:setsc)
(setq s (getvar 'useri1))
)
)
)
)
(princ)
)
我看不出你是如何在任何形式中设置比例的,只是设置一个用户变量。
。。。问题是,任何人都可以访问变量,任何程序都可以更改变量的值。
补充:另外,您需要(比如说)7.5的值的可能性有多大。整数将不会产生任何影响, 嗨,kdub。感谢您的重播。我做了这个更改
(defun c:test (/ s)
(if (setq s (getvar 'useri1))
(progn
;(princ (strcat "\n The drawing scale is 1:" (itoa s)))
(alert (strcat "\n The drawing scale is 1:" (itoa s)))
(if (not (atoms-family 0 '("c:setsc")))
(alert "Scale is set. Aborting ... ")
(progn
(c:setsc)
(setq s (getvar 'useri1))
)
)
)
)
(princ)
)
这个代码没有按预期工作。我想要如果比例是0,那么(c:setsc)并设置一个比例,如果比例是另一个数字,如(50,100,200,250,500等),然后跳过检查。现在,如果 scale 是 0 或其他数字,则所有时间都转到 (c:setsc)。我不想要这个。
有什么想法吗?
谢谢
您可以将user1与列表(100、200、250、500…)进行比较。如果=列表中的项,则跳过 也许是下午...
(DEFUN C:SETSC ()
(setvar "OSMODE" 13)
(princ (strcat "\nThe drawing scale is 1:" (itoa (getvar 'useri1))))
(setvar "useri1" (getint "\nSET New scale 1:"))
(princ)
)
(defun c:test ()
(if (zerop (getvar 'useri1))
(if (not (atoms-family 0 '("c:setsc")))
(alert "Unable to find 'c:setsc'. Aborting ... ")
;;else
(c:setsc)
)
)
;;(princ (strcat "\n The drawing scale is 1:" (itoa (getvar "useri1"))))
(alert (strcat "\n The drawing scale is 1:" (itoa (getvar "useri1"))))
(princ)
)
如果值为0,则调用c:SETSC(从c:TEST )
如果要强制进行更改,只需从命令行调用c:SETSC。
我假设您正在从另一个读取变量的例程中设置比例。问候 感谢您的帮助,非常感谢 请注意,这个 -
(if (not (atoms-family 0 '("c:setsc")))
永远不会被验证,因为即使找不到符号“c:setsc”(即未定义),原子族函数也将返回列表
(nil),
这是非空的。
虽然不是使用
car
来检查列表的第一个元素是否为非空值,但表达式可以更理想地写成:
(if (not c:setsc) 之前(代码8]
之前 我做了一些更改,但警报框不起作用。所有文本都显示在命令行
中 (if (zerop (getvar 'useri1))
(if (not (atoms-family 0 '("c:setsc")))
;(if (not c:setsc)
(alert "The drawing scale is not set !!!!")
;;else
(c:setsc)
) ; end if
(alert (strcat "\nThe drawing scale is 1:" (itoa (getvar "useri1"))))
) ; end if
还有其他想法吗?
谢谢 PM<br>正如Lee所提到的,交换这些语句:<br><pre> (if (not c:setsc)
代替
(if (not (atoms-family 0 '("c:setsc")))
页:
[1]
2