AutoCAD2006 .net 开发之一:命令行显示

本文展示了一个使用C#进行AutoCAD二次开发的例子,通过调用Autodesk AutoCAD的命名空间,实现了一个简单的命令方法,该方法能在AutoCAD中显示消息并获取点。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 1None.gifusing System;
 2None.gifusing Autodesk.AutoCAD.ApplicationServices;
 3None.gifusing Autodesk.AutoCAD.EditorInput;
 4None.gifusing Autodesk.AutoCAD.Runtime;
 5None.gifusing Autodesk.AutoCAD.DatabaseServices;
 6None.gifusing Autodesk.AutoCAD.Geometry;
 7None.gif
 8None.gifnamespace ClassLibrary2
 9ExpandedBlockStart.gifContractedBlock.gifdot.gif{
10ExpandedSubBlockStart.gifContractedSubBlock.gif    /**//// <summary>
11InBlock.gif    /// Class1 的摘要说明。
12ExpandedSubBlockEnd.gif    /// </summary>

13InBlock.gif    public class Class1
14ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
15InBlock.gif        [CommandMethod("HelloWorld")]
16InBlock.gif        public void HelloWorld()
17ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
18InBlock.gif            Editor editor = Application.DocumentManager.MdiActiveDocument.Editor;
19InBlock.gif            editor.WriteMessage("I love you");
20InBlock.gif            editor.GetPoint();
21ExpandedSubBlockEnd.gif        }
 
22InBlock.gif
23ExpandedSubBlockEnd.gif    }

24ExpandedBlockEnd.gif}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值