1
using System ;
2
using Autodesk.AutoCAD.Runtime ;
3
using Autodesk.AutoCAD.ApplicationServices;
4
using Autodesk.AutoCAD.EditorInput;
5
6
7
[assembly: CommandClass(typeof(ClassLibrary.Class))]
8
9
namespace ClassLibrary
10
{
11
/// <summary>
12
/// Summary description for Class.
13
/// </summary>
14
public class Class
15
{
16
public Class()
17
{
18
//
19
// TODO: Add constructor logic here
20
//
21
}
22
23
// Define Command "AsdkCmd1"
24
[CommandMethod("AsdkCmd1")]
25
static public void test() // This method can have any name
26
{
27
PromptPointOptions ppo = new PromptPointOptions("Select a point:");
28
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
29
PromptPointResult ppr = ed.GetPoint(ppo);
30
if(ppr.Status != PromptStatus.OK)
31
{
32
ed.WriteMessage("error");
33
}
34
else
35
{
36
ed.WriteMessage(ppr.Value.ToString());
37
ed.WriteMessage(ppr.Value.ToArray().ToString());
38
ed.WriteMessage("X="+ppr.Value.X+"Y="+ppr.Value.Y+"Z="+ppr.Value.Z);
39
40
}
41
}
42
43
[CommandMethod("AsdkCmd2")]
44
static public void test2() // This method can have any name
45
{
46
PromptDistanceOptions pdo = new PromptDistanceOptions("Find distance, select first point:");
47
48
49
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
50
PromptDoubleResult pdr = ed.GetDistance(pdo);
51
if(pdr.Status != PromptStatus.OK)
52
{
53
ed.WriteMessage("error");
54
}
55
else
56
{
57
ed.WriteMessage("\n");
58
ed.WriteMessage(pdr.Value.ToString());
59
}
60
}
61
62
}
63
}

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

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63
