VB如何操作已经打开的CAD
如果用VB操作未打开CAD,第一次运行是有误的,第二次运行就OK,代码如下:Set AcadApp = CreateObject("Autocad.Application")
Set ADWG = AcadApp.Documents.Open("c:\drawing1.dwg")
Set AcadDoc = AcadApp.ActiveDocument
Set Mospace = AcadDoc.ModelSpace
Set AcadUtil = AcadDoc.Utility
AcadApp.Visible = True
Dim AAA As Variant
AA = AcadUtil.GetReal(vbCrLf & "面积:")
如果用VB操作一个已经打开的CAD,一直是出错的,代码如下:
Set AcadApp = CreateObject("Autocad.Application")Set AcadDoc = AcadApp.ActiveDocument
Set Mospace = AcadDoc.ModelSpace
Set AcadUtil = AcadDoc.Utility
AcadApp.Visible = True
Dim AAA As Variant
AA = AcadUtil.GetReal(vbCrLf & "面积:")
希望高手给予以上两个例子进行纠错指导。