-
Notifications
You must be signed in to change notification settings - Fork 1
/
Commands.cs
44 lines (39 loc) · 1.47 KB
/
Commands.cs
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
39
40
41
42
43
44
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using System;
namespace PropertyTable
{
public class Commands:IExtensionApplication
{
static PropertyViewerPalette pallete;
public void Initialize()
{
Application.DocumentManager.DocumentActivated +=new DocumentCollectionEventHandler(appDocumentActivated);
Application.SystemVariableChanged += new Autodesk.AutoCAD.ApplicationServices.SystemVariableChangedEventHandler(appSysVarChanged);
}
public void appSysVarChanged(object senderObj, Autodesk.AutoCAD.ApplicationServices.SystemVariableChangedEventArgs sysVarChEvtArgs)
{
if (sysVarChEvtArgs.Name == "UCSNAME" || sysVarChEvtArgs.Name == "LUPREC" || sysVarChEvtArgs.Name == "LUNITS")
pallete.Update();
}
void appDocumentActivated(object sender, DocumentCollectionEventArgs e)
{
if(pallete != null)
pallete.InitDataList();
}
public void Terminate()
{
Application.DocumentManager.DocumentActivated -= new DocumentCollectionEventHandler(appDocumentActivated);
Application.SystemVariableChanged -= new Autodesk.AutoCAD.ApplicationServices.SystemVariableChangedEventHandler(appSysVarChanged);
}
[CommandMethod("pt", CommandFlags.Session)]
public void PropertyTable()
{
if(pallete == null)
pallete = new PropertyViewerPalette();
pallete.Show();
}
}
}