Select an Entity Event?

Select an Entity Event?

Anonymous
Not applicable
1,002 Views
2 Replies
Message 1 of 3

Select an Entity Event?

Anonymous
Not applicable
when i open a dwg file, and the i can use mouse to click one graphical object, like a line, a circle, an arc and so forth. so my question is, what event is raised when i just click an object, and how can i moniter it? Can anyone post some code for me? That would be of great helpful, thanks!
0 Likes
Accepted solutions (1)
1,003 Views
2 Replies
Replies (2)
Message 2 of 3

Ajilal.Vijayan
Advisor
Advisor
Accepted solution

Like this ?

The below code I copied from here

Preventing AutoCAD objects from being selected

 

 void OnSelectionAdded(object sender, SelectionAddedEventArgs e)
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;

            ObjectId[] addedIds = e.AddedObjects.GetObjectIds();

            for (int i = 0; i < addedIds.Length; i++)
            {

                ObjectId oid = addedIds[i];

                ed.WriteMessage("Selected Item : " +(oid.ObjectClass.DxfName));


            }

        }

 

Message 3 of 3

Anonymous
Not applicable
ok, thanks Ajilal, i will look into the Editor's evnets and i can solve it~
0 Likes