<?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: Jig functionality when invoked from Palette in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/jig-functionality-when-invoked-from-palette/m-p/2567170#M68895</link>
    <description>oops... wait a minute...&lt;BR /&gt;
&lt;BR /&gt;
There's one small problem with that example, which is that it leaves the &lt;BR /&gt;
command defined, which means the user could issue it, which is something you &lt;BR /&gt;
can't allow.&lt;BR /&gt;
&lt;BR /&gt;
Here's a slightly different version that adds the command just before it &lt;BR /&gt;
runs, and removes it when it completes.&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
using System;&lt;BR /&gt;
using System.Collections.Generic;&lt;BR /&gt;
using System.Linq;&lt;BR /&gt;
using System.Text;&lt;BR /&gt;
using System.Windows.Forms;&lt;BR /&gt;
using Autodesk.AutoCAD.Runtime;&lt;BR /&gt;
using Autodesk.AutoCAD.ApplicationServices;&lt;BR /&gt;
using Acad = Autodesk.AutoCAD.ApplicationServices.Application;&lt;BR /&gt;
using System.Drawing;&lt;BR /&gt;
&lt;BR /&gt;
namespace Namespace1&lt;BR /&gt;
{&lt;BR /&gt;
   public class MyPaletteControl : UserControl&lt;BR /&gt;
   {&lt;BR /&gt;
      // A button that when clicked, triggers the&lt;BR /&gt;
      // code in the modal command handler to run:&lt;BR /&gt;
      private Button button1 = new Button();&lt;BR /&gt;
&lt;BR /&gt;
      public MyPaletteControl()&lt;BR /&gt;
      {&lt;BR /&gt;
         this.Controls.Add( button1 );&lt;BR /&gt;
         button1.Location = new Point( 10, 10 );&lt;BR /&gt;
         button1.Visible = true;&lt;BR /&gt;
&lt;BR /&gt;
         button1.Click += new EventHandler( button1_Click );&lt;BR /&gt;
&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      void button1_Click( object sender, EventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         Document doc = Acad.DocumentManager.MdiActiveDocument;&lt;BR /&gt;
         if( doc != null &amp;amp;&amp;amp; doc.Editor.IsQuiescent )&lt;BR /&gt;
         {&lt;BR /&gt;
            // Add the temporary command and then execute it:&lt;BR /&gt;
&lt;BR /&gt;
            Autodesk.AutoCAD.Internal.Utils.AddCommand(&lt;BR /&gt;
               "MYPALETTECONTROL",&lt;BR /&gt;
               "MYPALETTECOMMAND1",&lt;BR /&gt;
               "MYPALETTECOMMAND1",&lt;BR /&gt;
               CommandFlags.NoActionRecording&lt;BR /&gt;
               | CommandFlags.NoHistory&lt;BR /&gt;
               | CommandFlags.NoMultiple,&lt;BR /&gt;
               this.OnMyPaletteCommand1 );&lt;BR /&gt;
&lt;BR /&gt;
            doc.SendStringToExecute( "MYPALETTECOMMAND1\n",&lt;BR /&gt;
               true, false, false );&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      private void OnMyPaletteCommand1()&lt;BR /&gt;
      {&lt;BR /&gt;
         try&lt;BR /&gt;
         {&lt;BR /&gt;
            // disable the palette control to avoid unintended&lt;BR /&gt;
            // reentry while the command is in progress.&lt;BR /&gt;
&lt;BR /&gt;
            button1.Enabled = false;&lt;BR /&gt;
&lt;BR /&gt;
            ////////////////////////////////////////////&lt;BR /&gt;
            // TODO:&lt;BR /&gt;
            // code here behaves like it is being run&lt;BR /&gt;
            // from a modal command method (because it is)&lt;BR /&gt;
            ////////////////////////////////////////////&lt;BR /&gt;
&lt;BR /&gt;
         }&lt;BR /&gt;
         finally&lt;BR /&gt;
         {&lt;BR /&gt;
            // remove the command that triggered the call to&lt;BR /&gt;
            // this method, so the user can't issue it directly:&lt;BR /&gt;
&lt;BR /&gt;
            Autodesk.AutoCAD.Internal.Utils.RemoveCommand(&lt;BR /&gt;
               "MYPALETTECONTROL", "MYPALETTECOMMAND1" );&lt;BR /&gt;
&lt;BR /&gt;
            // reenable the button:&lt;BR /&gt;
&lt;BR /&gt;
            button1.Enabled = true;&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
   }&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD&lt;BR /&gt;
Supporting AutoCAD 2000 through 2010&lt;BR /&gt;
&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:6265911@discussion.autodesk.com...&lt;BR /&gt;
Rather than run your code directly from a control event on your palette,&lt;BR /&gt;
define an AutoCAD command dynamically using the undocumented AddCommand()&lt;BR /&gt;
method from Autodesk.AutoCAD.Internal.Utils. From the control event handler&lt;BR /&gt;
on your pallete, invoke the command using SendStringToExecute().&lt;BR /&gt;
&lt;BR /&gt;
Here's a quick example:&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
using System;&lt;BR /&gt;
using System.Collections.Generic;&lt;BR /&gt;
using System.Linq;&lt;BR /&gt;
using System.Text;&lt;BR /&gt;
using System.Windows.Forms;&lt;BR /&gt;
using Autodesk.AutoCAD.Runtime;&lt;BR /&gt;
using Autodesk.AutoCAD.ApplicationServices;&lt;BR /&gt;
using Acad = Autodesk.AutoCAD.ApplicationServices.Application;&lt;BR /&gt;
using System.Drawing;&lt;BR /&gt;
&lt;BR /&gt;
namespace Namespace1&lt;BR /&gt;
{&lt;BR /&gt;
   public class MyPaletteControl : UserControl&lt;BR /&gt;
   {&lt;BR /&gt;
      // A button that when clicked, triggers the&lt;BR /&gt;
      // code in the modal command handler to run:&lt;BR /&gt;
&lt;BR /&gt;
      private Button button1 = new Button();&lt;BR /&gt;
&lt;BR /&gt;
      // constructor&lt;BR /&gt;
      public MyPaletteControl()&lt;BR /&gt;
      {&lt;BR /&gt;
         this.Controls.Add( button1 );&lt;BR /&gt;
         button1.Location = new Point( 10, 10 );&lt;BR /&gt;
         button1.Visible = true;&lt;BR /&gt;
&lt;BR /&gt;
         button1.Click += new EventHandler( button1_Click );&lt;BR /&gt;
&lt;BR /&gt;
         // Add a command that runs when button1 is clicked:&lt;BR /&gt;
&lt;BR /&gt;
         Autodesk.AutoCAD.Internal.Utils.AddCommand(&lt;BR /&gt;
            "MYPALETTECONTROL",&lt;BR /&gt;
            "MYPALETTECOMMAND1",&lt;BR /&gt;
            "MYPALETTECOMMAND1",&lt;BR /&gt;
            CommandFlags.NoActionRecording&lt;BR /&gt;
            | CommandFlags.NoHistory&lt;BR /&gt;
            | CommandFlags.NoMultiple,&lt;BR /&gt;
            this.OnMyPalettteCommand1 );&lt;BR /&gt;
&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      void button1_Click( object sender, EventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         Document doc = Acad.DocumentManager.MdiActiveDocument;&lt;BR /&gt;
         if( doc != null &amp;amp;&amp;amp; doc.Editor.IsQuiescent )&lt;BR /&gt;
         {&lt;BR /&gt;
            doc.SendStringToExecute( "MYPALETTECOMMAND1\n",&lt;BR /&gt;
               true, false, false );&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      private void OnMyPalettteCommand1()&lt;BR /&gt;
      {&lt;BR /&gt;
         // disable the palette control to avoid unintended&lt;BR /&gt;
         // reentry while the command is in progress.&lt;BR /&gt;
&lt;BR /&gt;
         this.Enabled = false;&lt;BR /&gt;
&lt;BR /&gt;
         ////////////////////////////////////////////&lt;BR /&gt;
         // TODO:&lt;BR /&gt;
         // code here behaves like it is being run&lt;BR /&gt;
         // from a modal command method (because it is)&lt;BR /&gt;
         ////////////////////////////////////////////&lt;BR /&gt;
&lt;BR /&gt;
         // reenable the control:&lt;BR /&gt;
         this.Enabled = true;&lt;BR /&gt;
      }&lt;BR /&gt;
   }&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD&lt;BR /&gt;
Supporting AutoCAD 2000 through 2010&lt;BR /&gt;
&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");&lt;BR /&gt;
&lt;BR /&gt;
&lt;BERT.VANPETEGHEM&gt; wrote in message&lt;BR /&gt;
news:6265716@discussion.autodesk.com...&lt;BR /&gt;
Hi,&lt;BR /&gt;
&lt;BR /&gt;
I implemented some code from the TTI blog to create polylines with a Jig.&lt;BR /&gt;
(http://through-the-interface.typepad.com/through_the_interface/2006/11/controlling_int_1.html)&lt;BR /&gt;
&lt;BR /&gt;
It is basically a Jig with a line that is drawn to mimic the PLINE&lt;BR /&gt;
functionality.&lt;BR /&gt;
&lt;BR /&gt;
When doing this from a command, all is good.&lt;BR /&gt;
When doing this from a button on a palette, the line drawn by the Jig is not&lt;BR /&gt;
visible, nor are snaps.&lt;BR /&gt;
&lt;BR /&gt;
I also noticed that when running from a command, the comboboxes in the&lt;BR /&gt;
toolbars lock up, but this does not happen from the palette.&lt;BR /&gt;
&lt;BR /&gt;
Any thoughts? I'm using AutoCAD 2007 for this project.&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
&lt;BR /&gt;
http://cupocadnet.blogspot.com&lt;BR /&gt;
&lt;BR /&gt;
Edited by: bert.vanpeteghem@dolmen.be on Oct 5, 2009 1:54 PM&lt;/BERT.VANPETEGHEM&gt;&lt;/TONY.TANZILLO&gt;</description>
    <pubDate>Mon, 05 Oct 2009 16:59:47 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-10-05T16:59:47Z</dc:date>
    <item>
      <title>Jig functionality when invoked from Palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-functionality-when-invoked-from-palette/m-p/2567167#M68892</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I implemented some code from the TTI blog to create polylines with a Jig. (http://through-the-interface.typepad.com/through_the_interface/2006/11/controlling_int_1.html)&lt;BR /&gt;
&lt;BR /&gt;
It is basically a Jig with a line that is drawn to mimic the PLINE functionality.&lt;BR /&gt;
&lt;BR /&gt;
When doing this from a command, all is good.&lt;BR /&gt;
When doing this from a button on a palette, the line drawn by the Jig is not visible, nor are snaps. &lt;BR /&gt;
&lt;BR /&gt;
I also noticed that when running from a command, the comboboxes in the toolbars lock up, but this does not happen from the palette.&lt;BR /&gt;
&lt;BR /&gt;
Any thoughts? I'm using AutoCAD 2007 for this project.&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
&lt;BR /&gt;
http://cupocadnet.blogspot.com

Edited by: bert.vanpeteghem@dolmen.be on Oct 5, 2009 1:54 PM</description>
      <pubDate>Mon, 05 Oct 2009 13:49:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-functionality-when-invoked-from-palette/m-p/2567167#M68892</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-10-05T13:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Jig functionality when invoked from Palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-functionality-when-invoked-from-palette/m-p/2567168#M68893</link>
      <description>Rather than run your code directly from a control event on your palette, &lt;BR /&gt;
define an AutoCAD command dynamically using the undocumented AddCommand() &lt;BR /&gt;
method from Autodesk.AutoCAD.Internal.Utils. From the control event handler &lt;BR /&gt;
on your pallete, invoke the command using SendStringToExecute().&lt;BR /&gt;
&lt;BR /&gt;
Here's a quick example:&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
using System;&lt;BR /&gt;
using System.Collections.Generic;&lt;BR /&gt;
using System.Linq;&lt;BR /&gt;
using System.Text;&lt;BR /&gt;
using System.Windows.Forms;&lt;BR /&gt;
using Autodesk.AutoCAD.Runtime;&lt;BR /&gt;
using Autodesk.AutoCAD.ApplicationServices;&lt;BR /&gt;
using Acad = Autodesk.AutoCAD.ApplicationServices.Application;&lt;BR /&gt;
using System.Drawing;&lt;BR /&gt;
&lt;BR /&gt;
namespace Namespace1&lt;BR /&gt;
{&lt;BR /&gt;
   public class MyPaletteControl : UserControl&lt;BR /&gt;
   {&lt;BR /&gt;
      // A button that when clicked, triggers the&lt;BR /&gt;
      // code in the modal command handler to run:&lt;BR /&gt;
&lt;BR /&gt;
      private Button button1 = new Button();&lt;BR /&gt;
&lt;BR /&gt;
      // constructor&lt;BR /&gt;
      public MyPaletteControl()&lt;BR /&gt;
      {&lt;BR /&gt;
         this.Controls.Add( button1 );&lt;BR /&gt;
         button1.Location = new Point( 10, 10 );&lt;BR /&gt;
         button1.Visible = true;&lt;BR /&gt;
&lt;BR /&gt;
         button1.Click += new EventHandler( button1_Click );&lt;BR /&gt;
&lt;BR /&gt;
         // Add a command that runs when button1 is clicked:&lt;BR /&gt;
&lt;BR /&gt;
         Autodesk.AutoCAD.Internal.Utils.AddCommand(&lt;BR /&gt;
            "MYPALETTECONTROL",&lt;BR /&gt;
            "MYPALETTECOMMAND1",&lt;BR /&gt;
            "MYPALETTECOMMAND1",&lt;BR /&gt;
            CommandFlags.NoActionRecording&lt;BR /&gt;
            | CommandFlags.NoHistory&lt;BR /&gt;
            | CommandFlags.NoMultiple,&lt;BR /&gt;
            this.OnMyPalettteCommand1 );&lt;BR /&gt;
&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      void button1_Click( object sender, EventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         Document doc = Acad.DocumentManager.MdiActiveDocument;&lt;BR /&gt;
         if( doc != null &amp;amp;&amp;amp; doc.Editor.IsQuiescent )&lt;BR /&gt;
         {&lt;BR /&gt;
            doc.SendStringToExecute( "MYPALETTECOMMAND1\n",&lt;BR /&gt;
               true, false, false );&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      private void OnMyPalettteCommand1()&lt;BR /&gt;
      {&lt;BR /&gt;
         // disable the palette control to avoid unintended&lt;BR /&gt;
         // reentry while the command is in progress.&lt;BR /&gt;
&lt;BR /&gt;
         this.Enabled = false;&lt;BR /&gt;
&lt;BR /&gt;
         ////////////////////////////////////////////&lt;BR /&gt;
         // TODO:&lt;BR /&gt;
         // code here behaves like it is being run&lt;BR /&gt;
         // from a modal command method (because it is)&lt;BR /&gt;
         ////////////////////////////////////////////&lt;BR /&gt;
&lt;BR /&gt;
         // reenable the control:&lt;BR /&gt;
         this.Enabled = true;&lt;BR /&gt;
      }&lt;BR /&gt;
   }&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD&lt;BR /&gt;
Supporting AutoCAD 2000 through 2010&lt;BR /&gt;
&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");&lt;BR /&gt;
&lt;BR /&gt;
&lt;BERT.VANPETEGHEM&gt; wrote in message &lt;BR /&gt;
news:6265716@discussion.autodesk.com...&lt;BR /&gt;
Hi,&lt;BR /&gt;
&lt;BR /&gt;
I implemented some code from the TTI blog to create polylines with a Jig. &lt;BR /&gt;
(http://through-the-interface.typepad.com/through_the_interface/2006/11/controlling_int_1.html)&lt;BR /&gt;
&lt;BR /&gt;
It is basically a Jig with a line that is drawn to mimic the PLINE &lt;BR /&gt;
functionality.&lt;BR /&gt;
&lt;BR /&gt;
When doing this from a command, all is good.&lt;BR /&gt;
When doing this from a button on a palette, the line drawn by the Jig is not &lt;BR /&gt;
visible, nor are snaps.&lt;BR /&gt;
&lt;BR /&gt;
I also noticed that when running from a command, the comboboxes in the &lt;BR /&gt;
toolbars lock up, but this does not happen from the palette.&lt;BR /&gt;
&lt;BR /&gt;
Any thoughts? I'm using AutoCAD 2007 for this project.&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
&lt;BR /&gt;
http://cupocadnet.blogspot.com&lt;BR /&gt;
&lt;BR /&gt;
Edited by: bert.vanpeteghem@dolmen.be on Oct 5, 2009 1:54 PM&lt;/BERT.VANPETEGHEM&gt;</description>
      <pubDate>Mon, 05 Oct 2009 15:59:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-functionality-when-invoked-from-palette/m-p/2567168#M68893</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-10-05T15:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Jig functionality when invoked from Palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-functionality-when-invoked-from-palette/m-p/2567169#M68894</link>
      <description>Very very nice, thanks !</description>
      <pubDate>Mon, 05 Oct 2009 16:43:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-functionality-when-invoked-from-palette/m-p/2567169#M68894</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-10-05T16:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: Jig functionality when invoked from Palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-functionality-when-invoked-from-palette/m-p/2567170#M68895</link>
      <description>oops... wait a minute...&lt;BR /&gt;
&lt;BR /&gt;
There's one small problem with that example, which is that it leaves the &lt;BR /&gt;
command defined, which means the user could issue it, which is something you &lt;BR /&gt;
can't allow.&lt;BR /&gt;
&lt;BR /&gt;
Here's a slightly different version that adds the command just before it &lt;BR /&gt;
runs, and removes it when it completes.&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
using System;&lt;BR /&gt;
using System.Collections.Generic;&lt;BR /&gt;
using System.Linq;&lt;BR /&gt;
using System.Text;&lt;BR /&gt;
using System.Windows.Forms;&lt;BR /&gt;
using Autodesk.AutoCAD.Runtime;&lt;BR /&gt;
using Autodesk.AutoCAD.ApplicationServices;&lt;BR /&gt;
using Acad = Autodesk.AutoCAD.ApplicationServices.Application;&lt;BR /&gt;
using System.Drawing;&lt;BR /&gt;
&lt;BR /&gt;
namespace Namespace1&lt;BR /&gt;
{&lt;BR /&gt;
   public class MyPaletteControl : UserControl&lt;BR /&gt;
   {&lt;BR /&gt;
      // A button that when clicked, triggers the&lt;BR /&gt;
      // code in the modal command handler to run:&lt;BR /&gt;
      private Button button1 = new Button();&lt;BR /&gt;
&lt;BR /&gt;
      public MyPaletteControl()&lt;BR /&gt;
      {&lt;BR /&gt;
         this.Controls.Add( button1 );&lt;BR /&gt;
         button1.Location = new Point( 10, 10 );&lt;BR /&gt;
         button1.Visible = true;&lt;BR /&gt;
&lt;BR /&gt;
         button1.Click += new EventHandler( button1_Click );&lt;BR /&gt;
&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      void button1_Click( object sender, EventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         Document doc = Acad.DocumentManager.MdiActiveDocument;&lt;BR /&gt;
         if( doc != null &amp;amp;&amp;amp; doc.Editor.IsQuiescent )&lt;BR /&gt;
         {&lt;BR /&gt;
            // Add the temporary command and then execute it:&lt;BR /&gt;
&lt;BR /&gt;
            Autodesk.AutoCAD.Internal.Utils.AddCommand(&lt;BR /&gt;
               "MYPALETTECONTROL",&lt;BR /&gt;
               "MYPALETTECOMMAND1",&lt;BR /&gt;
               "MYPALETTECOMMAND1",&lt;BR /&gt;
               CommandFlags.NoActionRecording&lt;BR /&gt;
               | CommandFlags.NoHistory&lt;BR /&gt;
               | CommandFlags.NoMultiple,&lt;BR /&gt;
               this.OnMyPaletteCommand1 );&lt;BR /&gt;
&lt;BR /&gt;
            doc.SendStringToExecute( "MYPALETTECOMMAND1\n",&lt;BR /&gt;
               true, false, false );&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      private void OnMyPaletteCommand1()&lt;BR /&gt;
      {&lt;BR /&gt;
         try&lt;BR /&gt;
         {&lt;BR /&gt;
            // disable the palette control to avoid unintended&lt;BR /&gt;
            // reentry while the command is in progress.&lt;BR /&gt;
&lt;BR /&gt;
            button1.Enabled = false;&lt;BR /&gt;
&lt;BR /&gt;
            ////////////////////////////////////////////&lt;BR /&gt;
            // TODO:&lt;BR /&gt;
            // code here behaves like it is being run&lt;BR /&gt;
            // from a modal command method (because it is)&lt;BR /&gt;
            ////////////////////////////////////////////&lt;BR /&gt;
&lt;BR /&gt;
         }&lt;BR /&gt;
         finally&lt;BR /&gt;
         {&lt;BR /&gt;
            // remove the command that triggered the call to&lt;BR /&gt;
            // this method, so the user can't issue it directly:&lt;BR /&gt;
&lt;BR /&gt;
            Autodesk.AutoCAD.Internal.Utils.RemoveCommand(&lt;BR /&gt;
               "MYPALETTECONTROL", "MYPALETTECOMMAND1" );&lt;BR /&gt;
&lt;BR /&gt;
            // reenable the button:&lt;BR /&gt;
&lt;BR /&gt;
            button1.Enabled = true;&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
   }&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD&lt;BR /&gt;
Supporting AutoCAD 2000 through 2010&lt;BR /&gt;
&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:6265911@discussion.autodesk.com...&lt;BR /&gt;
Rather than run your code directly from a control event on your palette,&lt;BR /&gt;
define an AutoCAD command dynamically using the undocumented AddCommand()&lt;BR /&gt;
method from Autodesk.AutoCAD.Internal.Utils. From the control event handler&lt;BR /&gt;
on your pallete, invoke the command using SendStringToExecute().&lt;BR /&gt;
&lt;BR /&gt;
Here's a quick example:&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
using System;&lt;BR /&gt;
using System.Collections.Generic;&lt;BR /&gt;
using System.Linq;&lt;BR /&gt;
using System.Text;&lt;BR /&gt;
using System.Windows.Forms;&lt;BR /&gt;
using Autodesk.AutoCAD.Runtime;&lt;BR /&gt;
using Autodesk.AutoCAD.ApplicationServices;&lt;BR /&gt;
using Acad = Autodesk.AutoCAD.ApplicationServices.Application;&lt;BR /&gt;
using System.Drawing;&lt;BR /&gt;
&lt;BR /&gt;
namespace Namespace1&lt;BR /&gt;
{&lt;BR /&gt;
   public class MyPaletteControl : UserControl&lt;BR /&gt;
   {&lt;BR /&gt;
      // A button that when clicked, triggers the&lt;BR /&gt;
      // code in the modal command handler to run:&lt;BR /&gt;
&lt;BR /&gt;
      private Button button1 = new Button();&lt;BR /&gt;
&lt;BR /&gt;
      // constructor&lt;BR /&gt;
      public MyPaletteControl()&lt;BR /&gt;
      {&lt;BR /&gt;
         this.Controls.Add( button1 );&lt;BR /&gt;
         button1.Location = new Point( 10, 10 );&lt;BR /&gt;
         button1.Visible = true;&lt;BR /&gt;
&lt;BR /&gt;
         button1.Click += new EventHandler( button1_Click );&lt;BR /&gt;
&lt;BR /&gt;
         // Add a command that runs when button1 is clicked:&lt;BR /&gt;
&lt;BR /&gt;
         Autodesk.AutoCAD.Internal.Utils.AddCommand(&lt;BR /&gt;
            "MYPALETTECONTROL",&lt;BR /&gt;
            "MYPALETTECOMMAND1",&lt;BR /&gt;
            "MYPALETTECOMMAND1",&lt;BR /&gt;
            CommandFlags.NoActionRecording&lt;BR /&gt;
            | CommandFlags.NoHistory&lt;BR /&gt;
            | CommandFlags.NoMultiple,&lt;BR /&gt;
            this.OnMyPalettteCommand1 );&lt;BR /&gt;
&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      void button1_Click( object sender, EventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         Document doc = Acad.DocumentManager.MdiActiveDocument;&lt;BR /&gt;
         if( doc != null &amp;amp;&amp;amp; doc.Editor.IsQuiescent )&lt;BR /&gt;
         {&lt;BR /&gt;
            doc.SendStringToExecute( "MYPALETTECOMMAND1\n",&lt;BR /&gt;
               true, false, false );&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      private void OnMyPalettteCommand1()&lt;BR /&gt;
      {&lt;BR /&gt;
         // disable the palette control to avoid unintended&lt;BR /&gt;
         // reentry while the command is in progress.&lt;BR /&gt;
&lt;BR /&gt;
         this.Enabled = false;&lt;BR /&gt;
&lt;BR /&gt;
         ////////////////////////////////////////////&lt;BR /&gt;
         // TODO:&lt;BR /&gt;
         // code here behaves like it is being run&lt;BR /&gt;
         // from a modal command method (because it is)&lt;BR /&gt;
         ////////////////////////////////////////////&lt;BR /&gt;
&lt;BR /&gt;
         // reenable the control:&lt;BR /&gt;
         this.Enabled = true;&lt;BR /&gt;
      }&lt;BR /&gt;
   }&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD&lt;BR /&gt;
Supporting AutoCAD 2000 through 2010&lt;BR /&gt;
&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");&lt;BR /&gt;
&lt;BR /&gt;
&lt;BERT.VANPETEGHEM&gt; wrote in message&lt;BR /&gt;
news:6265716@discussion.autodesk.com...&lt;BR /&gt;
Hi,&lt;BR /&gt;
&lt;BR /&gt;
I implemented some code from the TTI blog to create polylines with a Jig.&lt;BR /&gt;
(http://through-the-interface.typepad.com/through_the_interface/2006/11/controlling_int_1.html)&lt;BR /&gt;
&lt;BR /&gt;
It is basically a Jig with a line that is drawn to mimic the PLINE&lt;BR /&gt;
functionality.&lt;BR /&gt;
&lt;BR /&gt;
When doing this from a command, all is good.&lt;BR /&gt;
When doing this from a button on a palette, the line drawn by the Jig is not&lt;BR /&gt;
visible, nor are snaps.&lt;BR /&gt;
&lt;BR /&gt;
I also noticed that when running from a command, the comboboxes in the&lt;BR /&gt;
toolbars lock up, but this does not happen from the palette.&lt;BR /&gt;
&lt;BR /&gt;
Any thoughts? I'm using AutoCAD 2007 for this project.&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
&lt;BR /&gt;
http://cupocadnet.blogspot.com&lt;BR /&gt;
&lt;BR /&gt;
Edited by: bert.vanpeteghem@dolmen.be on Oct 5, 2009 1:54 PM&lt;/BERT.VANPETEGHEM&gt;&lt;/TONY.TANZILLO&gt;</description>
      <pubDate>Mon, 05 Oct 2009 16:59:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-functionality-when-invoked-from-palette/m-p/2567170#M68895</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-10-05T16:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: Jig functionality when invoked from Palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-functionality-when-invoked-from-palette/m-p/2567171#M68896</link>
      <description>Hmm, it seams this method does not yet exist in 2007, any idea on how to do this in AutoCAD 2007?</description>
      <pubDate>Wed, 07 Oct 2009 14:19:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-functionality-when-invoked-from-palette/m-p/2567171#M68896</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-10-07T14:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Jig functionality when invoked from Palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-functionality-when-invoked-from-palette/m-p/2567172#M68897</link>
      <description>No can do in 2007. The method it uses didn't appear until AutoCAD 2009. &lt;BR /&gt;
There's no other simple way of doing that in 2007 I'm afraid.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD&lt;BR /&gt;
Supporting AutoCAD 2000 through 2010&lt;BR /&gt;
&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");&lt;BR /&gt;
&lt;BR /&gt;
&lt;BERT.VANPETEGHEM&gt; wrote in message &lt;BR /&gt;
news:6267453@discussion.autodesk.com...&lt;BR /&gt;
Hmm, it seams this method does not yet exist in 2007, any idea on how to do &lt;BR /&gt;
this in AutoCAD 2007?&lt;/BERT.VANPETEGHEM&gt;</description>
      <pubDate>Thu, 08 Oct 2009 05:13:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-functionality-when-invoked-from-palette/m-p/2567172#M68897</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-10-08T05:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Jig functionality when invoked from Palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-functionality-when-invoked-from-palette/m-p/2567173#M68898</link>
      <description>I found a way &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;BR /&gt;
With delegates and SendStringToExecute, I managed to get this working. I will post the details later today.&lt;BR /&gt;
&lt;BR /&gt;
Update: I posted the details on my blog: http://cupocadnet.blogspot.com/2009/10/using-jigs-from-palettes.html&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
&lt;BR /&gt;
http://cupocadnet.blogspot.com

Edited by: bert.vanpeteghem@dolmen.be on Oct 12, 2009 8:20 AM</description>
      <pubDate>Thu, 08 Oct 2009 05:20:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-functionality-when-invoked-from-palette/m-p/2567173#M68898</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-10-08T05:20:22Z</dc:date>
    </item>
  </channel>
</rss>

