CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2021 开发者帮助

关于使用颜色编码检测语法错误 (Visual LISP IDE)

2024-5-18 18:29| 发布者: admin| 查看: 11| 评论: 0|原作者: admin|来自: AutoCAD

关于使用颜色编码检测语法错误 (Visual LISP IDE)

AutoCAD Sample\VisualLISP 目录包含一个名为 drawline-with-errors.lsp 的文件。它类似于本手册前面介绍的 drawline.lsp 程序文件,但它包含一些错误。在 VLISP 中打开文件,以便查看文件中如何使用颜色:

(defun drawline(/ pt1 pt2) ; Local variables declared
   ;; get two points from the user
   (setq pt1 (getpoint "\nEnter the start point for the line: "))
   (setq pt2 (getpoint pt1 "\nEnter the end point for the line: "))
   ;; check to see that the two points exist
   (iff (and pt1 pt2)
        (command "_.line" pt1 pt2 "")
        (princ "\nInvalid or missing points!")
        (princ)      ;;  exit quietly
   )
)

如果使用标准 VLISP 语法颜色,则系统函数(如 、 、 、 和 )将以蓝色显示。VLISP 无法识别的项目(如用户定义的变量)以黑色打印。在此示例中,如果您查看程序中无法识别的元素,则 iff 一词可能很容易引起您的注意。将其更改为正确的拼写,如果,颜色会立即变为蓝色。setqdefungetdistgetpoint/


路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-6-27 16:00

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部