<?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: SendCommand in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799764#M80052</link>
    <description>&lt;JASON.BRENTON&gt; wrote in message &lt;BR /&gt;
&lt;BR /&gt;
&amp;gt;&amp;gt; why? i am calling it from a .net dll, not vba&lt;BR /&gt;
&lt;BR /&gt;
You are calling what from a .NET dll?&lt;BR /&gt;
&lt;BR /&gt;
A managed ObjectARX API, or an ActiveX API?&lt;BR /&gt;
&lt;BR /&gt;
We mainly discuss using the managed ObjectARX API here, not the VBA/ActiveX API.&lt;BR /&gt;
&lt;BR /&gt;
Your question about SendCommand() has the same answer regardless of what programming langauge you're calling it from, and has been asked and answered dozens of times in the VBA newsgroup (hint: search that newsgroup on the keyword "handent").&lt;BR /&gt;
&lt;BR /&gt;
It may be called the VBA newsgroup, but it would more accurately be called the ActiveX newsgroup, because many topics about that API are discussed there, including those related to using it from standalone VB6 (not VBA); Delphi; C#; and other ActiveX-enabled development tools.&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 2008&lt;BR /&gt;
Supporting AutoCAD 2000 through 2008&lt;BR /&gt;
http://www.acadxtabs.com&lt;/JASON.BRENTON&gt;</description>
    <pubDate>Thu, 07 Feb 2008 22:46:11 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2008-02-07T22:46:11Z</dc:date>
    <item>
      <title>SendCommand</title>
      <link>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799754#M80042</link>
      <description>Hi:&lt;BR /&gt;
&lt;BR /&gt;
Can somebody please tell me if it is possible to Synchronously execute a command sent via SendCommand while using the COM/ActiveX interface in VB 2005? I know I can do this in VBA (in my particular application the commands executed via SendCommand are always complete and the program never needs to wait for user data), but I was hoping I could do the same using VB 2005. Unfortunately, so far I have not been able to do that. In the example below the SendCommand is executed after the file has been saved and I want it to execute before the file is saved. Can somebody please tell me if it is even possible to do what I want to do?&lt;BR /&gt;
&lt;BR /&gt;
Any ideas would be greatly appreciated,&lt;BR /&gt;
&lt;BR /&gt;
Raul&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Imports Autodesk.AutoCAD.Runtime&lt;BR /&gt;
Imports Autodesk.AutoCAD.Interop&lt;BR /&gt;
Imports Autodesk.AutoCAD.Interop.Common&lt;BR /&gt;
Imports System.IO&lt;BR /&gt;
&lt;BR /&gt;
Public Class ClsTest&lt;BR /&gt;
&lt;BR /&gt;
 &amp;gt;CommandMethod("Test")&amp;gt; _&lt;BR /&gt;
 Public Sub Test()&lt;BR /&gt;
   Dim OutputPath As String = "c:\Test\dwg"&lt;BR /&gt;
   Dim ObjAcad As AcadApplication&lt;BR /&gt;
   Dim ThisDrawing As AcadDocument&lt;BR /&gt;
   Dim Obj As Acad3DSolid&lt;BR /&gt;
   Dim ZeroOrgin() As Double = {0, 0, 0}&lt;BR /&gt;
   Dim Width as Double = 2&lt;BR /&gt;
   Dim Depth as Double = 4&lt;BR /&gt;
   Dim Length as Double = 8&lt;BR /&gt;
&lt;BR /&gt;
   Directory.Delete(OutputPath, True)&lt;BR /&gt;
   Directory.CreateDirectory(OutputPath)&lt;BR /&gt;
&lt;BR /&gt;
   ObjAcad = DirectCast(GetObject(, "AutoCAD.Application.17"), AcadApplication)&lt;BR /&gt;
   ObjAcad.Visible = True&lt;BR /&gt;
   ThisDrawing = ObjAcad.ActiveDocument&lt;BR /&gt;
&lt;BR /&gt;
   Obj = ThisDrawing.ModelSpace.AddBox(ZeroOrgin, Width, Depth, Length)&lt;BR /&gt;
   ThisDrawing.SendCommand("_zoom" &amp;amp; vbCr &amp;amp; "e" &amp;amp; vbCr)&lt;BR /&gt;
&lt;BR /&gt;
   ' I was hoping the Do Loop below would be the answer to my problem,&lt;BR /&gt;
   ' but IsQuiescent is never True and as a result the program hangs.&lt;BR /&gt;
   ' Without the Do Loop, the SendCommand is not executed until after&lt;BR /&gt;
   ' the drawing is saved, which is not what I want. Any ideas how to&lt;BR /&gt;
   ' solve this problem?&lt;BR /&gt;
   Do Until ObjAcad.GetAcadState.IsQuiescent = True&lt;BR /&gt;
   Loop&lt;BR /&gt;
&lt;BR /&gt;
   ThisDrawing.SaveAs(OutputPath &amp;amp; "\Test.dwg")&lt;BR /&gt;
&lt;BR /&gt;
 End Sub&lt;BR /&gt;
End Class</description>
      <pubDate>Tue, 24 Oct 2006 11:45:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799754#M80042</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-10-24T11:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: SendCommand</title>
      <link>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799755#M80043</link>
      <description>Break the sequence up into parts and then use AutoLISP or ARX to control the &lt;BR /&gt;
sequencing.</description>
      <pubDate>Tue, 24 Oct 2006 12:16:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799755#M80043</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-10-24T12:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: SendCommand</title>
      <link>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799756#M80044</link>
      <description>I use any thing as this&lt;BR /&gt;
I wait that this can help you&lt;BR /&gt;
tp&lt;BR /&gt;
&lt;BR /&gt;
Imports AcAp = Autodesk.AutoCAD.ApplicationServices&lt;BR /&gt;
Imports AcDb = Autodesk.AutoCAD.DatabaseServices&lt;BR /&gt;
Imports AcRx = Autodesk.AutoCAD.Runtime&lt;BR /&gt;
&lt;BR /&gt;
Public Module Module1&lt;BR /&gt;
&lt;BR /&gt;
   &lt;ACRX.COMMANDMETHOD&gt; _&lt;BR /&gt;
   Public Sub Teste()&lt;BR /&gt;
      Dim doc As AcAp.Document =&lt;BR /&gt;
AcAp.Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
      AddHandlers()&lt;BR /&gt;
      doc.SendStringToExecute("_zoom" &amp;amp; vbCr &amp;amp; "e" &amp;amp; vbCr, True, False,&lt;BR /&gt;
False)&lt;BR /&gt;
   End Sub&lt;BR /&gt;
&lt;BR /&gt;
   Private m_Command As String = Nothing&lt;BR /&gt;
&lt;BR /&gt;
   Sub AddHandlers()&lt;BR /&gt;
      Dim d As AcAp.Document =&lt;BR /&gt;
AcAp.Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
      AddHandler d.CommandWillStart, AddressOf CommandWillStart&lt;BR /&gt;
      AddHandler d.CommandEnded, AddressOf CommandEnded&lt;BR /&gt;
      AddHandler d.CommandFailed, AddressOf CommandFailed&lt;BR /&gt;
      AddHandler d.CommandCancelled, AddressOf CommandCancelled&lt;BR /&gt;
   End Sub&lt;BR /&gt;
&lt;BR /&gt;
   Sub RemoveHandlers()&lt;BR /&gt;
      Dim d As AcAp.Document =&lt;BR /&gt;
AcAp.Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
      RemoveHandler d.CommandWillStart, AddressOf CommandWillStart&lt;BR /&gt;
      RemoveHandler d.CommandEnded, AddressOf CommandEnded&lt;BR /&gt;
      RemoveHandler d.CommandFailed, AddressOf CommandFailed&lt;BR /&gt;
      RemoveHandler d.CommandCancelled, AddressOf CommandCancelled&lt;BR /&gt;
      m_Command = Nothing&lt;BR /&gt;
   End Sub&lt;BR /&gt;
&lt;BR /&gt;
   Sub CommandWillStart(ByVal sender As Object, ByVal e As&lt;BR /&gt;
Autodesk.AutoCAD.ApplicationServices.CommandEventArgs)&lt;BR /&gt;
      If m_Command Is Nothing Then m_Command = e.GlobalCommandName&lt;BR /&gt;
   End Sub&lt;BR /&gt;
&lt;BR /&gt;
   Sub CommandEnded(ByVal sender As Object, ByVal e As&lt;BR /&gt;
Autodesk.AutoCAD.ApplicationServices.CommandEventArgs)&lt;BR /&gt;
      If e.GlobalCommandName = m_Command Then&lt;BR /&gt;
&lt;BR /&gt;
         Dim db As AcDb.Database =&lt;BR /&gt;
AcDb.HostApplicationServices.WorkingDatabase()&lt;BR /&gt;
         db.SaveAs("C:\Teste.dwg", AcDb.DwgVersion.Current)&lt;BR /&gt;
&lt;BR /&gt;
         RemoveHandlers()&lt;BR /&gt;
      End If&lt;BR /&gt;
   End Sub&lt;BR /&gt;
&lt;BR /&gt;
   Sub CommandCancelled(ByVal sender As Object, ByVal e As&lt;BR /&gt;
Autodesk.AutoCAD.ApplicationServices.CommandEventArgs)&lt;BR /&gt;
      RemoveHandlers()&lt;BR /&gt;
   End Sub&lt;BR /&gt;
&lt;BR /&gt;
   Sub CommandFailed(ByVal sender As Object, ByVal e As&lt;BR /&gt;
Autodesk.AutoCAD.ApplicationServices.CommandEventArgs)&lt;BR /&gt;
      RemoveHandlers()&lt;BR /&gt;
   End Sub&lt;BR /&gt;
&lt;BR /&gt;
End Module&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;RAUL aguilar=""&gt; escreveu na mensagem &lt;BR /&gt;
news:5372117@discussion.autodesk.com...&lt;BR /&gt;
Hi:&lt;BR /&gt;
&lt;BR /&gt;
Can somebody please tell me if it is possible to Synchronously execute a&lt;BR /&gt;
command sent via SendCommand while using the COM/ActiveX interface in VB&lt;BR /&gt;
2005? I know I can do this in VBA (in my particular application the &lt;BR /&gt;
commands&lt;BR /&gt;
executed via SendCommand are always complete and the program never needs &lt;BR /&gt;
to&lt;BR /&gt;
wait for user data), but I was hoping I could do the same using VB 2005.&lt;BR /&gt;
Unfortunately, so far I have not been able to do that. In the example &lt;BR /&gt;
below&lt;BR /&gt;
the SendCommand is executed after the file has been saved and I want it to&lt;BR /&gt;
execute before the file is saved. Can somebody please tell me if it is &lt;BR /&gt;
even&lt;BR /&gt;
possible to do what I want to do?&lt;BR /&gt;
&lt;BR /&gt;
Any ideas would be greatly appreciated,&lt;BR /&gt;
&lt;BR /&gt;
Raul&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Imports Autodesk.AutoCAD.Runtime&lt;BR /&gt;
Imports Autodesk.AutoCAD.Interop&lt;BR /&gt;
Imports Autodesk.AutoCAD.Interop.Common&lt;BR /&gt;
Imports System.IO&lt;BR /&gt;
&lt;BR /&gt;
Public Class ClsTest&lt;BR /&gt;
&lt;BR /&gt;
 &amp;gt;CommandMethod("Test")&amp;gt; _&lt;BR /&gt;
 Public Sub Test()&lt;BR /&gt;
   Dim OutputPath As String = "c:\Test\dwg"&lt;BR /&gt;
   Dim ObjAcad As AcadApplication&lt;BR /&gt;
   Dim ThisDrawing As AcadDocument&lt;BR /&gt;
   Dim Obj As Acad3DSolid&lt;BR /&gt;
   Dim ZeroOrgin() As Double = {0, 0, 0}&lt;BR /&gt;
   Dim Width as Double = 2&lt;BR /&gt;
   Dim Depth as Double = 4&lt;BR /&gt;
   Dim Length as Double = 8&lt;BR /&gt;
&lt;BR /&gt;
   Directory.Delete(OutputPath, True)&lt;BR /&gt;
   Directory.CreateDirectory(OutputPath)&lt;BR /&gt;
&lt;BR /&gt;
   ObjAcad = DirectCast(GetObject(, "AutoCAD.Application.17"),&lt;BR /&gt;
AcadApplication)&lt;BR /&gt;
   ObjAcad.Visible = True&lt;BR /&gt;
   ThisDrawing = ObjAcad.ActiveDocument&lt;BR /&gt;
&lt;BR /&gt;
   Obj = ThisDrawing.ModelSpace.AddBox(ZeroOrgin, Width, Depth, Length)&lt;BR /&gt;
   ThisDrawing.SendCommand("_zoom" &amp;amp; vbCr &amp;amp; "e" &amp;amp; vbCr)&lt;BR /&gt;
&lt;BR /&gt;
   ' I was hoping the Do Loop below would be the answer to my problem,&lt;BR /&gt;
   ' but IsQuiescent is never True and as a result the program hangs.&lt;BR /&gt;
   ' Without the Do Loop, the SendCommand is not executed until after&lt;BR /&gt;
   ' the drawing is saved, which is not what I want. Any ideas how to&lt;BR /&gt;
   ' solve this problem?&lt;BR /&gt;
   Do Until ObjAcad.GetAcadState.IsQuiescent = True&lt;BR /&gt;
   Loop&lt;BR /&gt;
&lt;BR /&gt;
   ThisDrawing.SaveAs(OutputPath &amp;amp; "\Test.dwg")&lt;BR /&gt;
&lt;BR /&gt;
 End Sub&lt;BR /&gt;
End Class&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I'm protected by SpamBrave&lt;BR /&gt;
http://www.spambrave.com/&lt;/RAUL&gt;&lt;/ACRX.COMMANDMETHOD&gt;</description>
      <pubDate>Tue, 24 Oct 2006 14:39:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799756#M80044</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-10-24T14:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: SendCommand</title>
      <link>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799757#M80045</link>
      <description>James, TP:&lt;BR /&gt;
&lt;BR /&gt;
Thank you very much for both of your replies. I implemented what I thought you suggested. As you can see from the code below, I created a ClsSendCommand class which contains the MyZoomExtend Sub. The MyZoomExtend Sub is nothing more than a call to the SendStringToExecute Method. Since this behaves the same way as the original code (the zoom extend does not happen until after the Save), I assume I must have misunderstood your suggestion. Could you please tell me where I went wrong?&lt;BR /&gt;
&lt;BR /&gt;
Thanks again for your help,&lt;BR /&gt;
&lt;BR /&gt;
Raul&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Imports Autodesk.AutoCAD.Runtime&lt;BR /&gt;
Imports Autodesk.AutoCAD.ApplicationServices&lt;BR /&gt;
Imports Autodesk.AutoCAD.DatabaseServices&lt;BR /&gt;
&lt;BR /&gt;
Public Class ClsSendCommand&lt;BR /&gt;
  Public Sub MyZoomExtend()&lt;BR /&gt;
    ' I am aware that the Zoom extend command is probably not a good candidate&lt;BR /&gt;
    ' for using either the SendCommand or SendStringToExecute method because the&lt;BR /&gt;
    ' Zoom command is already exposed by the COM/ActiveX interface. However,&lt;BR /&gt;
    ' this was the simplest example I could find. In reality, I need to use the&lt;BR /&gt;
    ' vplayer and solprof commands, which I don't believe are exposed by the&lt;BR /&gt;
    ' COM/ActiveX interface.&lt;BR /&gt;
    Application.DocumentManager.MdiActiveDocument.SendStringToExecute("_zoom" &amp;amp; vbCr &amp;amp; "e" &amp;amp; vbCr, True, False, False)&lt;BR /&gt;
  End Sub&lt;BR /&gt;
End Class&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Imports Autodesk.AutoCAD.Runtime&lt;BR /&gt;
Imports Autodesk.AutoCAD.Interop&lt;BR /&gt;
Imports Autodesk.AutoCAD.Interop.Common&lt;BR /&gt;
Imports System.IO&lt;BR /&gt;
&lt;BR /&gt;
Public Class ClsTest&lt;BR /&gt;
&lt;BR /&gt;
  &amp;gt;CommandMethod("Test")&amp;gt; _&lt;BR /&gt;
  Public Sub Test()&lt;BR /&gt;
    Dim OutputPath As String = "c:\Test\dwg"&lt;BR /&gt;
    Dim ObjAcad As AcadApplication&lt;BR /&gt;
    Dim ThisDrawing As AcadDocument&lt;BR /&gt;
    Dim Obj As Acad3DSolid&lt;BR /&gt;
    Dim ZeroOrgin() As Double = {0, 0, 0}&lt;BR /&gt;
    Dim Width As Double = 2&lt;BR /&gt;
    Dim Depth As Double = 4&lt;BR /&gt;
    Dim Length As Double = 8&lt;BR /&gt;
    Dim SendCommand As New ClsSendCommand&lt;BR /&gt;
&lt;BR /&gt;
    Directory.Delete(OutputPath, True)&lt;BR /&gt;
    Directory.CreateDirectory(OutputPath)&lt;BR /&gt;
&lt;BR /&gt;
    ObjAcad = DirectCast(GetObject(, "AutoCAD.Application.17"), AcadApplication)&lt;BR /&gt;
    ObjAcad.Visible = True&lt;BR /&gt;
    ThisDrawing = ObjAcad.ActiveDocument&lt;BR /&gt;
&lt;BR /&gt;
    Obj = ThisDrawing.ModelSpace.AddBox(ZeroOrgin, Width, Depth, Length)&lt;BR /&gt;
    ' The problem I am having is that the line below does not get executed&lt;BR /&gt;
    ' until after the SaveAs&lt;BR /&gt;
    SendCommand.MyZoomExtend()&lt;BR /&gt;
    ThisDrawing.SaveAs(OutputPath &amp;amp; "\Test.dwg")&lt;BR /&gt;
&lt;BR /&gt;
  End Sub&lt;BR /&gt;
End Class</description>
      <pubDate>Tue, 24 Oct 2006 15:33:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799757#M80045</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-10-24T15:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: SendCommand</title>
      <link>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799758#M80046</link>
      <description>you need to call Sub AddHandlers().&lt;BR /&gt;
I not use AutoCAD.Interop.&lt;BR /&gt;
it forgives my English&lt;BR /&gt;
tp&lt;BR /&gt;
&lt;BR /&gt;
' ========================== START CODE ============================&lt;BR /&gt;
&lt;BR /&gt;
Imports AcAp = Autodesk.AutoCAD.ApplicationServices&lt;BR /&gt;
Imports AcDb = Autodesk.AutoCAD.DatabaseServices&lt;BR /&gt;
Imports AcRx = Autodesk.AutoCAD.Runtime&lt;BR /&gt;
&lt;BR /&gt;
Public Module Module1&lt;BR /&gt;
&lt;BR /&gt;
   &lt;ACRX.COMMANDMETHOD&gt; _&lt;BR /&gt;
   Public Sub Teste()&lt;BR /&gt;
      Dim doc As AcAp.Document =&lt;BR /&gt;
AcAp.Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
      ' First call AddHandlers to inicitiate events&lt;BR /&gt;
      AddHandlers()&lt;BR /&gt;
      doc.SendStringToExecute("_zoom" &amp;amp; vbCr &amp;amp; "e" &amp;amp; vbCr, True, False,&lt;BR /&gt;
False)&lt;BR /&gt;
   End Sub&lt;BR /&gt;
&lt;BR /&gt;
   Private m_Command As String = Nothing&lt;BR /&gt;
&lt;BR /&gt;
   Sub AddHandlers()&lt;BR /&gt;
      Dim d As AcAp.Document =&lt;BR /&gt;
AcAp.Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
      AddHandler d.CommandWillStart, AddressOf CommandWillStart&lt;BR /&gt;
      AddHandler d.CommandEnded, AddressOf CommandEnded&lt;BR /&gt;
      AddHandler d.CommandFailed, AddressOf CommandFailed&lt;BR /&gt;
      AddHandler d.CommandCancelled, AddressOf CommandCancelled&lt;BR /&gt;
   End Sub&lt;BR /&gt;
&lt;BR /&gt;
   Sub RemoveHandlers()&lt;BR /&gt;
      Dim d As AcAp.Document =&lt;BR /&gt;
AcAp.Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
      RemoveHandler d.CommandWillStart, AddressOf CommandWillStart&lt;BR /&gt;
      RemoveHandler d.CommandEnded, AddressOf CommandEnded&lt;BR /&gt;
      RemoveHandler d.CommandFailed, AddressOf CommandFailed&lt;BR /&gt;
      RemoveHandler d.CommandCancelled, AddressOf CommandCancelled&lt;BR /&gt;
      m_Command = Nothing&lt;BR /&gt;
   End Sub&lt;BR /&gt;
&lt;BR /&gt;
   Sub CommandWillStart(ByVal sender As Object, ByVal e As&lt;BR /&gt;
Autodesk.AutoCAD.ApplicationServices.CommandEventArgs)&lt;BR /&gt;
      If m_Command Is Nothing Then m_Command = e.GlobalCommandName&lt;BR /&gt;
   End Sub&lt;BR /&gt;
&lt;BR /&gt;
   Sub CommandEnded(ByVal sender As Object, ByVal e As&lt;BR /&gt;
Autodesk.AutoCAD.ApplicationServices.CommandEventArgs)&lt;BR /&gt;
      If e.GlobalCommandName =  m_Command Then&lt;BR /&gt;
         Dim db As AcDb.Database&lt;BR /&gt;
=AcDb.HostApplicationServices.WorkingDatabase()&lt;BR /&gt;
         db.SaveAs("C:\Teste.dwg", AcDb.DwgVersion.Current)&lt;BR /&gt;
         RemoveHandlers()&lt;BR /&gt;
      End If&lt;BR /&gt;
   End Sub&lt;BR /&gt;
&lt;BR /&gt;
   Sub CommandCancelled(ByVal sender As Object, ByVal e As&lt;BR /&gt;
Autodesk.AutoCAD.ApplicationServices.CommandEventArgs)&lt;BR /&gt;
      RemoveHandlers()&lt;BR /&gt;
   End Sub&lt;BR /&gt;
&lt;BR /&gt;
   Sub CommandFailed(ByVal sender As Object, ByVal e As&lt;BR /&gt;
Autodesk.AutoCAD.ApplicationServices.CommandEventArgs)&lt;BR /&gt;
      RemoveHandlers()&lt;BR /&gt;
   End Sub&lt;BR /&gt;
&lt;BR /&gt;
End Module&lt;BR /&gt;
&lt;BR /&gt;
' ========================== END CODE ============================&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I'm protected by SpamBrave&lt;BR /&gt;
http://www.spambrave.com/&lt;/ACRX.COMMANDMETHOD&gt;</description>
      <pubDate>Tue, 24 Oct 2006 16:34:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799758#M80046</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-10-24T16:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: SendCommand</title>
      <link>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799759#M80047</link>
      <description>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;
&lt;RAUL aguilar=""&gt; wrote in message news:5372117@discussion.autodesk.com...&lt;BR /&gt;
Hi:&lt;BR /&gt;
&lt;BR /&gt;
Can somebody please tell me if it is possible to Synchronously execute a command sent via SendCommand while using the COM/ActiveX interface in VB 2005? I know I can do this in VBA (in my particular application the commands executed via SendCommand are always complete and the program never needs to wait for user data), but I was hoping I could do the same using VB 2005. Unfortunately, so far I have not been able to do that. In the example below the SendCommand is executed after the file has been saved and I want it to execute before the file is saved. Can somebody please tell me if it is even possible to do what I want to do?&lt;BR /&gt;
&lt;BR /&gt;
Any ideas would be greatly appreciated,&lt;BR /&gt;
&lt;BR /&gt;
Raul&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Imports Autodesk.AutoCAD.Runtime&lt;BR /&gt;
Imports Autodesk.AutoCAD.Interop&lt;BR /&gt;
Imports Autodesk.AutoCAD.Interop.Common&lt;BR /&gt;
Imports System.IO&lt;BR /&gt;
&lt;BR /&gt;
Public Class ClsTest&lt;BR /&gt;
&lt;BR /&gt;
 &amp;gt;CommandMethod("Test")&amp;gt; _&lt;BR /&gt;
 Public Sub Test()&lt;BR /&gt;
   Dim OutputPath As String = "c:\Test\dwg"&lt;BR /&gt;
   Dim ObjAcad As AcadApplication&lt;BR /&gt;
   Dim ThisDrawing As AcadDocument&lt;BR /&gt;
   Dim Obj As Acad3DSolid&lt;BR /&gt;
   Dim ZeroOrgin() As Double = {0, 0, 0}&lt;BR /&gt;
   Dim Width as Double = 2&lt;BR /&gt;
   Dim Depth as Double = 4&lt;BR /&gt;
   Dim Length as Double = 8&lt;BR /&gt;
&lt;BR /&gt;
   Directory.Delete(OutputPath, True)&lt;BR /&gt;
   Directory.CreateDirectory(OutputPath)&lt;BR /&gt;
&lt;BR /&gt;
   ObjAcad = DirectCast(GetObject(, "AutoCAD.Application.17"), AcadApplication)&lt;BR /&gt;
   ObjAcad.Visible = True&lt;BR /&gt;
   ThisDrawing = ObjAcad.ActiveDocument&lt;BR /&gt;
&lt;BR /&gt;
   Obj = ThisDrawing.ModelSpace.AddBox(ZeroOrgin, Width, Depth, Length)&lt;BR /&gt;
   ThisDrawing.SendCommand("_zoom" &amp;amp; vbCr &amp;amp; "e" &amp;amp; vbCr)&lt;BR /&gt;
&lt;BR /&gt;
   ' I was hoping the Do Loop below would be the answer to my problem,&lt;BR /&gt;
   ' but IsQuiescent is never True and as a result the program hangs.&lt;BR /&gt;
   ' Without the Do Loop, the SendCommand is not executed until after&lt;BR /&gt;
   ' the drawing is saved, which is not what I want. Any ideas how to&lt;BR /&gt;
   ' solve this problem?&lt;BR /&gt;
   Do Until ObjAcad.GetAcadState.IsQuiescent = True&lt;BR /&gt;
   Loop&lt;BR /&gt;
&lt;BR /&gt;
   ThisDrawing.SaveAs(OutputPath &amp;amp; "\Test.dwg")&lt;BR /&gt;
&lt;BR /&gt;
 End Sub&lt;BR /&gt;
End Class&lt;/RAUL&gt;</description>
      <pubDate>Tue, 24 Oct 2006 17:27:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799759#M80047</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-10-24T17:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: SendCommand</title>
      <link>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799760#M80048</link>
      <description>All:&lt;BR /&gt;
&lt;BR /&gt;
Thank you so much for taking the time to respond. I finally got my problem solved. It looks like the problem was with the way I was using the CommandMethod. Here is the way I was originally using it (notice that I replaced the "&amp;lt;" symbol with "&amp;gt;" just to avoid the online editor from suppressing the entire CommandMethod line):&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt;CommandMethod("Test")&amp;gt; _&lt;BR /&gt;
&lt;BR /&gt;
All I needed to do is this instead:&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt;CommandMethod("Test",CommandFlags.Session)&amp;gt; _&lt;BR /&gt;
&lt;BR /&gt;
After adding the CommandFlags.Session everything works as expected (i.e. the SendCommands and rest of VB.Net code execute in the order in which they are typed).&lt;BR /&gt;
&lt;BR /&gt;
Thanks again for your help,&lt;BR /&gt;
&lt;BR /&gt;
Raul</description>
      <pubDate>Tue, 24 Oct 2006 17:51:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799760#M80048</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-10-24T17:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: SendCommand</title>
      <link>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799761#M80049</link>
      <description>I see many examples of point parameters on commands, but what about selected/passed objects like polylines or blocks?&lt;BR /&gt;
&lt;BR /&gt;
How are those commands formatted? maybe with the ObjectIds?</description>
      <pubDate>Thu, 07 Feb 2008 18:03:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799761#M80049</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-02-07T18:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: SendCommand</title>
      <link>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799762#M80050</link>
      <description>This is a a topic for the VBA newsgroup.&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 2008&lt;BR /&gt;
Supporting AutoCAD 2000 through 2008&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;JASON.BRENTON&gt; wrote in message news:5841893@discussion.autodesk.com...&lt;BR /&gt;
I see many examples of point parameters on commands, but what about selected/passed objects like polylines or blocks?&lt;BR /&gt;
&lt;BR /&gt;
How are those commands formatted? maybe with the ObjectIds?&lt;/JASON.BRENTON&gt;</description>
      <pubDate>Thu, 07 Feb 2008 22:23:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799762#M80050</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-02-07T22:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: SendCommand</title>
      <link>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799763#M80051</link>
      <description>why? i am calling it from a .net dll, not vba</description>
      <pubDate>Thu, 07 Feb 2008 22:27:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799763#M80051</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-02-07T22:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: SendCommand</title>
      <link>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799764#M80052</link>
      <description>&lt;JASON.BRENTON&gt; wrote in message &lt;BR /&gt;
&lt;BR /&gt;
&amp;gt;&amp;gt; why? i am calling it from a .net dll, not vba&lt;BR /&gt;
&lt;BR /&gt;
You are calling what from a .NET dll?&lt;BR /&gt;
&lt;BR /&gt;
A managed ObjectARX API, or an ActiveX API?&lt;BR /&gt;
&lt;BR /&gt;
We mainly discuss using the managed ObjectARX API here, not the VBA/ActiveX API.&lt;BR /&gt;
&lt;BR /&gt;
Your question about SendCommand() has the same answer regardless of what programming langauge you're calling it from, and has been asked and answered dozens of times in the VBA newsgroup (hint: search that newsgroup on the keyword "handent").&lt;BR /&gt;
&lt;BR /&gt;
It may be called the VBA newsgroup, but it would more accurately be called the ActiveX newsgroup, because many topics about that API are discussed there, including those related to using it from standalone VB6 (not VBA); Delphi; C#; and other ActiveX-enabled development tools.&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 2008&lt;BR /&gt;
Supporting AutoCAD 2000 through 2008&lt;BR /&gt;
http://www.acadxtabs.com&lt;/JASON.BRENTON&gt;</description>
      <pubDate>Thu, 07 Feb 2008 22:46:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799764#M80052</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-02-07T22:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: SendCommand</title>
      <link>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799765#M80053</link>
      <description>well that is more clear of a response, as most likely SendStringToExecute uses similar style. either can be found. I'll check.</description>
      <pubDate>Thu, 07 Feb 2008 23:19:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sendcommand/m-p/1799765#M80053</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-02-07T23:19:04Z</dc:date>
    </item>
  </channel>
</rss>

