chelsea1307 发表于 2022-7-6 12:47:33

帮助修复lisp

在我开始工作之前,我的办公室就一直在使用下面的两个代码。他们过去表现很好,今天他们决定停下来。第一个错误是:
命令:sa
拾取插入点:
角度?:
; 错误:*error*函数内发生错误参数太多
; 错误:*error*函数内发生错误参数太多
未知命令“SA”。按F1键获取帮助。
对于第二个错误:
命令:4SA
NPICK点;错误:*error*函数内发生错误过多
论据
; 错误:*error*函数内发生错误参数太多
未知命令“SA”。按F1键获取帮助。
未知命令“@15,0”。按F1键获取帮助。
48
LISP命令不可用。
48
(是的,它们都已加载,我对此进行了双重和三重检查)
inserts air direction arrow (supply)
(defun c:sa ()
(setq ortho (getvar "orthomode"))
(setq scl (getvar "dimscale" ))
(setvar "orthomode" 1)
(setq pnt (getpoint "\nPick insertion point:" ))
(setq a (getangle "\nAngle?:" pnt ))(terpri)
(setq ang ( * a 57.3))
(command "layer" "set" "txt" "")
(command "insert" "sa" pnt scl scl ang)
)
 
inserts 4 way air direction arrows for diffuser
(defun c:4sa ()
(SETVAR "OSMODE" 64)
(SETQ INS (GETPOINT "\NPICK POINT"))
(COMMAND "ID" INS)
(setvar "clayer" "txt")
(setq scl (getvar "dimscale" ))
(command "insert" "sa" "@15,0" scl scl 0)
(COMMAND "ARRAY" "LAST" "" "POLAR" "@-15,0" "4" "" "" )
(SETVAR "OSMODE" 0)
)

The Buzzard 发表于 2022-7-6 13:03:55

chelsea1307,
 
请参阅下面的代码。
它正在寻找一个层调用txt。
我添加了一个图层命令,如果图层不在图形中,则生成该图层。
还要确保块调用sa位于acad搜索路径中。
如果图形中已经有这些图层,请跳过此操作。
 
除此之外,他们似乎工作。我没有得到你所指的错误。
 
这是可能的,因为程序中的变量未声明为局部变量,并且
可能与可能加载的另一个程序发生干扰。
只是一个猜测。
 
;inserts air direction arrow (supply)
(defun c:sa ()
(setq ortho (getvar "orthomode"))
(setq scl (getvar "dimscale" ))
(setvar "orthomode" 1)
(command "_-layer" "_make" "txt" "")    ;I added this line
(setq pnt (getpoint "\nPick insertion point:" ))
(setq a (getangle "\nAngle?:" pnt ))(terpri)
(setq ang ( * a 57.3))
(command "_-layer" "_set" "txt" "")
(command "_-insert" "sa" pnt scl scl ang) ;Make sure this block is in the acad path
)
 
 
 
;inserts 4 way air direction arrows for diffuser
(defun c:4sa ()
(SETVAR "OSMODE" 64)
(SETQ INS (GETPOINT "\nPICK POINT"))
(COMMAND "ID" INS)
(command "_-layer" "_make" "txt" "");I added this line
(setvar "clayer" "txt")
(setq scl (getvar "dimscale" ))
(command "_-insert" "sa" "@15,0" scl scl 0);Make sure this block is in the acad path
(COMMAND "_ARRAY" "LAST" "" "POLAR" "@-15,0" "4" "" "" )
(SETVAR "OSMODE" 0)
)

Lee Mac 发表于 2022-7-6 13:12:43

由于您似乎没有在函数中定义错误处理程序,*error*函数消息中的错误将由写得不好的*error*处理程序引起。
 
在命令行中键入此命令,然后尝试重新运行原始LISP:
 

(setq *error* nil)

chelsea1307 发表于 2022-7-6 13:23:59

谢谢buzzard我会试试你放的,
李,我应该把它加到Lisp程序的句子里吗?或者只是看看他们是否在那之后工作?

The Buzzard 发表于 2022-7-6 13:45:11

 
chelsea1307,
 
正如李所提到的,在命令提示符下运行它。它用于清除错误处理程序。然后在清除后再次运行程序。

Lee Mac 发表于 2022-7-6 13:48:59

 
^^^^^^
页: [1]
查看完整版本: 帮助修复lisp