- 打开当前目录
思路:
通过dwgprefix
参数获取到当前图纸的目录,然后调用System.Diagnostics.Process
打开。
[CommandMethod(nameof(OpenCurrentPath))]
public void OpenCurrentPath()
{
string filePath = (string)Env.GetVar("dwgprefix"); ;//当前文件路径
if (filePath.Length > 0 && Directory.Exists(filePath))
{
System.Diagnostics.Process.Start(filePath);
Env.Editor.WriteMessage("{0}目录已打开", filePath);
}
else
{
Env.Editor.WriteMessage("{0}目录不存在", filePath);
}
}
- 打开临时文件目录
思路:
通过TEMPPREFIX
参数获取到当前图纸的目录,然后调用System.Diagnostics.Process
打开。
[CommandMethod(nameof(OpenTempPath))]
public void xOpenTempPath()
{
string filePath = (string)Env.GetVar("TEMPPREFIX"); ;//临时文件路径
if (filePath.Length > 0 && Directory.Exists(filePath))
{
System.Diagnostics.Process.Start(filePath);
Env.Editor.WriteMessage("\n临时目录已打开", filePath);
}
else
{
Env.Editor.WriteMessage("\n临时目录不存在", filePath);
}
}