C# autcad二次开发小技巧,学习记录

 

1.    C# 范围缩放到实体对象.

            Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute("zoom o ", true, false, false);

O 为对象.

 

2.    怎么刷新当前屏幕.(C#)

            Autodesk.AutoCAD.ApplicationServices.Application.UpdateScreen()

 另外有一个Editer. UpdateScreen() 和. Editer.region()

3.    选择当前选择集:

        [CommandMethod("test2", CommandFlags.UsePickSet)]

// 需要在定义命令时.加上CommandFlags.UsePickSet.

            PromptSelectionResult sr = ed.SelectImplied();

            if (sr.Status == PromptStatus.OK)

                return new ObjectIdCollection(sr.Value.GetObjectIds());

            else

                return null;

        }

4. 判断一个点是否在直线上。

       Point3d p = line.GetClosestPointTo(pt, false);

            if (p == pt)

            {

                Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("点在直线上");

            }

posted @ 2012-11-19 21:48  游天居士  阅读(612)  评论(0编辑  收藏  举报