不,我正在为我的同事们创建一些应用程序,我使用的是acaddoc。lsp文件可以做某些事情。
有人告诉我,这不是使用阿卡多克的最佳方式。我自己的lsp文件,在这种情况下,我的同事阿卡多克。lsp将被否决。
这就是为什么。。。
现在我计算了这段代码,以检查是否有阿卡多克。在打开/运行AutoCAD会话中加载的lsp文件。如果是,那么我将添加一行来加载我自己的acaddoc。lsp。如果没有,那么我将创建一个,并把线也放进去。
-
- ; main routine
- (defun CheckForAcadDoc (/)
- (if
- (findfile "acaddoc.lsp")
- (AddLinesToAcadDoc) ; if there is an acaddoc.lsp file already
- (MakeAcadDoc) ; if there is not an acaddoc.lsp file
- )
- (princ)
- )
- (princ)
- ; sub routine
- ; in case there is an AcadDoc.lsp
- ; then it will ad the line (load "c:\\MyAcadDoc.lsp")
- (defun AddLinesToAcadDoc (/ AcadDocFile File Line) ;add a line to the acaddoc.lsp file to load Myacaddoc.lsp
- (setq AcadDocFile (findfile "acaddoc.lsp")
- Line "(load "c:\\\\MyAcadDoc.lsp")" ; set my path etc. correctly
- )
- (if
- (setq File (open AcadDocFile "a") ; a = append = add to the bottom
- )
- (write-line Line File)
- (alert "Could not find file allthough there should be one..!?")
- )
- (princ)
- )
- (princ)
- (defun MakeAcadDoc (/ Line MyFileName) ; create an acaddoc.lsp file
- (setq Line "(load "c:\\\\MyAcadDoc.lsp")") ; assuming that this would be a folder in the support file search path
- (if
- (setq MyFileName (open "c:\\acaddoc.lsp" "w")) ; the file is not htere so it will be created
- (write-line Line MyFileName)
- (alert "Could not find file allthough there should be one..!?")
- )
- (princ)
- )
- (princ)
请帮助我把这个代码做得更好,或者如果我把事情都搞错了,请纠正我。
困扰我的是,我不知道如何检索当前支持文件搜索路径之一(将新创建的acaddoc.lsp文件存储在中)。 |