Beispiel #1
0
        public void Update()
        {
            Document doc = _drawing.Document as Document;

            if (doc.Selections.Count == 0)
            {
                _gripPnts.Clear();
                return;
            }

            Dictionary <ObjectId, List <GripPoint> > oldGripPnts = _gripPnts;

            _gripPnts = new Dictionary <ObjectId, List <GripPoint> >();
            foreach (Selection sel in doc.Selections)
            {
                if (sel.objectId == ObjectId.Null)
                {
                    continue;
                }
                if (oldGripPnts.ContainsKey(sel.objectId))
                {
                    _gripPnts[sel.objectId] = oldGripPnts[sel.objectId];
                    continue;
                }

                DBObject dbobj = doc.Database.GetObject(sel.objectId);
                if (dbobj == null)
                {
                    continue;
                }
                Entity entity = dbobj as Entity;
                if (entity == null)
                {
                    continue;
                }

                List <GripPoint> entGripPnts = entity.GetGripPoints();
                if (entGripPnts != null && entGripPnts.Count > 0)
                {
                    _gripPnts[sel.objectId] = entGripPnts;
                }
            }

            _drawing.ResetGrips();
        }