找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1031|回复: 8

[每日一码] 如何得到file-open对话框的缺省的目录名?

[复制链接]

已领礼包: 13个

财富等级: 恭喜发财

发表于 2016-9-10 13:05:00 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
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]

论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 2409个

财富等级: 金玉满堂

发表于 2016-9-21 11:11:24 | 显示全部楼层
学习!!!!!!!!!!!!!!!!!!!!!!!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复

使用道具 举报

已领礼包: 112个

财富等级: 日进斗金

发表于 2016-9-21 20:46:16 | 显示全部楼层
谢谢楼主分享
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 5060个

财富等级: 富甲天下

发表于 2017-4-24 20:49:29 | 显示全部楼层
fffffffffffffffffffffffffffffffffff
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 197个

财富等级: 日进斗金

发表于 2018-6-6 20:08:05 | 显示全部楼层
学习,学习!!!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复

使用道具 举报

已领礼包: 7个

财富等级: 恭喜发财

发表于 2020-2-8 19:28:03 | 显示全部楼层

谢谢楼主分享
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2020-4-25 16:43:18 | 显示全部楼层
谢谢楼主分享学习!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 69个

财富等级: 招财进宝

发表于 2020-5-28 22:38:06 | 显示全部楼层
谢谢楼主分享
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 10个

财富等级: 恭喜发财

发表于 2020-9-22 19:58:05 | 显示全部楼层
thank your document
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-5-29 16:19 , Processed in 0.390866 second(s), 43 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表