winerfjy 发表于 2015-11-1 11:17:32

打开当前文件目录 的其他文件

本帖最后由 winerfjy 于 2015-11-24 09:37 编辑

(defun c:mmll (/ Filename OriginalList PathFilename WinSortList)
(princ "\n选择要打开的文件:")(princ)
(if (not *LastFolder)
    (setq *LastFolder (getvar "DWGPREFIX"))
);if
(if (setq PathFilename (getfiled " 选择要打开的文件" *LastFolder "dwg" 2))
    (setq *LastFolder (strcat (vl-filename-directory PathFilename) "\\"))
    (exit)
);if
(textscr)
(princ (strcat "\n" *LastFolder))
(setq OriginalList (vl-directory-files *LastFolder "*.dwg" 1))
(princ (strcat "\n" (chr 160) "\n文件列表:"))
(foreach Filename OriginalList
    (princ "\n")(princ Filename)
);foreach
(setq WinSortList (win_sort (vl-directory-files *LastFolder "*.dwg" 1)))
(princ (strcat "\n" (chr 160) "\nWin_Sort list:"))
(foreach Filename WinSortList
    (princ "\n")(princ Filename)
);foreach
(princ)
)
这个打开当前文件目录的程序打开了当前目录的文件列表但不能打开指定的文件有高手诊断一下修改一下吗

菜卷鱼 发表于 2015-11-2 11:34:34

打开当前文件所在文件夹
(defun c:fg ()
(startapp "explorer"
(getvar "DwgPrefix") )(prin1))

winerfjy 发表于 2015-11-1 11:37:05

本帖最后由 winerfjy 于 2015-11-1 12:16 编辑

已经解决
(defun c:mmll(/ Filename OriginalList PathFilename WinSortList)
(princ "\n选择要打开的文件:")(princ)
(if (not *LastFolder)
    (setq *LastFolder (getvar "DWGPREFIX"))
);if
(if (setq PathFilename (getfiled " 选择要打开的文件" *LastFolder "dwg" 2))
    (setq *LastFolder (strcat (vl-filename-directory PathFilename) "\\"))
    (exit)
);if
(textscr)
(princ (strcat "\n" *LastFolder))
(setq OriginalList (vl-directory-files *LastFolder "*.dwg" 1))
(princ (strcat "\n" (chr 160) "\n文件列表:"))
(foreach Filename OriginalList
    (princ "\n")(princ Filename)
    (command "_ai_editcustfile" (findfile PathFilename))
)
(princ)
)

yshf 发表于 2015-11-1 15:44:55

改为如下试试:(defun c:mmll(/ Filename OriginalList PathFilename WinSortList)
(princ "\n选择要打开的文件:")(princ)
(if (not *LastFolder)
    (setq *LastFolder (getvar "DWGPREFIX"))
);if
(if (setq PathFilename (getfiled " 选择要打开的文件" *LastFolder "dwg" 2))
    (setq *LastFolder (strcat (vl-filename-directory PathFilename) "\\"))
    (exit)
);if
(textscr)
(princ (strcat "\n" *LastFolder))
(setq OriginalList (vl-directory-files *LastFolder "*.dwg" 1))
(princ (strcat "\n" (chr 160) "\n文件列表:"))
(foreach Filename OriginalList
    (princ "\n")(princ Filename)
    (command "_ai_editcustfile" (strcat *LastFolder Filename))
)
(princ)
)

winerfjy 发表于 2015-11-1 16:04:54

yshf 发表于 2015-11-1 15:44 static/image/common/back.gif
改为如下试试:

你的是打开目录内全部文件的

llsheng_73 发表于 2015-11-2 11:42:20

没搞清楚楼主到底想做什么,但是在打开一个文件的情况下,简单的打开另一个文件,lisp程序将无法再继续。。。虽然也有办法解决,但那涉及到多文档操作。。。一般的办法根本行不通

zhangrunze 发表于 2024-4-28 10:28:16

yshf 发表于 2015-11-1 15:44
改为如下试试:

奇怪了~
显示Error: 输入的字符串有缺陷
页: [1]
查看完整版本: 打开当前文件目录 的其他文件