<?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: Get Properties Upon Selection in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6497495#M34971</link>
    <description>&lt;P&gt;If I update the code per the following using the ed.SelectImplied the code functions as it should for the first selection but the next selection never updates the textbox&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        void doc_ImpliedSelectionChanged(object sender, EventArgs e)
        {
            Document doc = AcAp.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;
            {
                Transaction tr = db.TransactionManager.StartTransaction();
                using (tr)
                {
                    PromptSelectionResult acPSR = ed.SelectImplied();
                    //PromptSelectionResult acPSR = ed.GetSelection();
                    if (acPSR.Value.Count == 1 &amp;amp;&amp;amp; acPSR.Status == PromptStatus.OK)
                    {
                        SelectionSet acSSet = acPSR.Value;
                        foreach (SelectedObject acSObj in acSSet)
                        {
                            Polyline pl = (Polyline)tr.GetObject(acSObj.ObjectId, OpenMode.ForRead);
                            if (pl != null)
                            {
                                //ed.WriteMessage(pl.Layer + "\n");
                                textBox1.Text = pl.Layer;
                            }
                        }
                    }
                    // Committing is cheaper than aborting
                    tr.Commit();
                }
            }
        }//void doc_ImpliedSelectionChanged&lt;/PRE&gt;</description>
    <pubDate>Fri, 12 Aug 2016 19:17:14 GMT</pubDate>
    <dc:creator>DirtyDanLand</dc:creator>
    <dc:date>2016-08-12T19:17:14Z</dc:date>
    <item>
      <title>Get Properties Upon Selection</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6497375#M34968</link>
      <description>&lt;P&gt;I have created my own tool palette. &amp;nbsp;When that tool palette is visible I want to populate it with information from selecting a pline.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have it somewhat working but not exactly the way that I would like it to..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently, I click on pline and I am prompted to select an object. I then select the pline and I have to hit enter in order for a text box on the palette to receive the layer of the pline.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I make it so I only have the select the pline just once for the info to show?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my current code located within the palette code...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        void doc_ImpliedSelectionChanged(object sender, EventArgs e)
        {
            Document doc = AcAp.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;
            {
                Transaction tr = db.TransactionManager.StartTransaction();
                using (tr)
                {
                    PromptSelectionResult acPSR = ed.GetSelection();
                    if (acPSR.Value.Count == 1 &amp;amp;&amp;amp; acPSR.Status == PromptStatus.OK)
                    {
                        SelectionSet acSSet = acPSR.Value;
                        foreach (SelectedObject acSObj in acSSet)
                        {
                            Polyline pl = (Polyline)tr.GetObject(acSObj.ObjectId, OpenMode.ForRead);
                            if (pl != null)
                            {
                                //ed.WriteMessage(pl.Layer + "\n");
                                textBox1.Text = pl.Layer;
                            }
                        }
                    }
                    // Committing is cheaper than aborting
                    tr.Commit();
                }
            }
        }//void doc_ImpliedSelectionChanged&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 18:18:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6497375#M34968</guid>
      <dc:creator>DirtyDanLand</dc:creator>
      <dc:date>2016-08-12T18:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Get Properties Upon Selection</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6497448#M34969</link>
      <description>&lt;P&gt;When the implied selection changes, instead of asking the user for a selection, just get the implied selection.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;editor.SelectImplied()&lt;/PRE&gt;
&lt;P&gt;This will give you all of the items in the current selection set. &amp;nbsp;Make sure you check for null because the event will fire if the user deselects everything. &amp;nbsp;The order of the items in the selection is the same as the order that the user selected them.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 18:49:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6497448#M34969</guid>
      <dc:creator>Keith.Brown</dc:creator>
      <dc:date>2016-08-12T18:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: Get Properties Upon Selection</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6497485#M34970</link>
      <description>&lt;P&gt;where in my code do I put&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;editor.SelectImplied()&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 19:07:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6497485#M34970</guid>
      <dc:creator>DirtyDanLand</dc:creator>
      <dc:date>2016-08-12T19:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: Get Properties Upon Selection</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6497495#M34971</link>
      <description>&lt;P&gt;If I update the code per the following using the ed.SelectImplied the code functions as it should for the first selection but the next selection never updates the textbox&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        void doc_ImpliedSelectionChanged(object sender, EventArgs e)
        {
            Document doc = AcAp.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;
            {
                Transaction tr = db.TransactionManager.StartTransaction();
                using (tr)
                {
                    PromptSelectionResult acPSR = ed.SelectImplied();
                    //PromptSelectionResult acPSR = ed.GetSelection();
                    if (acPSR.Value.Count == 1 &amp;amp;&amp;amp; acPSR.Status == PromptStatus.OK)
                    {
                        SelectionSet acSSet = acPSR.Value;
                        foreach (SelectedObject acSObj in acSSet)
                        {
                            Polyline pl = (Polyline)tr.GetObject(acSObj.ObjectId, OpenMode.ForRead);
                            if (pl != null)
                            {
                                //ed.WriteMessage(pl.Layer + "\n");
                                textBox1.Text = pl.Layer;
                            }
                        }
                    }
                    // Committing is cheaper than aborting
                    tr.Commit();
                }
            }
        }//void doc_ImpliedSelectionChanged&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Aug 2016 19:17:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6497495#M34971</guid>
      <dc:creator>DirtyDanLand</dc:creator>
      <dc:date>2016-08-12T19:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Get Properties Upon Selection</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6497588#M34972</link>
      <description>&lt;P&gt;You fail to mention if you have more than 1 item selected when you get the next selection.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Per your code, the selection set can only have 1 item in it. &amp;nbsp;You will need to decide what to do if you have multiple items. &amp;nbsp;If you remove the count = 1 restriction then the&amp;nbsp;way it is written now, it will cycle through each item and if it is a polyline then display the layer in a textbox. &amp;nbsp;If &amp;nbsp;there are multiple polylines then it will cycle through each of them so fast that you will only notice that the last item is written to the text box. &amp;nbsp;You should capture the layer of each polyline and if it is the same then display the layer. &amp;nbsp;If they are not the same then display something like "** Varies **". &amp;nbsp;That is a design decision that you will have to decide upon.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 20:01:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6497588#M34972</guid>
      <dc:creator>Keith.Brown</dc:creator>
      <dc:date>2016-08-12T20:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get Properties Upon Selection</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6497703#M34973</link>
      <description>&lt;P&gt;While Keith has offerred good suggestions, I can show some&amp;nbsp;code I recently used in a similar requirement in one of my programming projects. The requirement is to show the selected entities in current drawing (when user clicks entity to select/highlight, or Shift+click to unselect/unhighlight). The selection changes shows in a small floating form (modeless form).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I though it would be better to show a complete, run-able project, rather than partial code,&amp;nbsp;in my blog, so it would be much easier to read to code. Here is it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A title="Showing Current Selection in a Modeless Form" href="http://drive-cad-with-code.blogspot.ca/2016/08/showing-current-selection-in-modeless.html" target="_self"&gt;http://drive-cad-with-code.blogspot.ca/2016/08/showing-current-selection-in-modeless.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your need, you only need to apply some kind of filtering mechanism before sending the selected ObjectId array to the form to show.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 21:02:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6497703#M34973</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2016-08-12T21:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: Get Properties Upon Selection</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6500737#M34974</link>
      <description>&lt;P&gt;Thanks Keith and Norman for your input...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The intention is to only be able to select a single object.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a higher priority project that i was just given so I have to put this on hold, I will report back when I get a chance to try your suggestions...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2016 14:47:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6500737#M34974</guid>
      <dc:creator>DirtyDanLand</dc:creator>
      <dc:date>2016-08-15T14:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Get Properties Upon Selection</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6501446#M34975</link>
      <description>&lt;P&gt;Keith&lt;/P&gt;&lt;P&gt;I verified that I only have one object selected with my code above, the textbox does not get updated with the layer of the pline. &amp;nbsp;The problem is the code is not executing when I select a different object after clearing current selection. &amp;nbsp;Im looking into why it does that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Norman&lt;/P&gt;&lt;P&gt;Do you have an code examples using a dockable tool palette?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2016 19:37:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6501446#M34975</guid>
      <dc:creator>DirtyDanLand</dc:creator>
      <dc:date>2016-08-15T19:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Get Properties Upon Selection</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6502133#M34976</link>
      <description>&lt;P&gt;Well, again, in order to be able to present a relatively complete, run-able code, I just added extra code to the same post in my blog to show how to use a PaletteSet to show a selected single polyline information. You can easily modify the code to fit your need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://drive-cad-with-code.blogspot.ca/2016/08/showing-current-selection-in-modeless.html" target="_self"&gt;http://drive-cad-with-code.blogspot.ca/2016/08/showing-current-selection-in-modeless.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 04:50:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6502133#M34976</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2016-08-16T04:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Get Properties Upon Selection</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6502730#M34977</link>
      <description>Thank you Norman.... I will report back once I get a chance to play with this...</description>
      <pubDate>Tue, 16 Aug 2016 12:03:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6502730#M34977</guid>
      <dc:creator>DirtyDanLand</dc:creator>
      <dc:date>2016-08-16T12:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: Get Properties Upon Selection</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6503584#M34978</link>
      <description>&lt;P&gt;Thanks Norman... works wonderfully...&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 17:30:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6503584#M34978</guid>
      <dc:creator>DirtyDanLand</dc:creator>
      <dc:date>2016-08-16T17:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get Properties Upon Selection</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6506086#M34979</link>
      <description>&lt;P&gt;Norman, I have another question for you...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am changing the code that you created so the palette does not hide if a polyline is not selected. &amp;nbsp;The palette shows when the used enters a commmand to show it. &amp;nbsp;The used can select a desired polyline and information will be displayed on the palette. If the user selects some entity other than a polyline, no information is displayed on the palette and any info that was previously displayed is cleared.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I commented out&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;_ps.Visible = false;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so the palette does not disapear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I modified the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Style = PaletteSetStyles.UsePaletteNameAsTitleForSingle;&lt;/PRE&gt;&lt;P&gt;to this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;            Style = PaletteSetStyles.UsePaletteNameAsTitleForSingle |
                PaletteSetStyles.ShowPropertiesMenu |
                PaletteSetStyles.ShowAutoHideButton |
                PaletteSetStyles.ShowCloseButton;&lt;/PRE&gt;&lt;P&gt;so the close button and autohide button are shown but it does not seem to be working. Any ideas as to why???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 17:22:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6506086#M34979</guid>
      <dc:creator>DirtyDanLand</dc:creator>
      <dc:date>2016-08-17T17:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Get Properties Upon Selection</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6506210#M34980</link>
      <description>&lt;P&gt;My guess is that by default, AutoCAD remembers PaletteSet style/position running in previous session. Since AutoCAD identify PaletteSet by its GUID id, you can use VS to generate a new GUID to replace the one currently in the PaleteSet's constructor, so that when you run the PaletteSet next time, AutoCAD will treat this PaletteSet as entirely new one, and its style/size/location... will then be honored by AutoCAD.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 18:02:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6506210#M34980</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2016-08-17T18:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Get Properties Upon Selection</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6506232#M34981</link>
      <description>&lt;P&gt;that did it...&lt;BR /&gt;&lt;BR /&gt;I could have sworn that I tried that yesterday...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks again&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 18:09:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-upon-selection/m-p/6506232#M34981</guid>
      <dc:creator>DirtyDanLand</dc:creator>
      <dc:date>2016-08-17T18:09:31Z</dc:date>
    </item>
  </channel>
</rss>

