AutoCAD2006 .net开发之二-用鼠标从屏幕点和长度
1
using System ;
2
using Autodesk.AutoCAD.Runtime ;
3
using Autodesk.AutoCAD.ApplicationServices;
4
using Autodesk.AutoCAD.EditorInput;
5![](/Images/OutliningIndicators/None.gif)
6![](/Images/OutliningIndicators/None.gif)
7
[assembly: CommandClass(typeof(ClassLibrary.Class))]
8![](/Images/OutliningIndicators/None.gif)
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![](/Images/OutliningIndicators/InBlock.gif)
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![](/Images/OutliningIndicators/InBlock.gif)
40
}
41
}
42![](/Images/OutliningIndicators/InBlock.gif)
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![](/Images/OutliningIndicators/InBlock.gif)
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![](/Images/OutliningIndicators/InBlock.gif)
62
}
63
}
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
7
![](/Images/OutliningIndicators/None.gif)
8
![](/Images/OutliningIndicators/None.gif)
9
![](/Images/OutliningIndicators/None.gif)
10
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
11
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
12
![](/Images/OutliningIndicators/InBlock.gif)
13
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
14
![](/Images/OutliningIndicators/InBlock.gif)
15
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
16
![](/Images/OutliningIndicators/InBlock.gif)
17
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
18
![](/Images/OutliningIndicators/InBlock.gif)
19
![](/Images/OutliningIndicators/InBlock.gif)
20
![](/Images/OutliningIndicators/InBlock.gif)
21
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
22
![](/Images/OutliningIndicators/InBlock.gif)
23
![](/Images/OutliningIndicators/InBlock.gif)
24
![](/Images/OutliningIndicators/InBlock.gif)
25
![](/Images/OutliningIndicators/InBlock.gif)
26
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
27
![](/Images/OutliningIndicators/InBlock.gif)
28
![](/Images/OutliningIndicators/InBlock.gif)
29
![](/Images/OutliningIndicators/InBlock.gif)
30
![](/Images/OutliningIndicators/InBlock.gif)
31
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
32
![](/Images/OutliningIndicators/InBlock.gif)
33
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
34
![](/Images/OutliningIndicators/InBlock.gif)
35
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
36
![](/Images/OutliningIndicators/InBlock.gif)
37
![](/Images/OutliningIndicators/InBlock.gif)
38
![](/Images/OutliningIndicators/InBlock.gif)
39
![](/Images/OutliningIndicators/InBlock.gif)
40
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
41
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
42
![](/Images/OutliningIndicators/InBlock.gif)
43
![](/Images/OutliningIndicators/InBlock.gif)
44
![](/Images/OutliningIndicators/InBlock.gif)
45
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
46
![](/Images/OutliningIndicators/InBlock.gif)
47
![](/Images/OutliningIndicators/InBlock.gif)
48
![](/Images/OutliningIndicators/InBlock.gif)
49
![](/Images/OutliningIndicators/InBlock.gif)
50
![](/Images/OutliningIndicators/InBlock.gif)
51
![](/Images/OutliningIndicators/InBlock.gif)
52
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
53
![](/Images/OutliningIndicators/InBlock.gif)
54
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
55
![](/Images/OutliningIndicators/InBlock.gif)
56
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
57
![](/Images/OutliningIndicators/InBlock.gif)
58
![](/Images/OutliningIndicators/InBlock.gif)
59
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
60
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
61
![](/Images/OutliningIndicators/InBlock.gif)
62
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
63
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)