CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoLISP 开发指南

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

2023-1-6 05:42| 发布者: admin| 查看: 352| 评论: 0|来自: AutoCAD

AutoCADSample\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-5-19 12:24

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部