<?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: How to create selection set with selected objects in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-create-selection-set-with-selected-objects/m-p/7244437#M30530</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're defining a command, just add the CommandFlags.UsePickSet to the CommandMethod attribute arguments:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        [CommandMethod("TEST", CommandFlags.UsePickSet)]
        public void Test()
        {
            var doc = AcAp.DocumentManager.MdiActiveDocument;
            var db = doc.Database;
            var ed = doc.Editor;
            PromptSelectionOptions pso = new PromptSelectionOptions();
            pso.MessageForAdding = "Select entities : ";
            PromptSelectionResult psr = ed.GetSelection(pso);
            if (psr.Status != PromptStatus.OK)
            {
                ed.WriteMessage("\nError in getting the selection");
                return;
            }
            SelectionSet selected = psr.Value;
            ed.WriteMessage("\nThe selection set contains {0} entities", selected.Count);
        }&lt;/PRE&gt;</description>
    <pubDate>Fri, 21 Jul 2017 10:32:50 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2017-07-21T10:32:50Z</dc:date>
    <item>
      <title>How to create selection set with selected objects</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-create-selection-set-with-selected-objects/m-p/7244215#M30529</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to create SelectionSet based on PromptSelection Result and Option (C#); After executing the command asking for object selection;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the user was already selected some objects its not works on the selected objects;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please guide on that situation ??? If the user already had selected any objects then not asking / prompt for selection ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;=================================================================&lt;/P&gt;&lt;PRE&gt;            Document doc = Application.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;
            string LayerName = "WINDOW";
            short LayColor = 6;
            PromptSelectionOptions pso = new PromptSelectionOptions();
            pso.MessageForAdding = "Select entities : ";
            PromptSelectionResult SelRes = ed.GetSelection(pso);
            if (SelRes.Status != PromptStatus.OK)
            {
                ed.WriteMessage("\nError in getting the selection");
                return;
            }
            SelectionSet selected = SelRes.Value;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;=========================================================&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and regards&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 08:49:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-create-selection-set-with-selected-objects/m-p/7244215#M30529</guid>
      <dc:creator>kite15</dc:creator>
      <dc:date>2017-07-21T08:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create selection set with selected objects</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-create-selection-set-with-selected-objects/m-p/7244437#M30530</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're defining a command, just add the CommandFlags.UsePickSet to the CommandMethod attribute arguments:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        [CommandMethod("TEST", CommandFlags.UsePickSet)]
        public void Test()
        {
            var doc = AcAp.DocumentManager.MdiActiveDocument;
            var db = doc.Database;
            var ed = doc.Editor;
            PromptSelectionOptions pso = new PromptSelectionOptions();
            pso.MessageForAdding = "Select entities : ";
            PromptSelectionResult psr = ed.GetSelection(pso);
            if (psr.Status != PromptStatus.OK)
            {
                ed.WriteMessage("\nError in getting the selection");
                return;
            }
            SelectionSet selected = psr.Value;
            ed.WriteMessage("\nThe selection set contains {0} entities", selected.Count);
        }&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Jul 2017 10:32:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-create-selection-set-with-selected-objects/m-p/7244437#M30530</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2017-07-21T10:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to create selection set with selected objects</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-create-selection-set-with-selected-objects/m-p/7257638#M30531</link>
      <description>&lt;P&gt;Thank you its works&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 07:53:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-create-selection-set-with-selected-objects/m-p/7257638#M30531</guid>
      <dc:creator>kite15</dc:creator>
      <dc:date>2017-07-27T07:53:55Z</dc:date>
    </item>
  </channel>
</rss>

