相信很多人以前在lisp中写过很多程序,那么如果要在.net中去调用写好的lisp程序怎么弄呢?

以下是一个简单的例子: 

using Autodesk.AutoCAD.Windows;
using Autodesk.AutoCAD.Runtime;
using System.Windows.Forms;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.ApplicationServices;
using System;
using System.Collections;
using app = Autodesk.AutoCAD.ApplicationServices.Application;
 
namespace test
{
        [CommandMethod("test")]
        public void test()
        {
            //设置标记并发送PLINE         
            Document curAcadDoc = app.DocumentManager.MdiActiveDocument;
            string lispPath = "d:/1.lsp";
            string loadStr = String.Format("(load \"{0}\")  tttt\n", lispPath);
            curAcadDoc.SendStringToExecute(loadStr, false, false, false);
        }
}

 

以下是lisp中的代码:

(defun c:tttt()

  (alert  "hello world")

)

 

相关文章:

  • 2021-12-12
  • 2022-02-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-27
  • 2023-03-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-29
  • 2021-09-12
  • 2021-07-10
  • 2021-06-15
相关资源
相似解决方案