明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1059|回复: 2

大家帮个忙

[复制链接]
发表于 2007-5-27 08:32 | 显示全部楼层 |阅读模式

我是新人!刚学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”

谁能帮忙说说明下是为什么

发表于 2007-5-27 10:32 | 显示全部楼层

(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))

 楼主| 发表于 2007-5-27 21:39 | 显示全部楼层
xiexie
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|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.

快速回复 返回顶部 返回列表