/// <summary>
        /// Serialize all selected objects and marks to the the macro feature data
        /// </summary>
        private void SaveSelections()
        {
            var t = ModelDoc.GetMacroFeatureDataSelectionInfo(Database);

            SwFeatureData.SetSelections2(ComWangling.ObjectArrayToDispatchWrapper(t.Item1), t.Item2, t.Item3);
            Debug.Assert(SwFeatureData.GetSelectionCount() == t.Item1.Length);
        }
示例#2
0
        public static void AddSelections(this IModelDoc2 doc, int mark, IEnumerable <object> objects)
        {
            var selectionMgr = (ISelectionMgr)doc.SelectionManager;
            var selectData   = selectionMgr.CreateSelectData();

            selectData.Mark = mark;

            var count = doc.Extension.MultiSelect2(ComWangling.ObjectArrayToDispatchWrapper(objects), true, selectData);
            //var count = selectionMgr.AddSelectionListObjects(ComWangling.ObjectArrayToDispatchWrapper(o.Objects), selectData);
        }
        public static void AddSelections(this IModelDoc2 doc, int mark, IReadOnlyCollection <object> objects)
        {
            var selectionMgr = (ISelectionMgr)doc.SelectionManager;
            var selectData   = selectionMgr.CreateSelectData();

            selectData.Mark = mark;

            var before = selectionMgr.GetAllSelectedObjects().Count;
            var after  = doc.Extension.MultiSelect2(ComWangling.ObjectArrayToDispatchWrapper(objects), true, selectData);
            //var after = selectionMgr.AddSelectionListObjects(ComWangling.ObjectArrayToDispatchWrapper(o.Objects), selectData);
            var selectionCount = after - before;

            Debug.Assert(selectionCount == objects.Count, $"Tried to select {objects.Count} objects, selected only {selectionCount}");
        }