- 积分
- 368
- 明经币
- 个
- 注册时间
- 2006-11-30
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
- <CommandMethod("ls1", CommandFlags.Session)> Public Sub ls1()
- Dim objOpenFileDialog As Autodesk.AutoCAD.Windows.OpenFileDialog = New Autodesk.AutoCAD.Windows.OpenFileDialog("选择文件", "CAD图", "dwg", "DialogName", Autodesk.AutoCAD.Windows.OpenFileDialog.OpenFileDialogFlags.AllowMultiple)
- If objOpenFileDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
- '创建文件夹
- Dim myDirectory As String = Path.GetDirectoryName(objOpenFileDialog.Filename)
- Dim newFolder As String = "\转换后"
- If Not Directory.Exists(myDirectory + newFolder) Then
- Directory.CreateDirectory(myDirectory + newFolder)
- End If
- For i As Integer = 0 To objOpenFileDialog.GetFilenames.Length - 1
- Try
- Dim Filename As String = objOpenFileDialog.GetFilenames(i)
- Dim doc As Document = Application.DocumentManager.Open(Filename, False)
- '执行命令,接受Document参数。
- Dim doclock As DocumentLock = doc.LockDocument()
- pRastIns(Filename)
- doclock.Dispose()
- '改文件名
- Dim newFileName As String = myDirectory + newFolder + "\" + Path.GetFileName(Filename)
- '存储的文件版本
- doc.Database.SaveAs(newFileName, DwgVersion.Current)
- ' ed.WriteMessage("newFileName:<" + newFileName + ">");
- doc.CloseAndSave(newFileName)
- Catch ex As Exception
- ed.WriteMessage(ex.Message)
- End Try
- Next
- End If
- End Sub
运行有些文件没问题,有些有问题,不知道错在哪里
问题是这句Dim doc As Document = Application.DocumentManager.Open(Filename, False)
cad提示如下:
致命错误:Unhandled Access Violation Reading 0x7efc4134 Exception at 62066e4h
忘高手解决,在线等
|
|