<?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: Select bock after insertion in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/select-bock-after-insertion/m-p/3248868#M58125</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in the case I need a sendcommand ... and I know it's executed when my current command ended I do the following:&lt;/P&gt;&lt;P&gt;The following is no code, just the structure!&lt;/P&gt;&lt;PRE&gt;private psr() as ObjectID   'dim the variable

Public sub myMainCommand
  psr = ed.SelectLast       'save your selectionset 
                            'BTW I don't know what "SelectLast" in your code is
  ... do anything
  call sendCommand("DIMREGEN" &amp;amp; vbnewline)
  ... do anything
  call sendCommand("DIMREGEN" &amp;amp; vbnewline)

  'now the steps you need to get this workaround working
  AddHandler for CommandEnded
  call sendCommand("myDummyEndCommand")
End sub

Public sub myDummyEndCommand
  ...this is just to be defined
End sub

EventHandler for CommandEnded:
   if CommandName = "myDummyEndCommand" then
      RemoveHandler for CommandEnded
      ...do the jobs like 
      ed.SetImpliedSelection(psr.Value)
   end if&lt;/PRE&gt;&lt;P&gt;So simplified described:&lt;/P&gt;&lt;P&gt;in your maincommand you place commands onto the comamnd-stack&lt;/P&gt;&lt;P&gt;when your main-command is finished the command-stack sends command by command (so your DIMREGENs or whatever else&lt;/P&gt;&lt;P&gt;and within your mainsub we have defined to run "myDummyEndCommand" as last command&lt;/P&gt;&lt;P&gt;and we have defined an eventhandler watching every single CommendEnded event&lt;/P&gt;&lt;P&gt;so if this handler now catches the command "myDummyEndCommand" the eventhandler knows that way your last command in the main-workflow and can now create a PickfirstSelectionSet/ImpliedSelection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTH, - alfred -&lt;/P&gt;</description>
    <pubDate>Sat, 03 Dec 2011 09:54:36 GMT</pubDate>
    <dc:creator>Alfred.NESWADBA</dc:creator>
    <dc:date>2011-12-03T09:54:36Z</dc:date>
    <item>
      <title>Select bock after insertion</title>
      <link>https://forums.autodesk.com/t5/net-forum/select-bock-after-insertion/m-p/3248574#M58122</link>
      <description>&lt;P&gt;I can't work this out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;According to the ADN the only way to insert a block and at the same time update constrained dimensions is to regen:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Application.DocumentManager.MdiActiveDocument.SendStringToExecute("DIMREGEN ", True, False, False)&lt;BR /&gt;Application.DocumentManager.MdiActiveDocument.SendStringToExecute("REGEN ", True, False, False)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After which I try to retain the selected the block&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;psr = ed.SelectLast&lt;BR /&gt;ed.SetImpliedSelection(psr.Value)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way I can force the command(stack) to operate consecutively? For some reason the block selection isn't retained.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2011 20:17:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/select-bock-after-insertion/m-p/3248574#M58122</guid>
      <dc:creator>SRSDS</dc:creator>
      <dc:date>2011-12-02T20:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: Select bock after insertion</title>
      <link>https://forums.autodesk.com/t5/net-forum/select-bock-after-insertion/m-p/3248622#M58123</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;don't use SendCommand if you can avoid it. And to do REGEN you can:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.Regen&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2011 20:49:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/select-bock-after-insertion/m-p/3248622#M58123</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2011-12-02T20:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: Select bock after insertion</title>
      <link>https://forums.autodesk.com/t5/net-forum/select-bock-after-insertion/m-p/3248866#M58124</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It seems that the advice the ADN gave is currently the only way unfortunately.&lt;/P&gt;&lt;P&gt;I've now thought to restricted the regen SendCommands&amp;nbsp;to only be used when to inserting a dimensioned block.&lt;/P&gt;&lt;P&gt;It will now be unnoticeable.&lt;/P&gt;&lt;P&gt;But I can replace the other&amp;nbsp;SendCommand regens I use with the one you suggested which helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Sat, 03 Dec 2011 09:05:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/select-bock-after-insertion/m-p/3248866#M58124</guid>
      <dc:creator>SRSDS</dc:creator>
      <dc:date>2011-12-03T09:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: Select bock after insertion</title>
      <link>https://forums.autodesk.com/t5/net-forum/select-bock-after-insertion/m-p/3248868#M58125</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in the case I need a sendcommand ... and I know it's executed when my current command ended I do the following:&lt;/P&gt;&lt;P&gt;The following is no code, just the structure!&lt;/P&gt;&lt;PRE&gt;private psr() as ObjectID   'dim the variable

Public sub myMainCommand
  psr = ed.SelectLast       'save your selectionset 
                            'BTW I don't know what "SelectLast" in your code is
  ... do anything
  call sendCommand("DIMREGEN" &amp;amp; vbnewline)
  ... do anything
  call sendCommand("DIMREGEN" &amp;amp; vbnewline)

  'now the steps you need to get this workaround working
  AddHandler for CommandEnded
  call sendCommand("myDummyEndCommand")
End sub

Public sub myDummyEndCommand
  ...this is just to be defined
End sub

EventHandler for CommandEnded:
   if CommandName = "myDummyEndCommand" then
      RemoveHandler for CommandEnded
      ...do the jobs like 
      ed.SetImpliedSelection(psr.Value)
   end if&lt;/PRE&gt;&lt;P&gt;So simplified described:&lt;/P&gt;&lt;P&gt;in your maincommand you place commands onto the comamnd-stack&lt;/P&gt;&lt;P&gt;when your main-command is finished the command-stack sends command by command (so your DIMREGENs or whatever else&lt;/P&gt;&lt;P&gt;and within your mainsub we have defined to run "myDummyEndCommand" as last command&lt;/P&gt;&lt;P&gt;and we have defined an eventhandler watching every single CommendEnded event&lt;/P&gt;&lt;P&gt;so if this handler now catches the command "myDummyEndCommand" the eventhandler knows that way your last command in the main-workflow and can now create a PickfirstSelectionSet/ImpliedSelection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTH, - alfred -&lt;/P&gt;</description>
      <pubDate>Sat, 03 Dec 2011 09:54:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/select-bock-after-insertion/m-p/3248868#M58125</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2011-12-03T09:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: Select bock after insertion</title>
      <link>https://forums.autodesk.com/t5/net-forum/select-bock-after-insertion/m-p/3249396#M58126</link>
      <description>&lt;P&gt;Thanks again!!&lt;/P&gt;</description>
      <pubDate>Sun, 04 Dec 2011 20:30:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/select-bock-after-insertion/m-p/3249396#M58126</guid>
      <dc:creator>SRSDS</dc:creator>
      <dc:date>2011-12-04T20:30:22Z</dc:date>
    </item>
  </channel>
</rss>

