-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDocumentTools.cs
More file actions
38 lines (36 loc) · 1.21 KB
/
Copy pathDocumentTools.cs
File metadata and controls
38 lines (36 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
namespace DotNetARX
{
/// <summary>
/// 文档操作类
/// </summary>
public static class DocumentTools
{
/// <summary>
/// 确定文档中是否有未保存的修改。
/// </summary>
/// <param name="doc">文档对象</param>
/// <returns>如果有未保存的修改,则返回true,否则返回false。</returns>
public static bool Saved(this Document doc)
{
//获取DBMOD系统变量,它用来指示图形的修改状态
object dbmod=Application.GetSystemVariable("DBMOD");
//若DBMOD不为0,则表示图形已被修改但还未被保存
if (Convert.ToInt16(dbmod) != 0) return true;
else return false;//图形没有未保存的修改
}
/// <summary>
/// 保存已有文档
/// </summary>
/// <param name="doc">文档对象</param>
public static void Save(this Document doc)
{
doc.Database.SaveAs(doc.Name, DwgVersion.Current);
}
}
}