明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1007|回复: 7

[提问] 菜鸟求助:总是显示no function definition: <ID

[复制链接]
发表于 2018-5-4 22:30:29 | 显示全部楼层 |阅读模式
加载后,输入dbx后,总是显示no function definition: <ID。实在不知道哪错了。用的全是英文括号
(defun c:dbx()
(setq id (load_dialog "d:/cad_1/zdbx"))
(if (<id 0) (exit))
(if (not(new_dialog "zdbx" id)) (exit))
(action_tile "nq" "(setq fg 1)")
(action_tile "wq" "(setq fg 0)")
(action_tile "accept" "(qsj) (done_dialog)")
(action_tile "cancel" "(setq what -1) (done_dialog)")
(start_dialog)
(unload_dialog id)
(if (>what 0) (draw_zdbx n r flag))
)
(defun draw_zdbx(n r flag)
(setq bp (getpoint "\nbase point"))
(command "circle" bp r)
(command "polygon" n bp flag r)
)
(defun qsj()
(setq n (atoi (get_tile "number")))
(setq r (atof (get_tile "rad")))
(if (=fg 1) (setq flag "i") (setq flag "c"))
(setq what 1)
)

发表于 2018-5-4 22:39:38 | 显示全部楼层
(if (<id 0) (exit))
==>
(if (< id 0) (exit))
 楼主| 发表于 2018-5-4 22:45:10 | 显示全部楼层
太感谢了!!这是为什么呢?我以前遇到过类似的一个情况:(setq n (+1 n)不对,必须写成(setq n (1+ n)才对。另外if (>what 0)怎么就不用修改呢?谢谢
发表于 2018-5-4 23:01:39 | 显示全部楼层
并未验证其余...
函数与变量间得以空白隔开
1+ 是一函数

(=fg 1)  ==> (= fg 1)
语法有错调试时过不了滴
 楼主| 发表于 2018-5-4 23:13:14 | 显示全部楼层
谢谢!太感激了!
发表于 2018-5-5 09:24:39 | 显示全部楼层
函数于变量或者字符一定不要连在一起了, 连在一起后就会变成 函数或者变量,肯定会出错的
发表于 2018-5-7 09:38:52 | 显示全部楼层
学习了,高手啊
发表于 2018-8-17 21:40:22 | 显示全部楼层
LMJPJP 发表于 2018-5-4 22:45
太感谢了!!这是为什么呢?我以前遇到过类似的一个情况:(setq n (+1 n)不对,必须写成(setq n (1+ n)才对 ...

+ 号是一个函数   1+ (注意1和+号中间没有空格)也是一个函数
你所谓的“(setq n (+1 n)不对” 肯定是+和1之间没有空格,
函数与参数之间是要有空格的,而没有空格的话它就认为你这是一个函数
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-19 07:14 , Processed in 0.167931 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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