AutoCAD2006 .net开发之二-用鼠标从屏幕点和长度

 1None.gifusing System ;
 2None.gifusing Autodesk.AutoCAD.Runtime ;
 3None.gifusing Autodesk.AutoCAD.ApplicationServices;
 4None.gifusing Autodesk.AutoCAD.EditorInput;
 5None.gif
 6None.gif
 7None.gif[assembly: CommandClass(typeof(ClassLibrary.Class))]
 8None.gif
 9None.gifnamespace ClassLibrary
10ExpandedBlockStart.gifContractedBlock.gifdot.gif{
11ExpandedSubBlockStart.gifContractedSubBlock.gif    /**//// <summary>
12InBlock.gif    /// Summary description for Class.
13ExpandedSubBlockEnd.gif    /// </summary>

14InBlock.gif    public class Class
15ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
16InBlock.gif        public Class()
17ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
18InBlock.gif            //
19InBlock.gif            // TODO: Add constructor logic here
20InBlock.gif            //
21ExpandedSubBlockEnd.gif        }

22InBlock.gif
23InBlock.gif        // Define Command "AsdkCmd1"
24InBlock.gif        [CommandMethod("AsdkCmd1")]
25InBlock.gif        static public void test() // This method can have any name
26ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
27InBlock.gif            PromptPointOptions ppo = new PromptPointOptions("Select a point:");
28InBlock.gif            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
29InBlock.gif            PromptPointResult ppr = ed.GetPoint(ppo);
30InBlock.gif            if(ppr.Status != PromptStatus.OK)
31ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
32InBlock.gif                ed.WriteMessage("error");
33ExpandedSubBlockEnd.gif            }

34InBlock.gif            else
35ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
36InBlock.gif                ed.WriteMessage(ppr.Value.ToString());
37InBlock.gif                ed.WriteMessage(ppr.Value.ToArray().ToString());
38InBlock.gif                ed.WriteMessage("X="+ppr.Value.X+"Y="+ppr.Value.Y+"Z="+ppr.Value.Z);
39InBlock.gif
40ExpandedSubBlockEnd.gif            }

41ExpandedSubBlockEnd.gif        }

42InBlock.gif
43InBlock.gif        [CommandMethod("AsdkCmd2")]
44InBlock.gif        static public void test2() // This method can have any name
45ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
46InBlock.gif            PromptDistanceOptions pdo = new PromptDistanceOptions("Find distance, select first point:");
47InBlock.gif
48InBlock.gif            
49InBlock.gif            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
50InBlock.gif            PromptDoubleResult pdr = ed.GetDistance(pdo);
51InBlock.gif            if(pdr.Status != PromptStatus.OK)
52ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
53InBlock.gif                ed.WriteMessage("error");
54ExpandedSubBlockEnd.gif            }

55InBlock.gif            else
56ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
57InBlock.gif                ed.WriteMessage("\n");
58InBlock.gif                ed.WriteMessage(pdr.Value.ToString());
59ExpandedSubBlockEnd.gif            }

60ExpandedSubBlockEnd.gif        }

61InBlock.gif
62ExpandedSubBlockEnd.gif    }

63ExpandedBlockEnd.gif}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值