public static IEnumerable <ObjectSelection> GetObjectSelections(this ISelectionMgr selMgr)
        {
            var count = selMgr.GetSelectedObjectCount2(AnyMark);

            selMgr.EnableContourSelection = true;
            return(Enumerable.Range(StartIndex, count)
                   .Select(index =>
            {
                var type = (swSelectType_e)selMgr.GetSelectedObjectType3(index, AnyMark);
                var mark = selMgr.GetSelectedObjectMark(index);
                var obj = selMgr.GetSelectedObject6(index, AnyMark);
                //var typeList = ComWangling.GetComTypeFor<Surface>(obj).ToList();

                //LogViewer.Log($"Type of selection is {string.Join(", ", typeList)}");

                //if (type==swSelectType_e.swSelREFEDGES || type == swSelectType_e.swSelEDGES)
                //{
                //    var edge = obj.DirectCast<IEdge>();
                //}else if (type == swSelectType_e.swSelHELIX)
                //{
                //    var foo = obj.DirectCast<IFeature>();
                //}

                return new ObjectSelection(obj, type, mark, index);
            }));
        }
        /// <summary>
        /// 获取选中对象
        /// </summary>
        /// <param name="selMgr"></param>
        /// <returns></returns>
        public static IEnumerable <ObjectSelection> GetObjectSelections(this ISelectionMgr selMgr)
        {
            var count = selMgr.GetSelectedObjectCount();

            for (int i = 1; i < count + 1; i++)
            {
                int            selMark        = selMgr.GetSelectedObjectMark(i);
                swSelectType_e swSelectType_E = (swSelectType_e)selMgr.GetSelectedObjectType3(i, AnyMark);
                object         obj            = selMgr.GetSelectedObject6(i, AnyMark);
                yield return(new ObjectSelection(obj, swSelectType_E, selMark, i, ref selMgr));
            }
        }
Exemple #3
0
        public static IEnumerable <ObjectSelection> GetObjectSelections(this ISelectionMgr selMgr)
        {
            var count = selMgr.GetSelectedObjectCount2(AnyMark);

            return(Enumerable.Range(StartIndex, count)
                   .Select(index =>
            {
                var type = (swSelectType_e)selMgr.GetSelectedObjectType3(index, AnyMark);
                var mark = selMgr.GetSelectedObjectMark(index);
                var obj = selMgr.GetSelectedObject6(index, AnyMark);
                return new ObjectSelection(obj, type, mark, index);
            }));
        }
        /// <summary>
        /// 获取所有的选择对象
        /// </summary>
        /// <param name="selMgr"></param>
        /// <param name="Mark"></param>
        /// <returns></returns>
        public static List <ObjectSelection> GetAllSelectedObjectsEx(this ISelectionMgr selMgr)
        {
            var count = selMgr.GetSelectedObjectCount();
            List <ObjectSelection> objList = new List <ObjectSelection>();

            for (int i = 1; i < count + 1; i++)
            {
                int            selMark        = selMgr.GetSelectedObjectMark(i);
                swSelectType_e swSelectType_E = (swSelectType_e)selMgr.GetSelectedObjectType3(i, AnyMark);
                object         obj            = selMgr.GetSelectedObject6(i, AnyMark);
                objList.Add(new ObjectSelection(obj, swSelectType_E, selMark, i));
            }
            return(objList);
        }