<?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 How to keep selection ? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-keep-selection/m-p/4655115#M46739</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hallo to all!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code takes the selected entities and reads out all the text of the attributes.&lt;/P&gt;&lt;P&gt;If no blocks are selected, the code prompts for a selection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, by ending the transaction, the entitis are deselected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So how to keep the selection, because it will be handled in a follow-up step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for any suggestion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;below a shortened code for the procedure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;private void Get_Text()
{
  Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView(); 
  PromptSelectionResult sel = edt.SelectImplied();
  
  if (sel.Status == PromptStatus.Error)
  {
    TypedValue[] auswahl_typ = new TypedValue[] { new TypedValue((int)DxfCode.Start, "INSERT") };
    SelectionFilter auswahl_filtern = new SelectionFilter(auswahl_typ);
    PromptSelectionOptions pso = new PromptSelectionOptions();
    
    pso.MessageForAdding = "\nMake a selection";
    sel = edt.GetSelection(pso, auswahl_filtern);
    
    if (sel.Status != PromptStatus.OK)//
    {
      edt.WriteMessage("\nSelection failed");
      return;
    }//if
  }//if
//-------------------------------------------------------------------------------------
  try
  {
    using (Transaction tr = db.TransactionManager.StartTransaction()) 
    {
      using (DocumentLock dwg_lock = dwg.LockDocument())// Aktive Zeichnung wird wärend der Bearbeitung gesprerrt    
      {
		
		// Code for reading out the text form the choosen blocks
		
      }// using DocumentLock
    }// using Transaction
  }// try
  catch { edt.WriteMessage("\n#Error! Task failed"); }
}// void&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Nov 2013 09:50:14 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-11-27T09:50:14Z</dc:date>
    <item>
      <title>How to keep selection ?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-keep-selection/m-p/4655115#M46739</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hallo to all!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code takes the selected entities and reads out all the text of the attributes.&lt;/P&gt;&lt;P&gt;If no blocks are selected, the code prompts for a selection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, by ending the transaction, the entitis are deselected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So how to keep the selection, because it will be handled in a follow-up step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for any suggestion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;below a shortened code for the procedure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;private void Get_Text()
{
  Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView(); 
  PromptSelectionResult sel = edt.SelectImplied();
  
  if (sel.Status == PromptStatus.Error)
  {
    TypedValue[] auswahl_typ = new TypedValue[] { new TypedValue((int)DxfCode.Start, "INSERT") };
    SelectionFilter auswahl_filtern = new SelectionFilter(auswahl_typ);
    PromptSelectionOptions pso = new PromptSelectionOptions();
    
    pso.MessageForAdding = "\nMake a selection";
    sel = edt.GetSelection(pso, auswahl_filtern);
    
    if (sel.Status != PromptStatus.OK)//
    {
      edt.WriteMessage("\nSelection failed");
      return;
    }//if
  }//if
//-------------------------------------------------------------------------------------
  try
  {
    using (Transaction tr = db.TransactionManager.StartTransaction()) 
    {
      using (DocumentLock dwg_lock = dwg.LockDocument())// Aktive Zeichnung wird wärend der Bearbeitung gesprerrt    
      {
		
		// Code for reading out the text form the choosen blocks
		
      }// using DocumentLock
    }// using Transaction
  }// try
  catch { edt.WriteMessage("\n#Error! Task failed"); }
}// void&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2013 09:50:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-keep-selection/m-p/4655115#M46739</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-11-27T09:50:14Z</dc:date>
    </item>
    <item>
      <title>Re : How to keep selection ?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-keep-selection/m-p/4655173#M46740</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the Get_Text method, at the end of the code, add:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;edt.SetImpliedSelection(sel.Value);&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2013 10:26:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-keep-selection/m-p/4655173#M46740</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2013-11-27T10:26:56Z</dc:date>
    </item>
  </channel>
</rss>

