C/C++教程

使用GetSelection模仿GetEntity

本文主要是介绍使用GetSelection模仿GetEntity,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
var ed = Application.DocumentManager.MdiActiveDocument.Editor;
            var opts = new PromptSelectionOptions();
            opts.AllowSubSelections = true;
            opts.SingleOnly = true;
            opts.SelectEverythingInAperture = true;
            var psr = ed.GetSelection(opts);
            if (psr.Status == PromptStatus.OK)
            {
                var ssObj = psr.Value[0];
                if (ssObj.SelectionMethod == SelectionMethod.PickPoint)
                {
                    ed.WriteMessage("\nPick point: " + ((PickPointSelectedObject)ssObj).PickPoint.PointOnLine);
                }
                if (ssObj.SelectionMethod == SelectionMethod.SubEntity)
                {
                    foreach (SelectedSubObject subEnt in ssObj.GetSubentities())
                    {
                        if (subEnt.SelectionMethod == SelectionMethod.PickPoint)
                        {
                            ed.WriteMessage("\nSub entity pick point: " + ((PickPointSelectedSubObject)subEnt).PickPoint.PointOnLine);
                        }
                    }
                }
            }

 

这篇关于使用GetSelection模仿GetEntity的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!