It seems that I have a synchronization problem with the SendCommand in the example below. The two SendCommands are not executed until after the file has been saved. I tried waiting until the IsQuiescent state is True, but that never happens. Can somebody give me any ideas as to why the IsQuiescent state appears to be stuck to False? Is there another way to solve this synchronization problem with the SendCommand?
Thank you very much in advance for your help,
Raul
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AutoCAD.Interop.Common
Imports System.IO
Public Class ClsTest
_
Public Sub Test()
Dim OutputPath As String = "c:\Test\dwg"
Dim ObjAcad As AcadApplication
Dim ThisDrawing As AcadDocument
Dim ZeroOrgin() As Double = {0, 0, 0}
Dim Obj As Acad3DSolid
Directory.Delete(OutputPath, True)
Directory.CreateDirectory(OutputPath)
ObjAcad = DirectCast(GetObject(, "AutoCAD.Application.17"), AcadApplication)
ObjAcad.Visible = True
ThisDrawing = ObjAcad.ActiveDocument
Obj = ThisDrawing.ModelSpace.AddBox(ZeroOrgin, 2, 4, 😎
ThisDrawing.SendCommand("VPOINT r 225 8 ")
ThisDrawing.SendCommand("SHADEMODE Realistic ")
' It appears that IsQuiescent is never True and as a result,
' this loop never exits. Any ideas why? Is there another way to
' know when the SendCommand is finished?
Do Until ObjAcad.GetAcadState.IsQuiescent = True
Loop
ThisDrawing.SaveAs(OutputPath & "\Test.dwg")
End Sub
End Class