chelsea1307 发表于 2022-7-6 14:15:30

这有什么问题吗

我试图写一个lsp,它是这样开始的,当我运行它时,我的命令行说
命令:321
加载。
选择对象/:;错误:无函数定义:类型
我很困惑为什么它要求一个对象而不是一个变量,而不显示我的问题?
(defun C:321 (/ type)
(setq type(getvar "\n Type of wall - X L T: "))

PS_Port 发表于 2022-7-6 14:19:02

切尔西,
 
尝试
 
“getvar”寻找系统变量,有时与“setvar”一起用于设置系统变量。

chelsea1307 发表于 2022-7-6 14:23:38

谢谢,我会试试的

chelsea1307 发表于 2022-7-6 14:27:13

好的,我修复了这一部分,这是我到目前为止所做的(是的,我正在尝试将3个LISP合并为一个LISP的解决方案,是的,我看到他们有一个解决方案,但我已经开始了,所以现在我想完成),所以它通过了正确的选择(感谢getstring),然后它要求为窗口选择的第一个角,然后它说
选择对象/:;错误:错误函数:“x”
知道为什么吗?wall-x lsp很好用,我试了一下
(defun C:321 (/ type)
(setq type(getstring "\n Type of wall - X L T: "))
(cond
(= type x (c:wall-x))
(= type l (c:wall-l))
(= type t (c:wall-t))
)
(princ))
flowerrobot向我展示了这个,我认为添加它会很好,因为它可以确保加载所需的文件,但我不知道放在哪里
(if (findfile "Somesortalfile.lsp)
(load (findfile "somesortafile.lsp))
(progn
(alert "\nCan Not find you file, adjust your search paths")
(exit)
)
)
任何帮助都将不胜感激

BlackAlnet 发表于 2022-7-6 14:30:30

您可以将所有lisp放在同一个文档中,并将lisp作为命令调用。
 

(cond
(= type x (command "lispoftypex"))
(= type l (command "lispoftypel"))
(= type t (command "lispoftypet"))
)
(princ)

The Buzzard 发表于 2022-7-6 14:34:37

不确定选择对象/:;错误:函数错误:“x”的东西,因为这部分代码没有发布。
 
无论如何,试试这个:
 
(defun C:321 (/ type)
(initget "X L T")
(setq type (getstring "\n Type of wall - < X > < L > < T >: "))
(cond
   ((= type "X")(WALL-X))
   ((= type "L")(WALL-L))
   ((= type "T")(WALL-T))
)
(princ)
)
(defun WALL-X ()
(ALERT "You chose WALL-X")
)
(defun WALL-L ()
(ALERT "You chose WALL-L")
)
(defun WALL-T ()
(ALERT "You chose WALL-T")
)

VisDak 发表于 2022-7-6 14:35:25

朋友们,我也在努力解决问题,我的眼睛湿透了,但继续努力
 
切尔西感谢延期,

The Buzzard 发表于 2022-7-6 14:38:34

您也可以这样做:
 
(defun C:321 (/ type)
(initget "X L T")
(setq type (getstring "\n Type of wall - < X > < L > < T >: "))
(cond
   ((= type "X")(C:WALL-X))
   ((= type "L")(C:WALL-L))
   ((= type "T")(C:WALL-T))
)
(princ)
)
(defun C:WALL-X ()
(ALERT "You chose WALL-X")
)
(defun C:WALL-L ()
(ALERT "You chose WALL-L")
)
(defun C:WALL-T ()
(ALERT "You chose WALL-T")
)

chelsea1307 发表于 2022-7-6 14:42:03

下面的链接有wall-x wall-l和wall-t,我可以单独运行它们,但从我的lsp调用时会出错
http://www.cadtutor.net/forum/showthread.php?t=38088

chelsea1307 发表于 2022-7-6 14:45:59

initget的目的是什么?
页: [1] 2
查看完整版本: 这有什么问题吗