.NET

Reply
Valued Contributor
cdinten
Posts: 61
Registered: ‎11-19-2010
Message 1 of 3 (157 Views)
Accepted Solution

Select an Entity Event?

157 Views, 2 Replies
04-16-2014 06:30 AM
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!

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));
}
}

 

Valued Mentor
Ajilal.Vijayan
Posts: 446
Registered: ‎01-12-2008
Message 2 of 3 (146 Views)

Re: Select an Entity Event?

04-16-2014 07:21 AM in reply to: cdinten

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));


            }

        }

 

Valued Contributor
cdinten
Posts: 61
Registered: ‎11-19-2010
Message 3 of 3 (115 Views)

Re: Select an Entity Event?

04-17-2014 12:23 AM in reply to: Ajilal.Vijayan
ok, thanks Ajilal, i will look into the Editor's evnets and i can solve it~
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.