乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 99|回复: 5

[编程交流] Lisp新手:格式错误的参数

[复制链接]

2

主题

5

帖子

3

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 05:25:03 | 显示全部楼层 |阅读模式
你好
我正在完成我在Afralisp的第一个教程,我不断得到错误错误的论点。我知道我做错了什么,但我想不出来。我甚至粘贴了代码以确保没有拼写错误。我将lisp文件保存在搜索路径的support文件夹中,但当我尝试(加载“testline”)时,它不起作用。我哪里出错了?
 
  1. (defun testline ()
  2.    ;define the function
  3.    (setq a (getpoint "\nEnter First Point : "))
  4.    ;get the first point     (setq b (getpoint "\nEnter Second Point : "))    ;get the second point
  5.    (command "Line" a b "")
  6.    ;draw the line
  7. )    ;end defun
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-6 05:40:32 | 显示全部楼层
这样试试。。。
 
  1. (defun c:testline (/ a b)
  2.                                        ;define the function
  3. (if (and (setq a (getpoint "\nEnter First Point : "))
  4.                                        ;get the first point
  5.           (setq b (getpoint "\nEnter Second Point : "))
  6.                                        ;get the second point
  7.      )
  8.    (command "_.Line" "_none" a "_none" b "")
  9.                                        ;draw the line
  10. )                                     ;end defun
  11. )
回复

使用道具 举报

4

主题

2143

帖子

2197

银币

限制会员

铜币
-24
发表于 2022-7-6 06:01:04 | 显示全部楼层
请阅读代码发布指南并编辑您的帖子,将代码包含在代码标签中。
回复

使用道具 举报

0

主题

99

帖子

99

银币

初来乍到

Rank: 1

铜币
0
发表于 2022-7-6 06:02:40 | 显示全部楼层
 
  1. (defun[color="red"] C:[/color]testline (/ a b) [color="#2e8b57"];; add C: to execute the command testline [/color]
  2. [color="#2e8b57"];; (/ a b) localize your variables[/color]
  3. ;define the function
  4. (setq a (getpoint "\nEnter First Point : "))
  5. ;get the first point [color="#2e8b57"]; everything after the semi colon will be treated as a comment and will not be evaluated[/color]
  6. [color="#2e8b57"];; move (setq b on the next line[/color]
  7. (setq b (getpoint "\nEnter Second Point : "))        ;get the second point
  8. (command "_.Line" "_none" a "_none" b "")
  9. [color="#2e8b57"];; underscore means to use the english equivalent of the command
  10. ;; use . or period just in case the command in use has been undefined
  11. ;; _none is a transparent command setting the snapmode to 0. If you didn't use _none or _non. If variable point a or b is close to an object either or both will snap to that object.
  12. [/color]
  13. ;draw the line
  14. [color="red"](princ)[/color] [color="#2e8b57"];; exit quietly [/color]
  15. )        ;end defun
回复

使用道具 举报

2

主题

5

帖子

3

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 06:18:19 | 显示全部楼层
谢谢大家
我找到了丢失的括号:震惊:
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-6 06:33:54 | 显示全部楼层
........
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-10 18:26 , Processed in 0.459880 second(s), 64 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表