<?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 : Invoke command in loop by ResultBuffer with Autocad 2015 in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/invoke-command-in-loop-by-resultbuffer-with-autocad-2015/m-p/5549865#M40913</link>
    <description>&lt;P&gt;You can try this way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[CommandMethod("offpl")]
public void cmdOffset()
{
    Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
    ed.Command("_.offset");
    while (true)
    {
        try { ed.Command(@"\"); }
        catch { break; }
    }
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Mar 2015 09:32:46 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2015-03-20T09:32:46Z</dc:date>
    <item>
      <title>Invoke command in loop by ResultBuffer with Autocad 2015</title>
      <link>https://forums.autodesk.com/t5/net-forum/invoke-command-in-loop-by-resultbuffer-with-autocad-2015/m-p/5549412#M40910</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this code: (from here:&amp;nbsp;&lt;A href="http://www.acadnetwork.com/index.php?topic=292.0" target="_self"&gt;http://www.acadnetwork.com/index.php?topic=292.0&lt;/A&gt;&amp;nbsp;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;   // Replace "accore.dll" by "acad.exe" for AutoCAD versions prior to 2013
        [System.Security.SuppressUnmanagedCodeSecurity]
        [System.Runtime.InteropServices.DllImport("accore.dll", EntryPoint = "acedCmd", CharSet = System.Runtime.InteropServices.CharSet.Unicode, CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl)]
        extern static private int acedCmd(IntPtr resbuf);
        [CommandMethod("offpl")]

        public void cmdOffset()
        {

            ResultBuffer rb = new ResultBuffer();

            // RTSTR = 5005

            rb.Add(new TypedValue(5005, "_.OFFSET"));

            // start the insert command

            acedCmd(rb.UnmanagedObject);



            bool quit = false;

            // loop round while the insert command is active

            while (!quit)
            {

                // see what commands are active

                string cmdNames = (string)Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("CMDNAMES");

                // if the INSERT command is active

                if (cmdNames.ToUpper().IndexOf("OFFSET") &amp;gt;= 0)
                {

                    // then send a PAUSE to the command line

                    rb = new ResultBuffer();

                    // RTSTR = 5005 - send a user pause to the command line

                    rb.Add(new TypedValue(5005, "\\"));

                    acedCmd(rb.UnmanagedObject);

                }

                else

                    // otherwise quit

                    quit = true;

            }

        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;In AC 2007 it works fine. I've changed acad.exe to accore.dll, but nothing happens.&lt;/P&gt;&lt;P&gt;I'm not getting even "Unknown command".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Mar 2015 22:01:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/invoke-command-in-loop-by-resultbuffer-with-autocad-2015/m-p/5549412#M40910</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-19T22:01:00Z</dc:date>
    </item>
    <item>
      <title>Re : Invoke command in loop by ResultBuffer with Autocad 2015</title>
      <link>https://forums.autodesk.com/t5/net-forum/invoke-command-in-loop-by-resultbuffer-with-autocad-2015/m-p/5549504#M40911</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No more need to P/Invoke acedCmd with AutoCAD 2015.&lt;/P&gt;
&lt;P&gt;Have a look at the Editor.Command() and Edtor.CommandAsync() methods.&lt;/P&gt;
&lt;P&gt;You may have a look at &lt;A href="http://through-the-interface.typepad.com/through_the_interface/2014/03/autocad-2015-calling-commands.html" target="_blank"&gt;this thread&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Mar 2015 23:19:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/invoke-command-in-loop-by-resultbuffer-with-autocad-2015/m-p/5549504#M40911</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2015-03-19T23:19:19Z</dc:date>
    </item>
    <item>
      <title>Re : Invoke command in loop by ResultBuffer with Autocad 2015</title>
      <link>https://forums.autodesk.com/t5/net-forum/invoke-command-in-loop-by-resultbuffer-with-autocad-2015/m-p/5549539#M40912</link>
      <description>&lt;P&gt;I will look at this tomorrow. Thanks&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2015 00:01:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/invoke-command-in-loop-by-resultbuffer-with-autocad-2015/m-p/5549539#M40912</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-20T00:01:31Z</dc:date>
    </item>
    <item>
      <title>Re : Invoke command in loop by ResultBuffer with Autocad 2015</title>
      <link>https://forums.autodesk.com/t5/net-forum/invoke-command-in-loop-by-resultbuffer-with-autocad-2015/m-p/5549865#M40913</link>
      <description>&lt;P&gt;You can try this way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[CommandMethod("offpl")]
public void cmdOffset()
{
    Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
    ed.Command("_.offset");
    while (true)
    {
        try { ed.Command(@"\"); }
        catch { break; }
    }
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2015 09:32:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/invoke-command-in-loop-by-resultbuffer-with-autocad-2015/m-p/5549865#M40913</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2015-03-20T09:32:46Z</dc:date>
    </item>
  </channel>
</rss>

