其他分享
首页 > 其他分享> > 使用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);
                        }
                    }
                }
            }

 

标签:PickPoint,ed,GetSelection,SelectionMethod,GetEntity,模仿,var,ssObj,opts
来源: https://www.cnblogs.com/rf8862/p/16181360.html