下面是我的程序:
Dim path As String
Dim FName As String
Dim paht1 As String
Dim newLayer As AcadLayer
Dim DOC As AcadDocument
path = "D:\管线处理\处理\"
path1 = "D:\管线处理\test\"
FName = Dir(path, vbDirectory)
Do While FName <> ""
Label2.Caption = FName
If Len(FName) > 3 Then
ThisDrawing.Application.Documents.Open (path & FName)
Set DOC = ThisDrawing.Application.Documents.Open(path & FName)
'Doc.Open (path & FName)
Set newLayer = ThisDrawing.Layers(0)
ThisDrawing.ActiveLayer = newLayer
temp = Left(FName, Len(FName) - 4)
'ThisDrawing.PurgeAll
DOC.PurgeAll
'ThisDrawing.SaveAs path1 & temp & ".dxf", acR13_dxf
DOC.SaveAs path1 & temp, acR13_dxf
DOC.Close
End If
FName = Dir
Loop
我在运行后出现了问题,提示说“aotucad cannot close ....dwg,there is a commad still active,please complete the commad and try again”
如果我把CLOSE去掉的话,运行完程序后就出现“autocad is busy,can not close”
请大家帮我看看谢谢
Dim path As String
Dim FName As String
Dim paht1 As String
Dim newLayer As AcadLayer
Dim DOC As AcadDocument
path = "D:\管线处理\处理\"
path1 = "D:\管线处理\test\"
FName = Dir(path, vbDirectory)
Do While FName <> ""
Label2.Caption = FName
If Len(FName) > 3 Then
ThisDrawing.Application.Documents.Open (path & FName)
Set DOC = ThisDrawing.Application.Documents.Open(path & FName)
'Doc.Open (path & FName)
Set newLayer = ThisDrawing.Layers(0)
ThisDrawing.ActiveLayer = newLayer
temp = Left(FName, Len(FName) - 4)
'ThisDrawing.PurgeAll
DOC.PurgeAll
'ThisDrawing.SaveAs path1 & temp & ".dxf", acR13_dxf
DOC.SaveAs path1 & temp, acR13_dxf
DOC.Close
End If
FName = Dir
Loop
我在运行后出现了问题,提示说“aotucad cannot close ....dwg,there is a commad still active,please complete the commad and try again”
如果我把CLOSE去掉的话,运行完程序后就出现“autocad is busy,can not close”
请大家帮我看看谢谢
Set DOC = ThisDrawing.Application.Documents.Open(path & FName)
上面哪句去掉! path1 & temp 是否已存在?