Commandobill 发表于 2022-7-6 00:26:08

 
哈哈哈

alanjt 发表于 2022-7-6 00:31:38

未经测试,但这应该有效:
(defun c:TEST (/)
(or c:SPL2PL (load "SPL2PL"))
(vla-sendcommand
   (vla-get-activedocument
   (vlax-get-acad-object)
   ) ;_ vla-get-activedocument
   "SPL2PL all0.1 "
) ;_ vla-sendcommand
(princ)
) ;_ defun

Commandobill 发表于 2022-7-6 00:33:25

很好的解决方案,艾伦!

Rooster 发表于 2022-7-6 00:36:28

我仍然在努力让我的LISP调用并运行其他LISP。下面是一个简单的LISP,有人在这里帮助我-它只是按风格过滤文本。当我尝试从另一个LISP调用这个LISP时,我得到了一个“未知命令”错误。我该怎么做??!!啊!
 
;FILTER TEXT BY STYLE
(defun c:fts(/ cSet)

(setq cSet(ssget
            '((0 . "TEXT,MTEXT")(7 . "Standard"))
            ); end ssget
); end setq

(if cSet
   (progn
   (princ(strcat "\n" (itoa(sslength cSet)) " found."))
   (sssetfirst nil cSet)
   ); end progn
    (princ "\nNothing found. ")
   ); end if
(princ)
); end of c:fts

Commandobill 发表于 2022-7-6 00:38:56

这个函数所做的就是调用另一个函数并向其发送选择集。试试看。确保将“c:\\fts.lsp”更改为lisp的正确位置和文件名
 
(defun c:run ()
(load "c:\\fts.lsp" "Load Failed");change to have the name and location of the lisp
(sssetfirst nil (ssget))
(c:fts)
)

Lee Mac 发表于 2022-7-6 00:43:58

像这样的?
 

(defun c:fts(/ cSet)
(if (setq cSet (ssget '((0 . "*TEXT") (7 . "Standard"))))
   (progn
   (princ (strcat "\n" (rtos (sslength cSet) 2 0) " found."))
   (sssetfirst nil cSet))
   (princ "\n<< Nothing found >>"))
(princ))

(defun c:test ()
(c:fts)
(princ))

 
 
编辑:以秒数击败我。。。

Commandobill 发表于 2022-7-6 00:47:36

 
哇!字面上

Lee Mac 发表于 2022-7-6 00:48:49

 
但我也重复了他原来的Lisp程序

Rooster 发表于 2022-7-6 00:51:44

 
所以使用这种方法就像在lisp中创建一个子函数,对吗?我已经拥有的fts lisp已经自动加载到每个新图形中。如果我自己使用它(即不是通过另一个lisp),我只会在命令行中键入“fts”,然后退出。在另一个lisp中使用它时,我可以不做类似的事情吗?我还有很多其他小的简单lisp,比如fts,我也想在这个lisp中使用,所以如果我能帮助的话,我真的不需要几十个子函数。无论如何,我仍然无法使上面的代码正常工作-同样的旧错误:未知命令。。。。。

Lee Mac 发表于 2022-7-6 00:55:06

fts仍然是独立的,可以单独调用,“测试”LISP只是将其称为:
 

(c:fts)

 
这一切对我来说都很好,它说的是哪个命令是未知的?
页: 1 [2]
查看完整版本: LISP调用另一个LISP