- UID
- 5043
- 积分
- 1347
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-5-13
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
How to get the default directory name in file-open dialog?
Question
Where is the variable stored for the default directory name that the File-Open
dialog uses, and can it be accessed? This is so that a user can open a drawing
from a directory that is not valid for my application.
Answer
You can get the information about the current drawing in the editor by using
these two system variables: DWGNAME and DWGPREFIX. DWGNAME contains the drawing
name, including the .DWG extension. DWGPREFIX contains the path where the
drawing resides. Combining these system variables gives the full name of the
current drawing.
Note that DWGPREFIX does not always contain the directory that the File-Open
dialog defaults to. Instead, it defaults to the path of the last opened drawing,
even if that drawing has been closed. Note that there is an exception to this:
AutoCAD will not change the default File-Open directory if a file is opened from
the history list. AutoCAD writes this information to Windows registry table
under the following KEY when quitting and reads it as its history file list when
starting.
"HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\R15.0\\ACAD-1:409\\Recent File
List"
[it618postdisplay>0]
When AutoCAD is running, it does not update this information in the registry
table; therefore, it is not a practical way to retrieve this information using
the following VLISP expression.
(vl-registry-read
"HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\R15.0\\ACAD-1:409\\Recent File
List" "File1")
It also does not work to set the latest opened file's path to what you want
because AutoCAD maintains this information in memory, therefore, the information
has not been exposed to a system variable or an API.
Fortunately, you can use the following simple AutoLISP expression to
the
AutoCAD OPEN command or you can write your own version of the OPEN command.
(getfiled "Select File" "c:/program files/acad2000" "dwg" 8)
[/it618postdisplay]
|
|