I need to run an AutoCAD command from my .NET command and allow the user be able to interactively input data. After I call this command I need to take further action. I am using ActiveX and SendCommand. My code runs before the AutoCAD command is completed by the user. Is there a way to cause my code to wait until the command is finished?
An approach to consider is to place the .NET code that needs to run after the AutoCAD command finishes in a separate .NET command. This command can be called after the AutoCAD command is complete. Here is a VB.NET example that shows this idea. It runs the LINE command and when the command is finished it runs a command named Test2:
Public Shared Sub wbtest1()
Dim oApp As AcadApplication = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication
Dim cmdStr As String
'this will allow for an open ended line command
' when the line command is finished the .NET command wbtest2 will run
cmdStr = "(command ""Line"")(while(>(getvar ""cmdactive"")0)(command pause))(command ""test2"") "
' this is called before the LINE command is completed
Public Shared Sub wbtest2()
' this is called after LINE command completes
MsgBox("From Test2", MsgBoxStyle.Information)