【MSCE C#】如何获取模型中参考的元素,并添加到显示集?

如题,我使用下面代码取到了参考中的元素,但是SelectionSetManager.AddElement 添加元素之后在模型中没有高亮显示,显示集设置也无用。

            DgnFile dgnfile = Session.Instance.GetActiveDgnFile();
            DgnModel dgnmodel = Session.Instance.GetActiveDgnModel();
            DgnAttachmentCollection attachcol = dgnmodel.GetDgnAttachments();
            foreach (DgnAttachment myattach in attachcol)
            {
                DgnModel newmodel = myattach.GetDgnModel();
                ModelElementsCollection collection = newmodel.GetGraphicElements();
                IEnumerator<Element> iter = collection.GetEnumerator();
                while (iter.MoveNext())
                {
                    Element ele1 = iter.Current;
                    SelectionSetManager.AddElement(ele1, ele1.DgnModelRef);
                }
            }

Parents Reply Children