只需一步,快速开始
我是新人!刚学visual lisp想写一很简单的程序
(defun getdata() (setq x (atof(get_tile "X"))) (setq y (atof(get_tile "Y"))) (setq z1 (+ x y)) (setq z (itoa z1)) (set_tile "Z" z) )(defun c:add (/ x y z z1 id sdt ) (setq sdt 0) (setq id(load_dialog "C:/Documents and Settings/LuckyStar/我的文档/add.DCL")) (if (< id 0)(exit)) (setq x 0 y 0) (if (not (new_dialog "add" id ))(exit)) (set_tile "X" "") (set_tile "Y" "") (set_tile "Z" "") (action_tile "accept" "(getdata)") (action_tile "cancel" "(done_dialog -1)") (setq sdt (start_dialog)) (unload_dialog id) )只要按确定键时能自动计算X+Y=Z,并在Z的窗口显示,可是老是说“参数类型错误: fixnump”
谁能帮忙说说明下是为什么
使用道具 举报
(defun getdata() (setq x (atof(get_tile "X"))) (setq y (atof(get_tile "Y"))) (setq z1 (+ x y)) (setq z (itoa z1))
z1为整数时,才能使用 itoa ,
改为:
(setq z1 (+ x y)) (setq z (itoa (fix z1)))
或改为:
(setq z1 (+ x y)) (setq z (rtos z1 2 2))
本版积分规则 发表回复 回帖后跳转到最后一页
小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 ) ©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途
GMT+8, 2024-5-6 03:35 , Processed in 0.189737 second(s), 25 queries , Gzip On.
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.