<?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: Passing an entity through SendStringToExecute in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/passing-an-entity-through-sendstringtoexecute/m-p/1820536#M79873</link>
    <description>Hi Tony,&lt;BR /&gt;
I've done what you've suggested and it work's great.&lt;BR /&gt;
It's exactly what i needed.&lt;BR /&gt;
&lt;BR /&gt;
Thank you very much &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
Stefano&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Tony Tanzillo wrote:&lt;BR /&gt;
&amp;gt; You can define a command in your code that you invoke&lt;BR /&gt;
&amp;gt; with SendStringToExecute(), from the application context&lt;BR /&gt;
&amp;gt; (e.g., from the Click handler of a button on your palette).&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; The handler for that defined command will execute in the &lt;BR /&gt;
&amp;gt; document context, and you can access the command line &lt;BR /&gt;
&amp;gt; from there.&lt;BR /&gt;
&amp;gt;</description>
    <pubDate>Wed, 22 Nov 2006 07:32:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-11-22T07:32:24Z</dc:date>
    <item>
      <title>Passing an entity through SendStringToExecute</title>
      <link>https://forums.autodesk.com/t5/net-forum/passing-an-entity-through-sendstringtoexecute/m-p/1820532#M79869</link>
      <description>Hi all.&lt;BR /&gt;
I'm trying to run an Autocad command through SendStringToExecute method &lt;BR /&gt;
of Document class.&lt;BR /&gt;
The command I'm trying to run requires, first of all, that you select an &lt;BR /&gt;
object on the drawing.&lt;BR /&gt;
Now I'm using Autodesk.AutoCAD.Internal.Utils.SelectObjects to select an &lt;BR /&gt;
object on the drawing and then run SendStringToExecute to execute the &lt;BR /&gt;
comand. It work's fine, but it has promlems when I repeat this procedure &lt;BR /&gt;
multiple times in a row. It is due to the lack of synchronization &lt;BR /&gt;
between commands executed in Autocad and .NET commands.&lt;BR /&gt;
Is there any way to pass to an Autocad command the object it needs?&lt;BR /&gt;
The command I'm, trying to use is aecwindowadd, it's an Architectural &lt;BR /&gt;
Desktop command, but it works the same as any other Autocad command:&lt;BR /&gt;
first it asks you to select an object, then ask for a point. If you &lt;BR /&gt;
select the object before running the command it asks you only for the point.&lt;BR /&gt;
I'd like to do something like&lt;BR /&gt;
&lt;BR /&gt;
(command "aecwindowadd" "wall1" "point")&lt;BR /&gt;
&lt;BR /&gt;
or in alternative, first run an Autocad command to automatically select &lt;BR /&gt;
the wall and then run the windowadd command.&lt;BR /&gt;
Thank you all,&lt;BR /&gt;
&lt;BR /&gt;
Stefano</description>
      <pubDate>Thu, 16 Nov 2006 12:36:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/passing-an-entity-through-sendstringtoexecute/m-p/1820532#M79869</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-16T12:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: Passing an entity through SendStringToExecute</title>
      <link>https://forums.autodesk.com/t5/net-forum/passing-an-entity-through-sendstringtoexecute/m-p/1820533#M79870</link>
      <description>The simple answer is don't use SendStringToExecute()&lt;BR /&gt;
to start with.&lt;BR /&gt;
&lt;BR /&gt;
Instead of using SendStringToExecute, use acedCmd(),&lt;BR /&gt;
which you can p/invoke from C#.&lt;BR /&gt;
&lt;BR /&gt;
To see how, look at this file:&lt;BR /&gt;
&lt;BR /&gt;
   http://www.caddzone.com/CommandLine.cs&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 2004/2005/2006/2007&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"ST@N" &lt;STAN&gt; wrote in message news:5397914@discussion.autodesk.com...&lt;BR /&gt;
Hi all.&lt;BR /&gt;
I'm trying to run an Autocad command through SendStringToExecute method &lt;BR /&gt;
of Document class.&lt;BR /&gt;
The command I'm trying to run requires, first of all, that you select an &lt;BR /&gt;
object on the drawing.&lt;BR /&gt;
Now I'm using Autodesk.AutoCAD.Internal.Utils.SelectObjects to select an &lt;BR /&gt;
object on the drawing and then run SendStringToExecute to execute the &lt;BR /&gt;
comand. It work's fine, but it has promlems when I repeat this procedure &lt;BR /&gt;
multiple times in a row. It is due to the lack of synchronization &lt;BR /&gt;
between commands executed in Autocad and .NET commands.&lt;BR /&gt;
Is there any way to pass to an Autocad command the object it needs?&lt;BR /&gt;
The command I'm, trying to use is aecwindowadd, it's an Architectural &lt;BR /&gt;
Desktop command, but it works the same as any other Autocad command:&lt;BR /&gt;
first it asks you to select an object, then ask for a point. If you &lt;BR /&gt;
select the object before running the command it asks you only for the point.&lt;BR /&gt;
I'd like to do something like&lt;BR /&gt;
&lt;BR /&gt;
(command "aecwindowadd" "wall1" "point")&lt;BR /&gt;
&lt;BR /&gt;
or in alternative, first run an Autocad command to automatically select &lt;BR /&gt;
the wall and then run the windowadd command.&lt;BR /&gt;
Thank you all,&lt;BR /&gt;
&lt;BR /&gt;
Stefano&lt;/STAN&gt;</description>
      <pubDate>Thu, 16 Nov 2006 21:44:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/passing-an-entity-through-sendstringtoexecute/m-p/1820533#M79870</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-16T21:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Passing an entity through SendStringToExecute</title>
      <link>https://forums.autodesk.com/t5/net-forum/passing-an-entity-through-sendstringtoexecute/m-p/1820534#M79871</link>
      <description>Hi Tony, thanks for your answer.&lt;BR /&gt;
I saw the file you linked looking in your other answers on this &lt;BR /&gt;
newsgroup and I just tried it.&lt;BR /&gt;
It works fine if I use it invoking the command through commandline.&lt;BR /&gt;
My problem is that I created a PaletteSet and I added to it a simple &lt;BR /&gt;
.net user control: it's made of 2 buttons and 1 textbox.&lt;BR /&gt;
What I'd like to do is click on one button and run the command.&lt;BR /&gt;
&lt;BR /&gt;
private void btnCreateLine_Click(object sender, EventArgs e)&lt;BR /&gt;
{&lt;BR /&gt;
   CreateAcadLine(new Point3d(0, 0, 0), new Point3d(1000, 1000, 0));&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
Here is the definition of the CreateAcadLine method:&lt;BR /&gt;
&lt;BR /&gt;
public static int CreateAcadLine(Point3d startPoint, Point3d endPoint)&lt;BR /&gt;
{&lt;BR /&gt;
     return Command("._line", startPoint, endPoint, "");&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
where Command is the method that was in the file you linked.&lt;BR /&gt;
If check the IsApplicationContext property it is always set to true.&lt;BR /&gt;
I tried removing the check for the IsApplicationContext (I know, it's &lt;BR /&gt;
stupid, but trying it's free &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ), but simply nothing happens, the code &lt;BR /&gt;
executes, but the line doesn't appears.&lt;BR /&gt;
I tried other different methods, like using ads_queueexpr and other &lt;BR /&gt;
unmanaged methods to send commands to autocad, obtaining no result.&lt;BR /&gt;
The only working way I found is SendStringToExecute. I hate the way it &lt;BR /&gt;
works, and if I could use acedCmd would be great. Is there anything I &lt;BR /&gt;
can do to use it? Is there any way to change the context in which the &lt;BR /&gt;
command is being executed (i.e. IsApplicationContext == false)?&lt;BR /&gt;
&lt;BR /&gt;
Thanks again,&lt;BR /&gt;
Stefano&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Tony Tanzillo wrote:&lt;BR /&gt;
&amp;gt; The simple answer is don't use SendStringToExecute()&lt;BR /&gt;
&amp;gt; to start with.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Instead of using SendStringToExecute, use acedCmd(),&lt;BR /&gt;
&amp;gt; which you can p/invoke from C#.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; To see how, look at this file:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt;    http://www.caddzone.com/CommandLine.cs&lt;BR /&gt;
&amp;gt;</description>
      <pubDate>Fri, 17 Nov 2006 11:41:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/passing-an-entity-through-sendstringtoexecute/m-p/1820534#M79871</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-17T11:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: Passing an entity through SendStringToExecute</title>
      <link>https://forums.autodesk.com/t5/net-forum/passing-an-entity-through-sendstringtoexecute/m-p/1820535#M79872</link>
      <description>You can define a command in your code that you invoke&lt;BR /&gt;
with SendStringToExecute(), from the application context&lt;BR /&gt;
(e.g., from the Click handler of a button on your palette).&lt;BR /&gt;
&lt;BR /&gt;
The handler for that defined command will execute in the &lt;BR /&gt;
document context, and you can access the command line &lt;BR /&gt;
from there.&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 2004/2005/2006/2007&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Stefano Costi" &lt;STAN&gt; wrote in message news:5399470@discussion.autodesk.com...&lt;BR /&gt;
Hi Tony, thanks for your answer.&lt;BR /&gt;
I saw the file you linked looking in your other answers on this &lt;BR /&gt;
newsgroup and I just tried it.&lt;BR /&gt;
It works fine if I use it invoking the command through commandline.&lt;BR /&gt;
My problem is that I created a PaletteSet and I added to it a simple &lt;BR /&gt;
.net user control: it's made of 2 buttons and 1 textbox.&lt;BR /&gt;
What I'd like to do is click on one button and run the command.&lt;BR /&gt;
&lt;BR /&gt;
private void btnCreateLine_Click(object sender, EventArgs e)&lt;BR /&gt;
{&lt;BR /&gt;
   CreateAcadLine(new Point3d(0, 0, 0), new Point3d(1000, 1000, 0));&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
Here is the definition of the CreateAcadLine method:&lt;BR /&gt;
&lt;BR /&gt;
public static int CreateAcadLine(Point3d startPoint, Point3d endPoint)&lt;BR /&gt;
{&lt;BR /&gt;
     return Command("._line", startPoint, endPoint, "");&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
where Command is the method that was in the file you linked.&lt;BR /&gt;
If check the IsApplicationContext property it is always set to true.&lt;BR /&gt;
I tried removing the check for the IsApplicationContext (I know, it's &lt;BR /&gt;
stupid, but trying it's free &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ), but simply nothing happens, the code &lt;BR /&gt;
executes, but the line doesn't appears.&lt;BR /&gt;
I tried other different methods, like using ads_queueexpr and other &lt;BR /&gt;
unmanaged methods to send commands to autocad, obtaining no result.&lt;BR /&gt;
The only working way I found is SendStringToExecute. I hate the way it &lt;BR /&gt;
works, and if I could use acedCmd would be great. Is there anything I &lt;BR /&gt;
can do to use it? Is there any way to change the context in which the &lt;BR /&gt;
command is being executed (i.e. IsApplicationContext == false)?&lt;BR /&gt;
&lt;BR /&gt;
Thanks again,&lt;BR /&gt;
Stefano&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Tony Tanzillo wrote:&lt;BR /&gt;
&amp;gt; The simple answer is don't use SendStringToExecute()&lt;BR /&gt;
&amp;gt; to start with.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Instead of using SendStringToExecute, use acedCmd(),&lt;BR /&gt;
&amp;gt; which you can p/invoke from C#.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; To see how, look at this file:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt;    http://www.caddzone.com/CommandLine.cs&lt;BR /&gt;
&amp;gt;&lt;/STAN&gt;</description>
      <pubDate>Fri, 17 Nov 2006 22:26:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/passing-an-entity-through-sendstringtoexecute/m-p/1820535#M79872</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-17T22:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: Passing an entity through SendStringToExecute</title>
      <link>https://forums.autodesk.com/t5/net-forum/passing-an-entity-through-sendstringtoexecute/m-p/1820536#M79873</link>
      <description>Hi Tony,&lt;BR /&gt;
I've done what you've suggested and it work's great.&lt;BR /&gt;
It's exactly what i needed.&lt;BR /&gt;
&lt;BR /&gt;
Thank you very much &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
Stefano&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Tony Tanzillo wrote:&lt;BR /&gt;
&amp;gt; You can define a command in your code that you invoke&lt;BR /&gt;
&amp;gt; with SendStringToExecute(), from the application context&lt;BR /&gt;
&amp;gt; (e.g., from the Click handler of a button on your palette).&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; The handler for that defined command will execute in the &lt;BR /&gt;
&amp;gt; document context, and you can access the command line &lt;BR /&gt;
&amp;gt; from there.&lt;BR /&gt;
&amp;gt;</description>
      <pubDate>Wed, 22 Nov 2006 07:32:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/passing-an-entity-through-sendstringtoexecute/m-p/1820536#M79873</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-11-22T07:32:24Z</dc:date>
    </item>
  </channel>
</rss>

