在 CAD 创建图形对象时,经常需要和用户进行交互,例如:直线创建时需要用户输入起点和终点(或长度)信息,复制对象时需要指定源对象等。
我的开发环境为Visual Studio 2017 & AutoCAD 2014 & AutoCAD 2020。
方式一
PromptPointResult retStPoint = ed.GetPoint(("请输入点"));
方式二
PromptPointOptions ppo = new PromptPointOptions("请输入点");
PromptPointResult retStPoint = ed.GetPoint(ppo);

类 库
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.DatabaseServices;
代码
[CommandMethod("PointCreated")]
public void ComputePointCreate()
{
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.
DocumentManager.MdiActiveDocument.Editor;
PromptPointResult retStPoint = ed.GetPoint(("获得起点坐标"));
if (retStPoint.Status != PromptStatus.OK)
return;
DBPoint pt = new
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删