<?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: Adding objects to the PICKFIRST set. in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/adding-objects-to-the-pickfirst-set/m-p/3523734#M54791</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you are right, I do not need to use highlight. Nice one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You're code works, unless I do the following:&lt;/P&gt;&lt;P&gt;- Draw a rectangle.&lt;/P&gt;&lt;P&gt;- Move the cursor onto a toolbar (outside the drawing area).&lt;/P&gt;&lt;P&gt;- Active your command by typing the command name.&lt;/P&gt;&lt;P&gt;- Select the entity by typing "last" (so I don't have to move the cursor).&lt;/P&gt;&lt;P&gt;- Pressing the DELETE key: entity doesn't get delete.&lt;/P&gt;&lt;P&gt;- As soon as I move the mouse back into the drawing area, the DELETE key works again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eventhough AutoCAD still has the focus, if the cursor is outside the drawing area, DELETE key doesn't erase. Same as with my code.&lt;/P&gt;&lt;P&gt;Didn't notice it until now. Not sure if this is an AutoCAD problem, but maybe more of a windows-topic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Mon, 02 Jul 2012 17:35:44 GMT</pubDate>
    <dc:creator>Ertqwa</dc:creator>
    <dc:date>2012-07-02T17:35:44Z</dc:date>
    <item>
      <title>Adding objects to the PICKFIRST set.</title>
      <link>https://forums.autodesk.com/t5/net-forum/adding-objects-to-the-pickfirst-set/m-p/3522662#M54788</link>
      <description>&lt;P&gt;Hello Forum,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I add an entity to the PICKFIRST selection set as follows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Editor.SetImpliedSelection(new ObjectId[] { oiTarget });
entTarget.Highlight(); // Entity.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After this, I can type the CAD command "erase", and the selected entity is erased. However, if I press the DELETE key the entity is &lt;STRONG&gt;not&lt;/STRONG&gt; erased (nothing happens). Why is that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I select something on screen with my cursor, the DELETE will erase it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for you time.&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jul 2012 10:34:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/adding-objects-to-the-pickfirst-set/m-p/3522662#M54788</guid>
      <dc:creator>Ertqwa</dc:creator>
      <dc:date>2012-07-01T10:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: Adding objects to the PICKFIRST set.</title>
      <link>https://forums.autodesk.com/t5/net-forum/adding-objects-to-the-pickfirst-set/m-p/3522738#M54789</link>
      <description>&lt;P&gt;I tried the following command in both AutoCAD 2012 and 2013 and I had no problem with either ERASE or the DEL key. I didn't need to call Entity.Highlight() for the entities to be highlighted either. Has it got to do with some other part of your code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[CommandMethod("MyCommand")]
static public void MyCommand()
{
	Document doc = Application.DocumentManager.MdiActiveDocument;
	Editor ed = doc.Editor;

	PromptEntityResult per = ed.GetEntity("\nSelect entity: ");
	if (per.Status != PromptStatus.OK) return;

	ObjectId id = per.ObjectId;

	ed.SetImpliedSelection(new ObjectId[] { id });
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Art&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jul 2012 15:57:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/adding-objects-to-the-pickfirst-set/m-p/3522738#M54789</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-01T15:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: Adding objects to the PICKFIRST set.</title>
      <link>https://forums.autodesk.com/t5/net-forum/adding-objects-to-the-pickfirst-set/m-p/3522998#M54790</link>
      <description>&lt;P&gt;You need to define your command method with the CommandFlags.Redraw flag in order to set the pickfirst selection.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2012 03:47:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/adding-objects-to-the-pickfirst-set/m-p/3522998#M54790</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2012-07-02T03:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Adding objects to the PICKFIRST set.</title>
      <link>https://forums.autodesk.com/t5/net-forum/adding-objects-to-the-pickfirst-set/m-p/3523734#M54791</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you are right, I do not need to use highlight. Nice one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You're code works, unless I do the following:&lt;/P&gt;&lt;P&gt;- Draw a rectangle.&lt;/P&gt;&lt;P&gt;- Move the cursor onto a toolbar (outside the drawing area).&lt;/P&gt;&lt;P&gt;- Active your command by typing the command name.&lt;/P&gt;&lt;P&gt;- Select the entity by typing "last" (so I don't have to move the cursor).&lt;/P&gt;&lt;P&gt;- Pressing the DELETE key: entity doesn't get delete.&lt;/P&gt;&lt;P&gt;- As soon as I move the mouse back into the drawing area, the DELETE key works again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eventhough AutoCAD still has the focus, if the cursor is outside the drawing area, DELETE key doesn't erase. Same as with my code.&lt;/P&gt;&lt;P&gt;Didn't notice it until now. Not sure if this is an AutoCAD problem, but maybe more of a windows-topic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2012 17:35:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/adding-objects-to-the-pickfirst-set/m-p/3523734#M54791</guid>
      <dc:creator>Ertqwa</dc:creator>
      <dc:date>2012-07-02T17:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Adding objects to the PICKFIRST set.</title>
      <link>https://forums.autodesk.com/t5/net-forum/adding-objects-to-the-pickfirst-set/m-p/3523752#M54792</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Redraw:&lt;/P&gt;&lt;DIV class="Element267"&gt;&lt;EM&gt;When the pickfirst set or grip set are retrieved, they are not cleared within AutoCAD.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Command can retrieve the pickfirst set and the grip set by using the &lt;SPAN&gt;ads_ssgetfirst&lt;/SPAN&gt; function.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Command can retrieve the pickfirst set via &lt;SPAN&gt;ads_ssget("I.")&lt;/SPAN&gt;.&lt;/EM&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;Command can set both the pickfirst and grip sets using the &lt;SPAN&gt;ads_sssetfirst&lt;/SPAN&gt; function. Objects in these sets are redrawn with the proper grip handles and highlighting upon completion of the command.&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV class="Element267"&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV class="Element267"&gt;Seems like I should use it, but without it the command works exactly the same. It doesn't solve the problem.&lt;/DIV&gt;&lt;DIV class="Element267"&gt;Thank you for your response.&lt;/DIV&gt;&lt;DIV class="Element267"&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 02 Jul 2012 17:51:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/adding-objects-to-the-pickfirst-set/m-p/3523752#M54792</guid>
      <dc:creator>Ertqwa</dc:creator>
      <dc:date>2012-07-02T17:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: Adding objects to the PICKFIRST set.</title>
      <link>https://forums.autodesk.com/t5/net-forum/adding-objects-to-the-pickfirst-set/m-p/3525078#M54793</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/894966"&gt;@Ertqwa&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;Eventhough AutoCAD still has the focus, if the cursor is outside the drawing area, DELETE key doesn't erase. Same as with my code.&lt;/P&gt;
&lt;P&gt;Didn't notice it until now. Not sure if this is an AutoCAD problem, but maybe more of a windows-topic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Base AutoCAD commands act exactly the same way.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Draw an object,&lt;/P&gt;
&lt;P&gt;Move cursor to the ribbon/toolbar area,&lt;/P&gt;
&lt;P&gt;Type in SELECT,&lt;/P&gt;
&lt;P&gt;Last, the object you drew is selected,&lt;/P&gt;
&lt;P&gt;Enter,&lt;/P&gt;
&lt;P&gt;Press delete key, nothing will happen.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason is, I believe, due to the need to track what the mouse is doing outside of the drawing canvas, so the drawing no longer has focus.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2012 14:56:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/adding-objects-to-the-pickfirst-set/m-p/3525078#M54793</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2012-07-03T14:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: Adding objects to the PICKFIRST set.</title>
      <link>https://forums.autodesk.com/t5/net-forum/adding-objects-to-the-pickfirst-set/m-p/6456975#M54794</link>
      <description>&lt;P&gt;Have you tried to pass back the focus to graphics window just before exiting your command? Entities should remain selected and DEL key should work.&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;[DllImport("user32.dll")]
private static extern System.IntPtr SetFocus(System.IntPtr hwnd);

public static void ActivateEditor()
{
    SetFocus(Autodesk.AutoCAD.ApplicationServices.Application.MainWindow.Handle);
}&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Jul 2016 07:09:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/adding-objects-to-the-pickfirst-set/m-p/6456975#M54794</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-07-25T07:09:38Z</dc:date>
    </item>
  </channel>
</rss>

