<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: cursor pick object event in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/cursor-pick-object-event/m-p/3332109#M57308</link>
    <description>&lt;P&gt;Did you ever figure it out? I'd be curious to know how you did it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you mind posting some code?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Feb 2012 20:27:57 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-02-14T20:27:57Z</dc:date>
    <item>
      <title>cursor pick object event</title>
      <link>https://forums.autodesk.com/t5/net-forum/cursor-pick-object-event/m-p/3323659#M57306</link>
      <description>&lt;P&gt;i am trying to make a custom palette to display some custom infomation pulled out from selected objects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i can deal with the palette part.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want some code for when you click an object in model space then the property palette updates. i am gonna keep it simple so this custom palette only refresh to the last selected object. but i don't know how to make an event when mouse click the autocad object and then do my things. any codes in c# or vb.net would be nice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so use commandmethod load in a command and there will be a palette there stay open, when user click on an object then it will get populated. what event do i use for the clicking?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2012 18:35:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/cursor-pick-object-event/m-p/3323659#M57306</guid>
      <dc:creator>wang890</dc:creator>
      <dc:date>2012-02-08T18:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: cursor pick object event</title>
      <link>https://forums.autodesk.com/t5/net-forum/cursor-pick-object-event/m-p/3323675#M57307</link>
      <description>&lt;P&gt;I'm gonna take a guess here:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think it's a Doc Event&lt;/P&gt;&lt;P&gt;I used MdgDgbd.dll Tool to tinker with events that are fired when I click and object.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="Element710"&gt;&lt;DIV class="Element92"&gt;&lt;DIV class="Element5"&gt;&lt;STRONG&gt;Document.ImpliedSelectionChanged &lt;/STRONG&gt;Event&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="Element720"&gt;&lt;DIV class="Element721"&gt;&lt;DIV class="Element58"&gt;&lt;DIV&gt;&lt;DIV class="Element11"&gt;&lt;DIV class="Element10"&gt;&lt;P class="Element10"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="Element10"&gt;This notification is triggered when the pickfirst selection set has been modified; that is, for all events that add objects to or remove objects from the set. Events that change the geometry or properties of the objects within the selection set (stretching, moving, and so on) do not trigger this callback.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="Element14"&gt;Links&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 08 Feb 2012 18:46:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/cursor-pick-object-event/m-p/3323675#M57307</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-08T18:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: cursor pick object event</title>
      <link>https://forums.autodesk.com/t5/net-forum/cursor-pick-object-event/m-p/3332109#M57308</link>
      <description>&lt;P&gt;Did you ever figure it out? I'd be curious to know how you did it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you mind posting some code?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2012 20:27:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/cursor-pick-object-event/m-p/3332109#M57308</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-14T20:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: cursor pick object event</title>
      <link>https://forums.autodesk.com/t5/net-forum/cursor-pick-object-event/m-p/3333285#M57309</link>
      <description>&lt;P&gt;Hi Bob,&lt;/P&gt;
&lt;P&gt;Some initial testing shows that this can work, for the most part. Ran out of time to track down why the AddedObjects ObjectId&amp;nbsp;&lt;SPAN&gt;collection is still populated when the user hits ESC.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;///Sample code to trap adding an object to the PickFirstSelectionset.
///Works across multiple drawings. Not sure, yet, how to handle when the user clears
///the PickFirstSS by hitting ESC. Did not test for manual removal by SHIFT+Pick.
///Jeff Mishler, Feb 2012

using System.Linq;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;

namespace PaletteTest
{
    public class PaletteTest : IExtensionApplication
    {
        static PaletteTestPalette palette;
        static Document doc_palettetest;
        static Editor ed_palettetest;

        public void Initialize()
        {
            palette = new PaletteTestPalette();
            if (palette.Visible)
                palette.ToggleVisibility();
            doc_palettetest = Application.DocumentManager.MdiActiveDocument;
            ed_palettetest = doc_palettetest.Editor;
            ed_palettetest.SelectionAdded += new SelectionAddedEventHandler(ed_SelectionAdded);
        }

        static void DocumentManager_DocumentToBeDeactivated(object sender, DocumentCollectionEventArgs e)
        {
            ed_palettetest.SelectionAdded -= new SelectionAddedEventHandler(ed_SelectionAdded);
        }

        static void DocumentManager_DocumentActivated(object sender, DocumentCollectionEventArgs e)
        {
            doc_palettetest = Application.DocumentManager.MdiActiveDocument;
            ed_palettetest = doc_palettetest.Editor;
            ed_palettetest.SelectionAdded += new SelectionAddedEventHandler(ed_SelectionAdded);
        }

        public void Terminate()
        {
        }

        static void ed_SelectionAdded(object sender, SelectionAddedEventArgs e)
        {
            if (palette.Visible &amp;amp;&amp;amp; e.Flags == SelectionFlags.PickfirstSet)
            {
                
                ObjectId id = e.AddedObjects.GetObjectIds().Last();
                using (Transaction tr = doc_palettetest.Database.TransactionManager.StartTransaction())
                {
                    Entity ent = (Entity)tr.GetObject(id, OpenMode.ForRead);
                    palette.thiscontrol.TextValue = "You selected a: " + id.ObjectClass.DxfName;
                    tr.Commit();
                }
            }
        }
        [CommandMethod("PaletteTest", CommandFlags.Session)]
        public static void palettetestcommand()
        {
            Application.DocumentManager.DocumentActivated += new DocumentCollectionEventHandler(DocumentManager_DocumentActivated);
            Application.DocumentManager.DocumentToBeDeactivated += new DocumentCollectionEventHandler(DocumentManager_DocumentToBeDeactivated);
            palette.ToggleVisibility();
        }
    }
}
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2012 15:19:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/cursor-pick-object-event/m-p/3333285#M57309</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2012-02-15T15:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: cursor pick object event</title>
      <link>https://forums.autodesk.com/t5/net-forum/cursor-pick-object-event/m-p/3333737#M57310</link>
      <description>&lt;P&gt;thanks jeff&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i got it working now after finding out this pdf:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CP205-2_Mike_Tuersley.pdf&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;pretty good.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;keeping your code as a future reference.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2012 18:33:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/cursor-pick-object-event/m-p/3333737#M57310</guid>
      <dc:creator>wang890</dc:creator>
      <dc:date>2012-02-15T18:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: cursor pick object event</title>
      <link>https://forums.autodesk.com/t5/net-forum/cursor-pick-object-event/m-p/7805355#M57311</link>
      <description>&lt;P&gt;If possible can you share the code present inside&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PaletteTestPalette..&lt;/PRE&gt;</description>
      <pubDate>Sat, 24 Feb 2018 08:26:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/cursor-pick-object-event/m-p/7805355#M57311</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-24T08:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: cursor pick object event</title>
      <link>https://forums.autodesk.com/t5/net-forum/cursor-pick-object-event/m-p/7805383#M57312</link>
      <description>Hey&lt;BR /&gt;It's been a while. I don't think I ever created this program, got busy just doing work. I don't even remember posting this lol. Not so much programming for me now just using some of the programs I made for work all the time. This particular one I never really figure it out. Maybe someone else can post a full working sample.</description>
      <pubDate>Sat, 24 Feb 2018 08:56:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/cursor-pick-object-event/m-p/7805383#M57312</guid>
      <dc:creator>wang890</dc:creator>
      <dc:date>2018-02-24T08:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: cursor pick object event</title>
      <link>https://forums.autodesk.com/t5/net-forum/cursor-pick-object-event/m-p/7806399#M57313</link>
      <description>&lt;P&gt;@Anonymous, welcome to the forums!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is some sample code that was used for that. Note that it calls for a user control, all it is is a control with a Text box.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;using Autodesk.AutoCAD.Windows;

namespace PaletteTest
{
    public class PaletteTestPalette
    {
        static PaletteSet m_testpalette;
        public PaletteTestControl m_palettetestcontrol;
               
        public PaletteTestPalette()
        {
            m_palettetestcontrol = new PaletteTestControl();
        }

        public void Show()
        {
            if (m_testpalette == null)
            {
                m_testpalette = new PaletteSet("PaletteTest", new System.Guid("A6FAB3F0-BC82-4909-8CC7-686BE1110AF6"));
                m_testpalette.Style =
                  PaletteSetStyles.ShowAutoHideButton;
                m_testpalette.Add("Palette Test 1", m_palettetestcontrol);
                m_testpalette.Name = "PaletteTest";
                m_testpalette.StateChanged += new PaletteSetStateEventHandler(m_testpalette_StateChanged);
            }
            m_testpalette.Visible = true;            
        }

        void m_testpalette_StateChanged(object sender, PaletteSetStateEventArgs e)
        {
            m_testpalette.DockEnabled = DockSides.None;
            m_testpalette.Dock = DockSides.None;
            m_testpalette.MinimumSize = new System.Drawing.Size(500, 440);
            m_testpalette.Size = new System.Drawing.Size(560, 500);
            m_testpalette.Location = new System.Drawing.Point(500, 240);
            m_testpalette.Size = new System.Drawing.Size(500, 440);
            m_testpalette.StateChanged -= new PaletteSetStateEventHandler(m_testpalette_StateChanged);
        }

        public bool Visible
        {
            get { return (m_testpalette == null) ? false : m_testpalette.Visible; }
        }

        public void ToggleVisibility()
        {
            if (Visible)
                m_testpalette.Visible = false;
            else
                Show();
        }
        public void Close()
        {
            m_testpalette.Visible = false;
            m_testpalette.Dispose();
            m_testpalette = null;
        }
    }
}&lt;/PRE&gt;</description>
      <pubDate>Sun, 25 Feb 2018 00:50:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/cursor-pick-object-event/m-p/7806399#M57313</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2018-02-25T00:50:29Z</dc:date>
    </item>
  </channel>
</rss>

