<?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 receive selected object data from AutoCAD with mouse wheel enabled (PromptSelection / SendStringToExecute) in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-receive-selected-object-data-from-autocad-with-mouse/m-p/11279049#M12502</link>
    <description>&lt;P&gt;Thanks for the reply. I get the part where you stored the selected objects to _currentSelection.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I'm having trouble with the SendStringToCommand occurring after the TO DO part. I found this thread so trying to figure out how to implement it..&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/net/send-command-executes-after-exiting-command-method/td-p/3882929" target="_blank"&gt;https://forums.autodesk.com/t5/net/send-command-executes-after-exiting-command-method/td-p/3882929&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Haven't succeeded yet, but thanks for the advice on setting the variable outside the method!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Jul 2022 21:19:15 GMT</pubDate>
    <dc:creator>Soojung_Kim</dc:creator>
    <dc:date>2022-07-05T21:19:15Z</dc:date>
    <item>
      <title>How to receive selected object data from AutoCAD with mouse wheel enabled (PromptSelection / SendStringToExecute)</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-receive-selected-object-data-from-autocad-with-mouse/m-p/11264449#M12499</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi, I'm fairly new to writing an add-in with .NET for AutoCAD.&lt;/P&gt;&lt;P&gt;In this tool, I want to ask the user to select objects in the drawing and receive that object data back to my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know the PromptSelection method allows that, but when I use that, I can't use the mouse wheel to move or pan. I can only zoom in and out and select. Is there a way to 'unlock' the mouse wheel function?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// Request for objects to be selected in the drawing area
PromptSelectionOptions pso = new PromptSelectionOptions();
pso.MessageForAdding = "Select Pipes";                    
PromptSelectionResult acSSPrompt = ed.GetSelection(pso);

// Allows to bring back the selected objects, but mouse wheel doesn't work for pan, only works for zoom&lt;/LI-CODE&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;So I've tried SendStringToExecute method because that allows me to use the mouse wheel , but then I don't know how to get the selected data back to my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private void GetObject_Click(object sender, RoutedEventArgs e)
{
   try
   {
      _document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
      _document.SendStringToExecute("GETOBJECT ", false, false, true);
    }

    finally
    {
    }
            
}


[CommandMethod("GETOBJECT")]
public void GetObject()
{
   Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
   DocumentLock dl = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
   var ed = doc.Editor;
   using (Transaction ts = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
   {
      try
      {
        // Request for objects to be selected in the drawing area
        PromptSelectionOptions pso = new PromptSelectionOptions();
        pso.MessageForAdding = "Select Pipes";
        PromptSelectionResult acSSPrompt = ed.GetSelection(pso);
        // how do I use this data back in my code?

      }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please share some ideas?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2022 16:48:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-receive-selected-object-data-from-autocad-with-mouse/m-p/11264449#M12499</guid>
      <dc:creator>Soojung_Kim</dc:creator>
      <dc:date>2022-06-28T16:48:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to receive selected object data from AutoCAD with mouse wheel enabled (PromptSelection / SendStringToExecute)</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-receive-selected-object-data-from-autocad-with-mouse/m-p/11277549#M12500</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5332824"&gt;@Soojung_Kim&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;you can add list&amp;lt;Entity&amp;gt; of your selection, and use this code:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
ed.SetImpliedSelection(lstEnts.Select(ent =&amp;gt; ent.ObjectId).ToArray());&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 05 Jul 2022 11:10:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-receive-selected-object-data-from-autocad-with-mouse/m-p/11277549#M12500</guid>
      <dc:creator>quangpt.tric</dc:creator>
      <dc:date>2022-07-05T11:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to receive selected object data from AutoCAD with mouse wheel enabled (PromptSelection / SendStringToExecute)</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-receive-selected-object-data-from-autocad-with-mouse/m-p/11277814#M12501</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5332824"&gt;@Soojung_Kim&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public class SomeClass
    {
        ObjectId[] _currentSelection;

        private void GetObject_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                _document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
                _document.SendStringToExecute("GETOBJECT ", false, false, true);

                if (_currentSelection == null)
                    return;

                //// TO DO
                //using (var tr = _document.Database.TransactionManager.StartTransaction())
                //{
                //    foreach (var id in _currentSelection)
                //    {
                //        var obj = id.GetObject(OpenMode.ForWrite) as Line;


                //    }

                //    tr.Commit();
                //}
            }

            finally
            {
            }
        }
        [CommandMethod("GETOBJECT")]
        public void GetObject()
        {
            Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            DocumentLock dl = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
            var ed = doc.Editor;
            using (Transaction ts = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
            {
                
                // Request for objects to be selected in the drawing area
                PromptSelectionOptions pso = new PromptSelectionOptions();
                pso.MessageForAdding = "Select Pipes";
                PromptSelectionResult acSSPrompt = ed.GetSelection(pso);

                // how do I use this data back in my code?

                _currentSelection = null;
                if (acSSPrompt.Status != PromptStatus.OK) 
                    return;

                _currentSelection = acSSPrompt.Value.GetObjectIds();
            }
        }


    }&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 05 Jul 2022 13:14:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-receive-selected-object-data-from-autocad-with-mouse/m-p/11277814#M12501</guid>
      <dc:creator>essam-salah</dc:creator>
      <dc:date>2022-07-05T13:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to receive selected object data from AutoCAD with mouse wheel enabled (PromptSelection / SendStringToExecute)</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-receive-selected-object-data-from-autocad-with-mouse/m-p/11279049#M12502</link>
      <description>&lt;P&gt;Thanks for the reply. I get the part where you stored the selected objects to _currentSelection.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I'm having trouble with the SendStringToCommand occurring after the TO DO part. I found this thread so trying to figure out how to implement it..&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/net/send-command-executes-after-exiting-command-method/td-p/3882929" target="_blank"&gt;https://forums.autodesk.com/t5/net/send-command-executes-after-exiting-command-method/td-p/3882929&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Haven't succeeded yet, but thanks for the advice on setting the variable outside the method!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 21:19:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-receive-selected-object-data-from-autocad-with-mouse/m-p/11279049#M12502</guid>
      <dc:creator>Soojung_Kim</dc:creator>
      <dc:date>2022-07-05T21:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to receive selected object data from AutoCAD with mouse wheel enabled (PromptSelection / SendStringToExecute)</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-receive-selected-object-data-from-autocad-with-mouse/m-p/11279062#M12503</link>
      <description>Sorry, I don't understand what you mean. Do you mean save the promptSelection output to lstEnts in your example?</description>
      <pubDate>Tue, 05 Jul 2022 21:25:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-receive-selected-object-data-from-autocad-with-mouse/m-p/11279062#M12503</guid>
      <dc:creator>Soojung_Kim</dc:creator>
      <dc:date>2022-07-05T21:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to receive selected object data from AutoCAD with mouse wheel enabled (PromptSelection / SendStringToExecute)</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-receive-selected-object-data-from-autocad-with-mouse/m-p/11279101#M12504</link>
      <description>&lt;LI-CODE lang="general"&gt;Haven't succeeded yet, but thanks for the advice on setting the variable outside the method! &lt;/LI-CODE&gt;&lt;P&gt;you can make a new post with the specific problem part you have.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 21:47:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-receive-selected-object-data-from-autocad-with-mouse/m-p/11279101#M12504</guid>
      <dc:creator>essam-salah</dc:creator>
      <dc:date>2022-07-05T21:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to receive selected object data from AutoCAD with mouse wheel enabled (PromptSelection / SendStringToExecute)</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-receive-selected-object-data-from-autocad-with-mouse/m-p/11286455#M12505</link>
      <description>&lt;P&gt;Thanks, I just made a new post regarding the issue I'm having! &lt;A href="https://forums.autodesk.com/t5/net/question-re-send-command-executes-after-exiting-command-method/td-p/11286454" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/net/question-re-send-command-executes-after-exiting-command-method/td-p/11286454&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 20:37:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-receive-selected-object-data-from-autocad-with-mouse/m-p/11286455#M12505</guid>
      <dc:creator>Soojung_Kim</dc:creator>
      <dc:date>2022-07-08T20:37:55Z</dc:date>
    </item>
  </channel>
</rss>

